diff options
author | 2013-12-11 18:38:46 +0000 | |
---|---|---|
committer | 2013-12-11 18:38:46 +0000 | |
commit | f3aead2829fa515f790631ee65784a7b9b073343 (patch) | |
tree | 24de164e4a739d5aa0d03b875775b94b86e0c9e6 /src/image/SkSurface_Raster.cpp | |
parent | 6a32add491cc736aab95561d137909cd7c5d65ef (diff) |
remvoe duplicate impl for SkImageInfo flattening
Revert "Revert "PixelRef now returns (nearly) everything that is currently in SkBitmap. The goal is to refactor bitmap later to remove redundancy, and more interestingly, remove the chance for a disconnect between the actual (pixelref) rowbytes and config, and the one claimed by the bitmap.""""""
This reverts commit eabd6b2ed4e494b323c08f32358f45950a0368c3.
BUG=
Review URL: https://codereview.chromium.org/108773003
git-svn-id: http://skia.googlecode.com/svn/trunk@12624 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/image/SkSurface_Raster.cpp')
-rw-r--r-- | src/image/SkSurface_Raster.cpp | 16 |
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())); } |