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

Unified Diff: src/image/SkImage_Raster.cpp

Issue 2222593003: use tmp allocator for images in temp shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « src/image/SkImageShader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Raster.cpp
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 645a3db64b31b97d981501d3b72c4ae544256294..67d521e345ef26f46b442d9174c8844a1b54d686 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -7,6 +7,7 @@
#include "SkImage_Base.h"
#include "SkBitmap.h"
+#include "SkBitmapProcShader.h"
#include "SkCanvas.h"
#include "SkColorTable.h"
#include "SkData.h"
@@ -254,7 +255,8 @@ sk_sp<SkImage> SkMakeImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
return sk_make_sp<SkImage_Raster>(info, pr, pixelRefOrigin, rowBytes);
}
-sk_sp<SkImage> SkMakeImageFromRasterBitmap(const SkBitmap& bm, SkCopyPixelsMode cpm) {
+sk_sp<SkImage> SkMakeImageFromRasterBitmap(const SkBitmap& bm, SkCopyPixelsMode cpm,
+ SkTBlitterAllocator* allocator) {
bool hasColorTable = false;
if (kIndex_8_SkColorType == bm.colorType()) {
SkAutoLockPixels autoLockPixels(bm);
@@ -274,7 +276,12 @@ sk_sp<SkImage> SkMakeImageFromRasterBitmap(const SkBitmap& bm, SkCopyPixelsMode
image = SkImage::MakeRasterCopy(pmap);
}
} else {
- image = sk_make_sp<SkImage_Raster>(bm, kNever_SkCopyPixelsMode == cpm);
+ if (allocator) {
+ image.reset(allocator->createT<SkImage_Raster>(bm, kNever_SkCopyPixelsMode == cpm));
+ image.get()->ref(); // account for the allocator being an owner
f(malita) 2016/08/05 21:06:22 nit: image = sk_ref_sp(allocator->createT<>(..
reed1 2016/08/05 21:46:57 Also works, but not sure it reads as clearly (or a
+ } else {
+ image = sk_make_sp<SkImage_Raster>(bm, kNever_SkCopyPixelsMode == cpm);
+ }
}
return image;
}
« no previous file with comments | « src/image/SkImageShader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698