From 2dc29940c54b5d21c81dade8a7755dd08316b6b3 Mon Sep 17 00:00:00 2001 From: jvanverth Date: Tue, 1 Sep 2015 07:16:46 -0700 Subject: [PATCH] Various minor cross-platform changes Review URL: https://codereview.chromium.org/1310843007 --- src/gpu/GrGpu.cpp | 9 +++++++++ src/gpu/gl/GrGLGpu.cpp | 4 ---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 2fdfbc4..9f8e5e6 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -279,6 +279,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 +337,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(); diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 1a28963..44b7505 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -564,10 +564,6 @@ bool GrGLGpu::onWritePixels(GrSurface* surface, int left, int top, int width, int height, GrPixelConfig config, const void* buffer, size_t rowBytes) { - if (nullptr == buffer) { - return false; - } - GrGLTexture* glTex = static_cast(surface->asTexture()); if (!glTex) { return false; -- 2.7.4