[core] Make Image safer
Provide Image::copy, which handles copying rectangles from a source to a destination, with thorough bounds checking. Also fixes an indexing error in SpriteAtlas, where the top row of pixels in a wrapped image was copied from the wrong source row.
This commit is contained in:
@@ -8,7 +8,7 @@ namespace mbgl {
|
||||
|
||||
FrameHistory::FrameHistory() {
|
||||
changeOpacities.fill(0);
|
||||
std::fill(opacities.data.get(), opacities.data.get() + opacities.bytes(), 0);
|
||||
opacities.fill(0);
|
||||
}
|
||||
|
||||
void FrameHistory::record(const TimePoint& now, float zoom, const Duration& duration) {
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
private:
|
||||
std::array<TimePoint, 256> changeTimes;
|
||||
std::array<uint8_t, 256> changeOpacities;
|
||||
const AlphaImage opacities{ { 256, 1 } };
|
||||
AlphaImage opacities{ { 256, 1 } };
|
||||
|
||||
int16_t previousZoomIndex = 0;
|
||||
TimePoint previousTime;
|
||||
|
||||
Reference in New Issue
Block a user