Remove SkBitmapCache::Find/Add(_,width,height,_)
in favor of the versions having a SkIRect as input parameter BUG=skia:2909 R=reed@google.com, junov@chromium.org Author: piotaixr@chromium.org Review URL: https://codereview.chromium.org/539643002
This commit is contained in:
parent
e5ea500d47
commit
91cab830c8
@ -100,14 +100,6 @@ void SkBitmapCache::Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invSca
|
||||
get_bounds_from_bitmap(src), result)));
|
||||
}
|
||||
|
||||
bool SkBitmapCache::Find(uint32_t genID, int width, int height, SkBitmap* result) {
|
||||
return Find(genID, SkIRect::MakeWH(width, height), result);
|
||||
}
|
||||
|
||||
bool SkBitmapCache::Add(uint32_t genID, int width, int height, const SkBitmap& result) {
|
||||
return Add(genID, SkIRect::MakeWH(width, height), result);
|
||||
}
|
||||
|
||||
bool SkBitmapCache::Find(uint32_t genID, const SkIRect& subset, SkBitmap* result) {
|
||||
BitmapKey key(genID, SK_Scalar1, SK_Scalar1, subset);
|
||||
return find_and_return(key, result);
|
||||
|
@ -33,19 +33,6 @@ public:
|
||||
static void Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY,
|
||||
const SkBitmap& result);
|
||||
|
||||
/**
|
||||
* Search based on the bitmap's genID, width, height. If found, returns true and
|
||||
* result will be set to the matching bitmap with its pixels already locked.
|
||||
*/
|
||||
static bool Find(uint32_t genID, int width, int height, SkBitmap* result);
|
||||
|
||||
/**
|
||||
* The width and the height provided for the key must be the same as the result bitmap ones.
|
||||
*
|
||||
* result must be marked isImmutable()
|
||||
*/
|
||||
static bool Add(uint32_t genID, int width, int height, const SkBitmap& result);
|
||||
|
||||
/**
|
||||
* Search based on the bitmap's genID and subset. If found, returns true and
|
||||
* result will be set to the matching bitmap with its pixels already locked.
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "SkCachingPixelRef.h"
|
||||
#include "SkBitmapCache.h"
|
||||
#include "SkRect.h"
|
||||
|
||||
bool SkCachingPixelRef::Install(SkImageGenerator* generator,
|
||||
SkBitmap* dst) {
|
||||
@ -44,7 +45,9 @@ bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) {
|
||||
}
|
||||
|
||||
const SkImageInfo& info = this->info();
|
||||
if (!SkBitmapCache::Find(this->getGenerationID(), info.width(), info.height(), &fLockedBitmap)) {
|
||||
if (!SkBitmapCache::Find(this->getGenerationID(),
|
||||
SkIRect::MakeWH(info.width(), info.height()),
|
||||
&fLockedBitmap)) {
|
||||
// Cache has been purged, must re-decode.
|
||||
if (!fLockedBitmap.tryAllocPixels(info, fRowBytes)) {
|
||||
fErrorInDecoding = true;
|
||||
@ -55,7 +58,9 @@ bool SkCachingPixelRef::onNewLockPixels(LockRec* rec) {
|
||||
return false;
|
||||
}
|
||||
fLockedBitmap.setImmutable();
|
||||
SkBitmapCache::Add(this->getGenerationID(), info.width(), info.height(), fLockedBitmap);
|
||||
SkBitmapCache::Add(this->getGenerationID(),
|
||||
SkIRect::MakeWH(info.width(), info.height()),
|
||||
fLockedBitmap);
|
||||
}
|
||||
|
||||
// Now bitmap should contain a concrete PixelRef of the decoded image.
|
||||
|
Loading…
Reference in New Issue
Block a user