diff options
author | Mike Klein <mtklein@chromium.org> | 2018-06-26 11:43:06 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-26 19:02:52 +0000 |
commit | 3785471ff641b7ec4218a32fcf76363b9ac81bab (patch) | |
tree | 7596487528841f9a6e32c105c909667c54799d72 /src/core/SkConvertPixels.cpp | |
parent | 9b6125d046198bff736a509769b51908aaff326a (diff) |
basic first pass at RGBA F32 support
Draws basically the same as f16.
The existing load_f32, load_f32_dst, and store_f32 stages all had the
same bug that we'd never noticed because dy was always 0 until now.
Change-Id: Ibbd393fa1acc5df414be4cdef0f5a9d11dcccdb3
Reviewed-on: https://skia-review.googlesource.com/137585
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core/SkConvertPixels.cpp')
-rw-r--r-- | src/core/SkConvertPixels.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/SkConvertPixels.cpp b/src/core/SkConvertPixels.cpp index b0d37cd89f..25645d485c 100644 --- a/src/core/SkConvertPixels.cpp +++ b/src/core/SkConvertPixels.cpp @@ -231,6 +231,16 @@ static void convert_to_alpha8(uint8_t* dst, size_t dstRB, const SkImageInfo& src } break; } + case kRGBA_F32_SkColorType: { + auto rgba = (const float*)src; + for (int y = 0; y < srcInfo.height(); y++) { + for (int x = 0; x < srcInfo.width(); x++) { + dst[x] = (uint8_t)(255.0f * rgba[4*x+3]); + } + dst = SkTAddOffset<uint8_t>(dst, dstRB); + rgba = SkTAddOffset<const float>(rgba, srcRB); + } + } break; default: SkASSERT(false); break; @@ -270,6 +280,9 @@ static void convert_with_pipeline(const SkImageInfo& dstInfo, void* dstRow, size case kRGBA_F16_SkColorType: pipeline.append(SkRasterPipeline::load_f16, &src); break; + case kRGBA_F32_SkColorType: + pipeline.append(SkRasterPipeline::load_f32, &src); + break; case kGray_8_SkColorType: pipeline.append(SkRasterPipeline::load_g8, &src); break; @@ -381,6 +394,9 @@ static void convert_with_pipeline(const SkImageInfo& dstInfo, void* dstRow, size case kRGBA_F16_SkColorType: pipeline.append(SkRasterPipeline::store_f16, &dst); break; + case kRGBA_F32_SkColorType: + pipeline.append(SkRasterPipeline::store_f32, &dst); + break; case kARGB_4444_SkColorType: pipeline.append(SkRasterPipeline::store_4444, &dst); break; |