[core] standardize on uint16_t for texture sizes
This commit is contained in:
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
// Reads the pixel data from the current framebuffer. If your View implementation
|
||||
// doesn't support reading from the framebuffer, return a null pointer.
|
||||
virtual PremultipliedImage readStillImage();
|
||||
virtual PremultipliedImage readStillImage(std::array<uint16_t, 2> size = {{ 0, 0 }});
|
||||
|
||||
// Notifies a watcher of map x/y/scale/rotation changes.
|
||||
virtual void notifyMapChange(MapChange change);
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
void deactivate() override;
|
||||
void notifyMapChange(MapChange) override;
|
||||
|
||||
PremultipliedImage readStillImage() override;
|
||||
PremultipliedImage readStillImage(std::array<uint16_t, 2> size = {{ 0, 0 }}) override;
|
||||
|
||||
void resize(uint16_t width, uint16_t height);
|
||||
void setMapChangeCallback(std::function<void(MapChange)>&& cb) { mapChangeCallback = std::move(cb); }
|
||||
|
||||
@@ -18,12 +18,12 @@ class Image : private util::noncopyable {
|
||||
public:
|
||||
Image() = default;
|
||||
|
||||
Image(size_t w, size_t h)
|
||||
Image(uint16_t w, uint16_t h)
|
||||
: width(w),
|
||||
height(h),
|
||||
data(std::make_unique<uint8_t[]>(size())) {}
|
||||
|
||||
Image(size_t w, size_t h, std::unique_ptr<uint8_t[]> data_)
|
||||
Image(uint16_t w, uint16_t h, std::unique_ptr<uint8_t[]> data_)
|
||||
: width(w),
|
||||
height(h),
|
||||
data(std::move(data_)) {}
|
||||
@@ -46,11 +46,11 @@ public:
|
||||
rhs.data.get() + rhs.size());
|
||||
}
|
||||
|
||||
size_t stride() const { return width * 4; }
|
||||
size_t size() const { return width * height * 4; }
|
||||
size_t stride() const { return static_cast<size_t>(width) * 4; }
|
||||
size_t size() const { return static_cast<size_t>(width) * height * 4; }
|
||||
|
||||
size_t width = 0;
|
||||
size_t height = 0;
|
||||
uint16_t width = 0;
|
||||
uint16_t height = 0;
|
||||
std::unique_ptr<uint8_t[]> data;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user