Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ab1b6f8 authored by Romain Guy's avatar Romain Guy
Browse files

Fix CTS : BitmapRGBAF16Test#testSetPixel failure

Don't grab a pointer to a temporary object on the stack!

Bug: 62458021
Test: CtsGraphicsTestCase
Change-Id: Ic9662e76c9064b3f3af6f8a4534d2ef56f9c5eea
parent adca091f
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -328,11 +328,12 @@ static void FromColor_F16_Raw(void* dst, const SkColor src[], int width,
    uint64_t* d = (uint64_t*)dst;

    for (int i = 0; i < width; i++) {
        const float* color = SkColor4f::FromColor(*src++).vec();
        const SkColor4f color = SkColor4f::FromColor(*src++);
        uint16_t* scratch = reinterpret_cast<uint16_t*>(d++);
        for (int i = 0; i < 4; ++i) {
            scratch[i] = SkFloatToHalf(color[i]);
        }
        scratch[0] = SkFloatToHalf(color.fR);
        scratch[1] = SkFloatToHalf(color.fG);
        scratch[2] = SkFloatToHalf(color.fB);
        scratch[3] = SkFloatToHalf(color.fA);
    }
}