Fix size calculation

size is in bytes

Fixes: 185429940
Test: builds
Change-Id: Ib80eecd9ee8830877cfd9861d7126201d88d3f32
This commit is contained in:
John Reck
2021-04-15 14:04:15 -04:00
parent 9692654a41
commit dc323f27ad
2 changed files with 3 additions and 4 deletions

View File

@@ -60,12 +60,11 @@ void SkiaRecordingCanvas::punchHole(const SkRRect& rect) {
// Add the marker annotation to allow HWUI to determine where the current
// clip/transformation should be applied
SkVector vector = rect.getSimpleRadii();
const int dataSize = 2;
float data[dataSize];
float data[2];
data[0] = vector.x();
data[1] = vector.y();
mRecorder.drawAnnotation(rect.rect(), HOLE_PUNCH_ANNOTATION.c_str(),
SkData::MakeWithCopy(data, dataSize));
SkData::MakeWithCopy(data, 2 * sizeof(float)));
// Clear the current rect within the layer itself
SkPaint paint = SkPaint();

View File

@@ -22,7 +22,7 @@ using namespace android::uirenderer::skiapipeline;
void TransformCanvas::onDrawAnnotation(const SkRect& rect, const char* key, SkData* value) {
if (HOLE_PUNCH_ANNOTATION == key) {
auto* rectParams = static_cast<const float*>(value->data());
auto* rectParams = reinterpret_cast<const float*>(value->data());
float radiusX = rectParams[0];
float radiusY = rectParams[1];
SkRRect roundRect = SkRRect::MakeRectXY(rect, radiusX, radiusY);