forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage_buffer.h
More file actions
40 lines (29 loc) · 826 Bytes
/
image_buffer.h
File metadata and controls
40 lines (29 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Aseprite Document Library
// Copyright (c) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef DOC_IMAGE_BUFFER_H_INCLUDED
#define DOC_IMAGE_BUFFER_H_INCLUDED
#pragma once
#include "base/ints.h"
#include "base/shared_ptr.h"
#include <vector>
#include <cstddef>
namespace doc {
class ImageBuffer {
public:
ImageBuffer(std::size_t size = 1) : m_buffer(size) {
}
std::size_t size() const { return m_buffer.size(); }
uint8_t* buffer() { return &m_buffer[0]; }
void resizeIfNecessary(std::size_t size) {
if (size > m_buffer.size())
m_buffer.resize(size);
}
private:
std::vector<uint8_t> m_buffer;
};
typedef base::SharedPtr<ImageBuffer> ImageBufferPtr;
} // namespace doc
#endif