Various minor cross-platform changes
Review URL: https://codereview.chromium.org/1310843007
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 @@
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 @@
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 @@
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;