aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkSurface_Raster.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-13 19:45:58 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-13 19:45:58 +0000
commitbf790232f6d94b54239dbc210d8beee7411ca458 (patch)
tree7944f60fbc7329035d186d0ff5645858c7df4781 /src/image/SkSurface_Raster.cpp
parent0efb21bd1cd359b732a59753f3c1da096aab561a (diff)
Update all callsites to use info for pixelrefs
#define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR in chrome to keep old API signature (for now) BUG= R=scroggo@google.com Review URL: https://codereview.chromium.org/100723005 git-svn-id: http://skia.googlecode.com/svn/trunk@12677 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/image/SkSurface_Raster.cpp')
-rw-r--r--src/image/SkSurface_Raster.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index 27db504df6..61ade6f46c 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()));
}