Premultiply in DM before drawing unpremul f16

We special case N32, but need to also handle f16

Change-Id: I0d6061d55e55c5952c740255e4600366d8d77919
Reviewed-on: https://skia-review.googlesource.com/17786
Reviewed-by: Matt Sarett <msarett@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
This commit is contained in:
Leon Scroggins III 2017-05-23 16:58:09 -04:00 committed by Skia Commit-Bot
parent 76f70622cf
commit eceee040d6

View File

@ -326,6 +326,16 @@ static void premultiply_if_necessary(SkBitmap& bitmap) {
}
switch (bitmap.colorType()) {
case kRGBA_F16_SkColorType:
for (int y = 0; y < bitmap.height(); y++) {
void* row = bitmap.getAddr(0, y);
SkRasterPipeline p;
p.append(SkRasterPipeline::load_f16, &row);
p.append(SkRasterPipeline::premul);
p.append(SkRasterPipeline::store_f16, &row);
p.run(0, bitmap.width());
}
break;
case kN32_SkColorType:
for (int y = 0; y < bitmap.height(); y++) {
uint32_t* row = (uint32_t*) bitmap.getAddr(0, y);