Use saveLayer-determined CT in SkGpuDevice::onCreateDevice
Currently Ganesh always uses the prev render target CT, but saveLayer
may force a different CT, depending on flags.
This fixes handling of saveLayer/kF16ColorType (added in
https://skia-review.googlesource.com/c/skia/+/227066).
Change-Id: I8e73fdfdf18eb61f97fadd0504a4bd0f4a71977d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227258
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index e5eb2d3..b24dcef 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1655,18 +1655,14 @@
SkBackingFit fit = kNever_TileUsage == cinfo.fTileUsage ? SkBackingFit::kApprox
: SkBackingFit::kExact;
- GrColorType colorType = fRenderTargetContext->colorSpaceInfo().colorType();
- if (colorType == GrColorType::kRGBA_1010102) {
- // If the original device is 1010102, fall back to 8888 so that we have a usable alpha
- // channel in the layer.
- colorType = GrColorType::kRGBA_8888;
- }
+ // CT is sanitized in SkCanvas::internalSaveLayer
+ SkASSERT(cinfo.fInfo.colorType() != SkColorType::kRGBA_1010102_SkColorType);
sk_sp<GrRenderTargetContext> rtc(fContext->priv().makeDeferredRenderTargetContext(
fit,
cinfo.fInfo.width(),
cinfo.fInfo.height(),
- colorType,
+ SkColorTypeToGrColorType(cinfo.fInfo.colorType()),
fRenderTargetContext->colorSpaceInfo().refColorSpace(),
fRenderTargetContext->numSamples(),
GrMipMapped::kNo,