Correctly set GrBackendFormat when changing colortype of bitmap in GrProxyProvider.
Bug: chromium:974177
Change-Id: I725f1ba63cbd57348419654a45934f09d1bcb6f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220996
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 3620881..bb9ca00 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -334,13 +334,9 @@
SkBudgeted::kYes, SkBackingFit::kExact);
}
- const GrBackendFormat format =
- this->caps()->getBackendFormatFromColorType(bitmap.info().colorType());
- if (!format.isValid()) {
- return nullptr;
- }
-
+ SkColorType colorType = bitmap.info().colorType();
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info());
+
if (!this->caps()->isConfigTexturable(desc.fConfig)) {
SkBitmap copy8888;
if (!copy8888.tryAllocPixels(bitmap.info().makeColorType(kRGBA_8888_SkColorType)) ||
@@ -350,6 +346,12 @@
copy8888.setImmutable();
baseLevel = SkMakeImageFromRasterBitmap(copy8888, kNever_SkCopyPixelsMode);
desc.fConfig = kRGBA_8888_GrPixelConfig;
+ colorType = kRGBA_8888_SkColorType;
+ }
+
+ const GrBackendFormat format = this->caps()->getBackendFormatFromColorType(colorType);
+ if (!format.isValid()) {
+ return nullptr;
}
SkPixmap pixmap;