aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-28 15:16:45 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-28 15:16:45 +0000
commit8e0993d8d8408e538d99229eabf710ad90d97259 (patch)
tree9bd21746bc208c51813c51e5014a8cd86540a882
parentd50d87a185d26a38d7100bbbb119be17947aa5e4 (diff)
SkGrPixelRef can only reference the subset of the Surface specified by its SkImageInfo
BUG=skia: R=bsalomon@google.com, halcanary@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/138143022 git-svn-id: http://skia.googlecode.com/svn/trunk@13217 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/gpu/SkGrPixelRef.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index fdf94870cc..18fefcc789 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -127,6 +127,11 @@ SkGrPixelRef::SkGrPixelRef(const SkImageInfo& info, GrSurface* surface,
}
fUnlock = transferCacheLock;
SkSafeRef(surface);
+
+ if (fSurface) {
+ SkASSERT(info.fWidth <= fSurface->width());
+ SkASSERT(info.fHeight <= fSurface->height());
+ }
}
SkGrPixelRef::~SkGrPixelRef() {
@@ -174,9 +179,9 @@ bool SkGrPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) {
height = subset->height();
} else {
left = 0;
- width = fSurface->width();
+ width = this->info().fWidth;
top = 0;
- height = fSurface->height();
+ height = this->info().fHeight;
}
if (!dst->allocPixels(SkImageInfo::MakeN32Premul(width, height))) {
SkDebugf("SkGrPixelRef::onReadPixels failed to alloc bitmap for result!\n");