Buffer.h
author František Kučera <franta-hg@frantovo.cz>
Sun, 03 Dec 2023 00:57:54 +0100
branchv_0
changeset 13 82bb4fe2fd4a
parent 0 bb715a82a8f1
permissions -rw-r--r--
ImageLoader: convert images always to 8-bit depth as expected by Shark.cpp (i.e. 16-bit images can be loaded now)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * ShaderShark
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2023 František Kučera (Frantovo.cz, GlobalCode.info)
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
#pragma once
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include <unistd.h>
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
class Buffer {
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
protected:
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
	char* data;
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
	size_t size;
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
public:
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
	Buffer() {
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
	}
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	virtual ~Buffer() {
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	}
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
	Buffer(const Buffer&) = delete;
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
	Buffer& operator=(const Buffer&) = delete;
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	const char* getData() const {
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
		return data;
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	}
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
	const size_t getSize() const {
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
		return size;
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
	}
bb715a82a8f1 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
};