Fix creating gpu texture from raster image.
In the new world if the GrColorType cannot creating a support backend format
it returns an invalid GrBackendFormat. So we need to check this in our
fallback when uploading raster image to gpu.
Change-Id: Ie69a06ba1a0badb5b7e78965906f09c0413453e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227859
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 5e2b1fe..9a2da88 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -214,11 +214,8 @@
GrColorType grCT = SkColorTypeToGrColorType(ct);
GrBackendFormat format = this->caps()->getBackendFormatFromColorType(grCT);
- if (!format.isValid()) {
- return nullptr;
- }
- if (!this->caps()->isFormatTexturable(grCT, format)) {
+ if (!format.isValid() || !this->caps()->isFormatTexturable(grCT, format)) {
SkBitmap copy8888;
if (!copy8888.tryAllocPixels(info.makeColorType(kRGBA_8888_SkColorType)) ||
!srcImage->readPixels(copy8888.pixmap(), 0, 0)) {