Add F16Norm support to a few more pixmap helpers

Bug: skia:
Change-Id: I86fd67a792ddfc456e8dd553d9012ed9bc9101f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198822
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Brian Osman 2019-03-07 14:03:58 -05:00 committed by Skia Commit-Bot
parent dfddf340c1
commit 1132f74e11
2 changed files with 5 additions and 2 deletions

View File

@ -358,7 +358,8 @@ public:
*/
const uint16_t* addrF16() const {
SkASSERT(8 == fInfo.bytesPerPixel());
SkASSERT(kRGBA_F16_SkColorType == fInfo.colorType());
SkASSERT(kRGBA_F16_SkColorType == fInfo.colorType() ||
kRGBA_F16Norm_SkColorType == fInfo.colorType());
return reinterpret_cast<const uint16_t*>(fPixels);
}
@ -450,7 +451,8 @@ public:
@return readable unsigned 16-bit pointer to pixel component at (x, y)
*/
const uint16_t* addrF16(int x, int y) const {
SkASSERT(kRGBA_F16_SkColorType == fInfo.colorType());
SkASSERT(kRGBA_F16_SkColorType == fInfo.colorType() ||
kRGBA_F16Norm_SkColorType == fInfo.colorType());
return reinterpret_cast<const uint16_t*>(this->addr64(x, y));
}

View File

@ -305,6 +305,7 @@ SkColor SkPixmap::getColor(int x, int y) const {
| (uint32_t)( b * 255.0f ) << 0
| (uint32_t)( a * 255.0f ) << 24;
}
case kRGBA_F16Norm_SkColorType:
case kRGBA_F16_SkColorType: {
const uint64_t* addr =
(const uint64_t*)fPixels + y * (fRowBytes >> 3) + x;