diff options
author | sergeyv <sergeyv@google.com> | 2016-10-20 18:39:04 -0700 |
---|---|---|
committer | sergeyv <sergeyv@google.com> | 2016-10-21 12:11:44 -0700 |
commit | ec4a4b13eae2241d1613890c1c1c096bed891845 (patch) | |
tree | 8a59769cc8bff549e8ec0bbd048912e91f218ab6 /libs/hwui/RecordingCanvas.h | |
parent | 5fd2a1cb2726afa7d40fe4750e9defd89c24ed37 (diff) |
Use Bitmap in DisplayList & RecordedOps instead of SkBitmap
Test: refactoring cl.
bug:32216791
Change-Id: I1d8a9a6e772e2176b6c2409409a910478b45f8db
Diffstat (limited to 'libs/hwui/RecordingCanvas.h')
-rw-r--r-- | libs/hwui/RecordingCanvas.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libs/hwui/RecordingCanvas.h b/libs/hwui/RecordingCanvas.h index 6a46bfa377dd..a8fcfeba8e04 100644 --- a/libs/hwui/RecordingCanvas.h +++ b/libs/hwui/RecordingCanvas.h @@ -22,6 +22,7 @@ #include "ResourceCache.h" #include "SkiaCanvasProxy.h" #include "Snapshot.h" +#include "hwui/Bitmap.h" #include "hwui/Canvas.h" #include "utils/LinearAllocator.h" #include "utils/Macros.h" @@ -203,7 +204,7 @@ private: return mState.writableSnapshot()->mutateClipArea().serializeClip(alloc()); } - void drawBitmap(const SkBitmap* bitmap, const SkPaint* paint); + void drawBitmap(Bitmap& bitmap, const SkPaint* paint); void drawSimpleRects(const float* rects, int vertexCount, const SkPaint* paint); @@ -285,14 +286,17 @@ private: return cachedRegion; } - inline const SkBitmap* refBitmap(const SkBitmap& bitmap) { + inline Bitmap* refBitmap(Bitmap& bitmap) { // Note that this assumes the bitmap is immutable. There are cases this won't handle // correctly, such as creating the bitmap from scratch, drawing with it, changing its // contents, and drawing again. The only fix would be to always copy it the first time, // which doesn't seem worth the extra cycles for this unlikely case. - SkBitmap* localBitmap = alloc().create<SkBitmap>(bitmap); - mDisplayList->bitmapResources.push_back(localBitmap); - return localBitmap; + + // this is required because sk_sp's ctor adopts the pointer, + // but does not increment the refcount, + bitmap.ref(); + mDisplayList->bitmapResources.emplace_back(&bitmap); + return &bitmap; } inline const Res_png_9patch* refPatch(const Res_png_9patch* patch) { |