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

Unified Diff: src/image/SkSurface_Raster.cpp

Issue 108723003: Revert "Revert "PixelRef now returns (nearly) everything that is currently in SkBitmap. The goal is… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix warnings, update SkImageRef_ashmem Created 7 years 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 | « src/image/SkImage_Raster.cpp ('k') | src/images/SkImageRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface_Raster.cpp
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 27db504df6f056e8d35d1ca68adc608bfa4164d7..61ade6f46c8ec6584c3a5a18995dff3a766cca2c 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -155,19 +155,9 @@ SkSurface* SkSurface::NewRaster(const SkImageInfo& info) {
return NULL;
}
- static const size_t kMaxTotalSize = SK_MaxS32;
- size_t rowBytes = SkImageMinRowBytes(info);
- uint64_t size64 = (uint64_t)info.fHeight * rowBytes;
- if (size64 > kMaxTotalSize) {
- return NULL;
- }
-
- size_t size = (size_t)size64;
- void* pixels = sk_malloc_throw(size);
- if (NULL == pixels) {
+ SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL));
+ if (NULL == pr.get()) {
return NULL;
}
-
- SkAutoTUnref<SkPixelRef> pr(SkNEW_ARGS(SkMallocPixelRef, (pixels, size, NULL, true)));
- return SkNEW_ARGS(SkSurface_Raster, (info, pr, rowBytes));
+ return SkNEW_ARGS(SkSurface_Raster, (info, pr, info.minRowBytes()));
}
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | src/images/SkImageRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698