Revert "Use saveLayer-determined CT in SkGpuDevice::onCreateDevice"
This reverts commit 8c5c54ceafa9f32abf9e427dab5a551b0c8ad8b5.
Reason for revert: bad ANGLE diffs, Chrome roll failing
Original change's description:
> 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>
TBR=bsalomon@google.com,fmalita@chromium.org
Change-Id: I0c3e74be64d5286b8d95b2aabaa464ad97fcaccf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227262
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index b24dcef..e5eb2d3 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1655,14 +1655,18 @@
SkBackingFit fit = kNever_TileUsage == cinfo.fTileUsage ? SkBackingFit::kApprox
: SkBackingFit::kExact;
- // CT is sanitized in SkCanvas::internalSaveLayer
- SkASSERT(cinfo.fInfo.colorType() != SkColorType::kRGBA_1010102_SkColorType);
+ 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;
+ }
sk_sp<GrRenderTargetContext> rtc(fContext->priv().makeDeferredRenderTargetContext(
fit,
cinfo.fInfo.width(),
cinfo.fInfo.height(),
- SkColorTypeToGrColorType(cinfo.fInfo.colorType()),
+ colorType,
fRenderTargetContext->colorSpaceInfo().refColorSpace(),
fRenderTargetContext->numSamples(),
GrMipMapped::kNo,