aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2018-02-26 15:09:16 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-26 21:05:18 +0000
commit649fb73ab8c580b0112f7e0ebf4dc247c607022a (patch)
treef67867eb36e2a4c5f0765bbc9ba97775f1193b01 /src/core
parent5f33a8ccac141dfaddddc7b9fc39a8428cc233fe (diff)
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>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkCanvas.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 59365f76b0..269fac6f31 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -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) {