Fix CTS : BitmapRGBAF16Test#testSetPixel failure

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

Bug: 62458021
Test: CtsGraphicsTestCase
Change-Id: Ic9662e76c9064b3f3af6f8a4534d2ef56f9c5eea
This commit is contained in:
Romain Guy
2017-06-08 18:24:25 -07:00
parent adca091fcd
commit 8ab1b6f8bc

View File

@@ -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);
}
}