Index: src/image/SkImage_Raster.cpp |
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp |
index 9c90ba908b1fdc46b0b5ea7357636919d71e7216..b78818db6b71fd4aaadf8eafac5920817824b066 100644 |
--- a/src/image/SkImage_Raster.cpp |
+++ b/src/image/SkImage_Raster.cpp |
@@ -173,6 +173,20 @@ |
return nullptr; |
} |
+ // textures (at least the texture-key) only support 16bit dimensions, so abort early |
+ // if we're too big. |
+ if (fBitmap.width() > 0xFFFF || fBitmap.height() > 0xFFFF) { |
+ return nullptr; |
+ } |
+ |
+ GrUniqueKey key; |
+ GrMakeKeyFromImageID(&key, fBitmap.getGenerationID(), |
+ SkIRect::MakeWH(fBitmap.width(), fBitmap.height()), |
+ *ctx->caps(), params); |
+ |
+ if (GrTexture* tex = ctx->textureProvider()->findAndRefTextureByUniqueKey(key)) { |
+ return tex; |
+ } |
return GrRefCachedBitmapTexture(ctx, fBitmap, params); |
#endif |