Various minor cross-platform changes
authorjvanverth <jvanverth@google.com>
Tue, 1 Sep 2015 14:16:46 +0000 (07:16 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 1 Sep 2015 14:16:46 +0000 (07:16 -0700)
Review URL: https://codereview.chromium.org/1310843007

src/gpu/GrGpu.cpp
src/gpu/gl/GrGLGpu.cpp

index 2fdfbc4..9f8e5e6 100644 (file)
@@ -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();
index 1a28963..44b7505 100644 (file)
@@ -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<GrGLTexture*>(surface->asTexture());
     if (!glTex) {
         return false;