summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-04-15 15:52:10 -0700
committerJohn Reck <jreck@google.com>2015-04-15 15:56:12 -0700
commit4bd981ec533a65e8dee053a0a709b484770b0a76 (patch)
treec9563c173961c03ed25fceec3aace0373212c31c /libs
parent87ffb63d90fb6dd2689fe72dcb24fda9a6156220 (diff)
downloadframeworks_base-4bd981ec533a65e8dee053a0a709b484770b0a76.zip
frameworks_base-4bd981ec533a65e8dee053a0a709b484770b0a76.tar.gz
frameworks_base-4bd981ec533a65e8dee053a0a709b484770b0a76.tar.bz2
Remove Bitmap#getSkBitmap
Change-Id: Ifb9047b426122d3e5a445eb7a0eb3fce38dedf27
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/DisplayListRenderer.cpp14
-rw-r--r--libs/hwui/DisplayListRenderer.h4
-rw-r--r--libs/hwui/ResourceCache.cpp6
-rw-r--r--libs/hwui/ResourceCache.h10
4 files changed, 17 insertions, 17 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 8757e15..4d596fe 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -220,7 +220,7 @@ void DisplayListRenderer::drawLayer(DeferredLayerUpdater* layerHandle, float x,
}
void DisplayListRenderer::drawBitmap(const SkBitmap* bitmap, const SkPaint* paint) {
- bitmap = refBitmap(bitmap);
+ bitmap = refBitmap(*bitmap);
paint = refPaint(paint);
addDrawOp(new (alloc()) DrawBitmapOp(bitmap, paint));
@@ -286,7 +286,7 @@ void DisplayListRenderer::drawBitmap(const SkBitmap& bitmap, float srcLeft, floa
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();
@@ -294,7 +294,7 @@ void DisplayListRenderer::drawBitmap(const SkBitmap& bitmap, float srcLeft, floa
}
}
- addDrawOp(new (alloc()) DrawBitmapRectOp(refBitmap(&bitmap),
+ addDrawOp(new (alloc()) DrawBitmapRectOp(refBitmap(bitmap),
srcLeft, srcTop, srcRight, srcBottom,
dstLeft, dstTop, dstRight, dstBottom, paint));
}
@@ -307,17 +307,17 @@ void DisplayListRenderer::drawBitmapMesh(const SkBitmap& bitmap, int meshWidth,
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 DisplayListRenderer::drawPatch(const SkBitmap* bitmap, const Res_png_9patch* patch,
+void DisplayListRenderer::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 DisplayListRenderer::drawColor(int color, SkXfermode::Mode mode) {
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index ff698f5..44cf546 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -100,7 +100,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
@@ -347,7 +347,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);