Index: src/gpu/GrGpu.cpp |
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp |
index 6a1c1dd5c95994460e4e478ada6c61024a44d8e2..b86077848a7b076ff0cd62203bf7a5fadfcbf55f 100644 |
--- a/src/gpu/GrGpu.cpp |
+++ b/src/gpu/GrGpu.cpp |
@@ -272,6 +272,7 @@ bool GrGpu::getReadPixelsInfo(GrSurface* srcSurface, int width, int height, size |
return true; |
} |
+ |
bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height, size_t rowBytes, |
GrPixelConfig srcConfig, DrawPreference* drawPreference, |
WritePixelTempDrawInfo* tempDrawInfo) { |
@@ -279,6 +280,11 @@ bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height, siz |
SkASSERT(tempDrawInfo); |
SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference); |
+ if (GrPixelConfigIsCompressed(dstSurface->desc().fConfig) && |
+ dstSurface->desc().fConfig != srcConfig) { |
+ return false; |
+ } |
+ |
if (this->caps()->useDrawInsteadOfPartialRenderTargetWrite() && |
SkToBool(dstSurface->asRenderTarget()) && |
(width < dstSurface->width() || height < dstSurface->height())) { |
@@ -332,6 +338,10 @@ bool GrGpu::writePixels(GrSurface* surface, |
int left, int top, int width, int height, |
GrPixelConfig config, const void* buffer, |
size_t rowBytes) { |
+ if (!buffer) { |
+ return false; |
+ } |
+ |
this->handleDirtyContext(); |
if (this->onWritePixels(surface, left, top, width, height, config, buffer, rowBytes)) { |
fStats.incTextureUploads(); |