make 1010102/888x layers 8888, not 1010102/888x

This hopefully keeps all other considerations the same,
like sRGB keeps sRGB layers, F16 F16 layers, etc.

Change-Id: Icdf0b259ae782321e6f96c6f8bc814d520c7dd25
Reviewed-on: https://skia-review.googlesource.com/110442
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2018-02-26 15:09:16 -05:00 committed by Skia Commit-Bot
parent 5f33a8ccac
commit 649fb73ab8

View File

@ -1037,18 +1037,19 @@ void SkCanvas::DrawDeviceWithFilter(SkBaseDevice* src, const SkImageFilter* filt
}
static SkImageInfo make_layer_info(const SkImageInfo& prev, int w, int h, const SkPaint* paint) {
// need to force L32 for now if we have an image filter. Once filters support other colortypes
// e.g. sRGB or F16, we can remove this check
// SRGBTODO: Can we remove this check now?
const bool hasImageFilter = paint && paint->getImageFilter();
if ((prev.bytesPerPixel() < 4) || hasImageFilter) {
// force to L32
// Need to force L32 for now if we have an image filter.
// If filters ever support other colortypes, e.g. sRGB or F16, we can remove this check.
if (paint && paint->getImageFilter()) {
return SkImageInfo::MakeN32Premul(w, h);
} else {
// keep the same characteristics as the prev
return SkImageInfo::Make(w, h, prev.colorType(), kPremul_SkAlphaType, prev.refColorSpace());
}
SkColorType ct = prev.colorType();
if (prev.bytesPerPixel() <= 4) {
// "Upgrade" A8, G8, 565, 4444, 1010102, 101010x, and 888x to 8888,
// ensuring plenty of alpha bits for the layer, perhaps losing some color bits in return.
ct = kN32_SkColorType;
}
return SkImageInfo::Make(w, h, ct, kPremul_SkAlphaType, prev.refColorSpace());
}
void SkCanvas::internalSaveLayer(const SaveLayerRec& rec, SaveLayerStrategy strategy) {