diff options
author | John Reck <jreck@google.com> | 2015-04-15 15:52:10 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2015-05-01 14:38:44 -0700 |
commit | 7c103a36f60b690e3fe83c40210e1cb0c76bba43 (patch) | |
tree | 1928ebdea926aa00a9f4eb876bff708169fcad8e /libs/hwui | |
parent | c6e2e8ff474ae44bab5b9eb665851118abd27b68 (diff) | |
download | frameworks_base-7c103a36f60b690e3fe83c40210e1cb0c76bba43.zip frameworks_base-7c103a36f60b690e3fe83c40210e1cb0c76bba43.tar.gz frameworks_base-7c103a36f60b690e3fe83c40210e1cb0c76bba43.tar.bz2 |
Remove Bitmap#getSkBitmap
Change-Id: Ifb9047b426122d3e5a445eb7a0eb3fce38dedf27
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/DisplayListCanvas.cpp | 14 | ||||
-rw-r--r-- | libs/hwui/DisplayListCanvas.h | 4 | ||||
-rw-r--r-- | libs/hwui/ResourceCache.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/ResourceCache.h | 10 |
4 files changed, 17 insertions, 17 deletions
diff --git a/libs/hwui/DisplayListCanvas.cpp b/libs/hwui/DisplayListCanvas.cpp index a7784b6..cbb6fd5 100644 --- a/libs/hwui/DisplayListCanvas.cpp +++ b/libs/hwui/DisplayListCanvas.cpp @@ -218,7 +218,7 @@ void DisplayListCanvas::drawLayer(DeferredLayerUpdater* layerHandle, float x, fl } void DisplayListCanvas::drawBitmap(const SkBitmap* bitmap, const SkPaint* paint) { - bitmap = refBitmap(bitmap); + bitmap = refBitmap(*bitmap); paint = refPaint(paint); addDrawOp(new (alloc()) DrawBitmapOp(bitmap, paint)); @@ -284,7 +284,7 @@ void DisplayListCanvas::drawBitmap(const SkBitmap& bitmap, float srcLeft, float dstRight = srcRight - srcLeft; dstBottom = srcBottom - srcTop; - addDrawOp(new (alloc()) DrawBitmapRectOp(refBitmap(&bitmap), + addDrawOp(new (alloc()) DrawBitmapRectOp(refBitmap(bitmap), srcLeft, srcTop, srcRight, srcBottom, dstLeft, dstTop, dstRight, dstBottom, paint)); restore(); @@ -292,7 +292,7 @@ void DisplayListCanvas::drawBitmap(const SkBitmap& bitmap, float srcLeft, float } } - addDrawOp(new (alloc()) DrawBitmapRectOp(refBitmap(&bitmap), + addDrawOp(new (alloc()) DrawBitmapRectOp(refBitmap(bitmap), srcLeft, srcTop, srcRight, srcBottom, dstLeft, dstTop, dstRight, dstBottom, paint)); } @@ -305,17 +305,17 @@ void DisplayListCanvas::drawBitmapMesh(const SkBitmap& bitmap, int meshWidth, in paint = refPaint(paint); colors = refBuffer<int>(colors, vertexCount); // 1 color per vertex - addDrawOp(new (alloc()) DrawBitmapMeshOp(refBitmap(&bitmap), meshWidth, meshHeight, + addDrawOp(new (alloc()) DrawBitmapMeshOp(refBitmap(bitmap), meshWidth, meshHeight, vertices, colors, paint)); } -void DisplayListCanvas::drawPatch(const SkBitmap* bitmap, const Res_png_9patch* patch, +void DisplayListCanvas::drawPatch(const SkBitmap& bitmap, const Res_png_9patch* patch, float left, float top, float right, float bottom, const SkPaint* paint) { - bitmap = refBitmap(bitmap); + const SkBitmap* bitmapPtr = refBitmap(bitmap); patch = refPatch(patch); paint = refPaint(paint); - addDrawOp(new (alloc()) DrawPatchOp(bitmap, patch, left, top, right, bottom, paint)); + addDrawOp(new (alloc()) DrawPatchOp(bitmapPtr, patch, left, top, right, bottom, paint)); } void DisplayListCanvas::drawColor(int color, SkXfermode::Mode mode) { diff --git a/libs/hwui/DisplayListCanvas.h b/libs/hwui/DisplayListCanvas.h index fa4b2b4..0064236 100644 --- a/libs/hwui/DisplayListCanvas.h +++ b/libs/hwui/DisplayListCanvas.h @@ -98,7 +98,7 @@ public: // Bitmap-based void drawBitmap(const SkBitmap* bitmap, const SkPaint* paint); // TODO: move drawPatch() to Canvas.h - void drawPatch(const SkBitmap* bitmap, const Res_png_9patch* patch, + void drawPatch(const SkBitmap& bitmap, const Res_png_9patch* patch, float left, float top, float right, float bottom, const SkPaint* paint); // Shapes @@ -345,7 +345,7 @@ private: return cachedRegion; } - inline const SkBitmap* refBitmap(const SkBitmap* bitmap) { + inline const SkBitmap* refBitmap(const SkBitmap& 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, diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp index d3b8d70..454fedc 100644 --- a/libs/hwui/ResourceCache.cpp +++ b/libs/hwui/ResourceCache.cpp @@ -59,13 +59,13 @@ void ResourceCache::unlock() { mLock.unlock(); } -const SkBitmap* ResourceCache::insert(const SkBitmap* bitmapResource) { +const SkBitmap* ResourceCache::insert(const SkBitmap& bitmapResource) { Mutex::Autolock _l(mLock); BitmapKey bitmapKey(bitmapResource); ssize_t index = mBitmapCache.indexOfKey(bitmapKey); if (index == NAME_NOT_FOUND) { - SkBitmap* cachedBitmap = new SkBitmap(*bitmapResource); + SkBitmap* cachedBitmap = new SkBitmap(bitmapResource); index = mBitmapCache.add(bitmapKey, cachedBitmap); return cachedBitmap; } @@ -121,7 +121,7 @@ void ResourceCache::decrementRefcountLocked(void* resource) { } void ResourceCache::decrementRefcountLocked(const SkBitmap* bitmapResource) { - BitmapKey bitmapKey(bitmapResource); + BitmapKey bitmapKey(*bitmapResource); ssize_t index = mBitmapCache.indexOfKey(bitmapKey); LOG_ALWAYS_FATAL_IF(index == NAME_NOT_FOUND, diff --git a/libs/hwui/ResourceCache.h b/libs/hwui/ResourceCache.h index fae55d1..6c483fa 100644 --- a/libs/hwui/ResourceCache.h +++ b/libs/hwui/ResourceCache.h @@ -53,11 +53,11 @@ public: class BitmapKey { public: - BitmapKey(const SkBitmap* bitmap) + BitmapKey(const SkBitmap& bitmap) : mRefCount(1) - , mBitmapDimensions(bitmap->dimensions()) - , mPixelRefOrigin(bitmap->pixelRefOrigin()) - , mPixelRefStableID(bitmap->pixelRef()->getStableID()) { } + , mBitmapDimensions(bitmap.dimensions()) + , mPixelRefOrigin(bitmap.pixelRefOrigin()) + , mPixelRefStableID(bitmap.pixelRef()->getStableID()) { } void operator=(const BitmapKey& other); bool operator==(const BitmapKey& other) const; @@ -101,7 +101,7 @@ public: * The cache stores a copy of the provided resource or refs an existing resource * if the bitmap has previously been inserted and returns the cached copy. */ - const SkBitmap* insert(const SkBitmap* resource); + const SkBitmap* insert(const SkBitmap& resource); void incrementRefcount(const Res_png_9patch* resource); |