aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/SkGpuDevice.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 258713c537..1dec0f6371 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -26,6 +26,7 @@
#include "SkImageCacherator.h"
#include "SkImageFilter.h"
#include "SkImageFilterCache.h"
+#include "SkImageInfoPriv.h"
#include "SkImage_Base.h"
#include "SkLatticeIter.h"
#include "SkMaskFilter.h"
@@ -194,6 +195,10 @@ bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size
int x, int y) {
ASSERT_SINGLE_OWNER
+ if (!SkImageInfoValidConversion(dstInfo, this->imageInfo())) {
+ return false;
+ }
+
return fRenderTargetContext->readPixels(dstInfo, dstPixels, dstRowBytes, x, y);
}
@@ -201,6 +206,10 @@ bool SkGpuDevice::onWritePixels(const SkImageInfo& srcInfo, const void* srcPixel
size_t srcRowBytes, int x, int y) {
ASSERT_SINGLE_OWNER
+ if (!SkImageInfoValidConversion(this->imageInfo(), srcInfo)) {
+ return false;
+ }
+
return fRenderTargetContext->writePixels(srcInfo, srcPixels, srcRowBytes, x, y);
}