Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Unified Diff: src/gpu/SkGrPixelRef.cpp

Issue 138143022: SkGrPixelRef can only reference the subset of the Surface specified by its SkImageInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGrPixelRef.cpp
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index fdf94870ccdec1869c816a5744d57f5de797ed26..18fefcc7893b01146698027edf5c451e87e170e3 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");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698