rename gradients private BitmapCache to GradientBitmapCache

R=caryclark@google.com
NOTREECHECKS=True

Author: reed@google.com

Review URL: https://codereview.chromium.org/474983005
This commit is contained in:
reed 2014-08-21 10:50:25 -07:00 committed by Commit bot
parent 04617139f7
commit a6cac4ce38
5 changed files with 21 additions and 21 deletions

View File

@ -58,11 +58,11 @@
'<(skia_src_path)/effects/SkTransparentShader.cpp',
'<(skia_src_path)/effects/SkXfermodeImageFilter.cpp',
'<(skia_src_path)/effects/gradients/SkBitmapCache.cpp',
'<(skia_src_path)/effects/gradients/SkBitmapCache.h',
'<(skia_src_path)/effects/gradients/SkClampRange.cpp',
'<(skia_src_path)/effects/gradients/SkClampRange.h',
'<(skia_src_path)/effects/gradients/SkRadialGradient_Table.h',
'<(skia_src_path)/effects/gradients/SkGradientBitmapCache.cpp',
'<(skia_src_path)/effects/gradients/SkGradientBitmapCache.h',
'<(skia_src_path)/effects/gradients/SkGradientShader.cpp',
'<(skia_src_path)/effects/gradients/SkGradientShaderPriv.h',
'<(skia_src_path)/effects/gradients/SkLinearGradient.cpp',

View File

@ -7,9 +7,9 @@
*/
#include "SkBitmapCache.h"
#include "SkGradientBitmapCache.h"
struct SkBitmapCache::Entry {
struct SkGradientBitmapCache::Entry {
Entry* fPrev;
Entry* fNext;
@ -33,14 +33,14 @@ struct SkBitmapCache::Entry {
}
};
SkBitmapCache::SkBitmapCache(int max) : fMaxEntries(max) {
SkGradientBitmapCache::SkGradientBitmapCache(int max) : fMaxEntries(max) {
fEntryCount = 0;
fHead = fTail = NULL;
this->validate();
}
SkBitmapCache::~SkBitmapCache() {
SkGradientBitmapCache::~SkGradientBitmapCache() {
this->validate();
Entry* entry = fHead;
@ -51,7 +51,7 @@ SkBitmapCache::~SkBitmapCache() {
}
}
SkBitmapCache::Entry* SkBitmapCache::detach(Entry* entry) const {
SkGradientBitmapCache::Entry* SkGradientBitmapCache::detach(Entry* entry) const {
if (entry->fPrev) {
SkASSERT(fHead != entry);
entry->fPrev->fNext = entry->fNext;
@ -69,7 +69,7 @@ SkBitmapCache::Entry* SkBitmapCache::detach(Entry* entry) const {
return entry;
}
void SkBitmapCache::attachToHead(Entry* entry) const {
void SkGradientBitmapCache::attachToHead(Entry* entry) const {
entry->fPrev = NULL;
entry->fNext = fHead;
if (fHead) {
@ -80,7 +80,7 @@ void SkBitmapCache::attachToHead(Entry* entry) const {
fHead = entry;
}
bool SkBitmapCache::find(const void* buffer, size_t size, SkBitmap* bm) const {
bool SkGradientBitmapCache::find(const void* buffer, size_t size, SkBitmap* bm) const {
AutoValidate av(this);
Entry* entry = fHead;
@ -99,7 +99,7 @@ bool SkBitmapCache::find(const void* buffer, size_t size, SkBitmap* bm) const {
return false;
}
void SkBitmapCache::add(const void* buffer, size_t len, const SkBitmap& bm) {
void SkGradientBitmapCache::add(const void* buffer, size_t len, const SkBitmap& bm) {
AutoValidate av(this);
if (fEntryCount == fMaxEntries) {
@ -117,7 +117,7 @@ void SkBitmapCache::add(const void* buffer, size_t len, const SkBitmap& bm) {
#ifdef SK_DEBUG
void SkBitmapCache::validate() const {
void SkGradientBitmapCache::validate() const {
SkASSERT(fEntryCount >= 0 && fEntryCount <= fMaxEntries);
if (fEntryCount > 0) {

View File

@ -7,15 +7,15 @@
*/
#ifndef SkBitmapCache_DEFINED
#define SkBitmapCache_DEFINED
#ifndef SkGradientBitmapCache_DEFINED
#define SkGradientBitmapCache_DEFINED
#include "SkBitmap.h"
class SkBitmapCache : SkNoncopyable {
class SkGradientBitmapCache : SkNoncopyable {
public:
SkBitmapCache(int maxEntries);
~SkBitmapCache();
SkGradientBitmapCache(int maxEntries);
~SkGradientBitmapCache();
bool find(const void* buffer, size_t len, SkBitmap*) const;
void add(const void* buffer, size_t len, const SkBitmap&);
@ -39,10 +39,10 @@ private:
class AutoValidate : SkNoncopyable {
public:
AutoValidate(const SkBitmapCache* bc) : fBC(bc) { bc->validate(); }
AutoValidate(const SkGradientBitmapCache* bc) : fBC(bc) { bc->validate(); }
~AutoValidate() { fBC->validate(); }
private:
const SkBitmapCache* fBC;
const SkGradientBitmapCache* fBC;
};
};

View File

@ -674,13 +674,13 @@ void SkGradientShaderBase::getGradientTableBitmap(SkBitmap* bitmap) const {
///////////////////////////////////
static SkBitmapCache* gCache;
static SkGradientBitmapCache* gCache;
// each cache cost 1K of RAM, since each bitmap will be 1x256 at 32bpp
static const int MAX_NUM_CACHED_GRADIENT_BITMAPS = 32;
SkAutoMutexAcquire ama(gGradientCacheMutex);
if (NULL == gCache) {
gCache = SkNEW_ARGS(SkBitmapCache, (MAX_NUM_CACHED_GRADIENT_BITMAPS));
gCache = SkNEW_ARGS(SkGradientBitmapCache, (MAX_NUM_CACHED_GRADIENT_BITMAPS));
}
size_t size = count * sizeof(int32_t);

View File

@ -8,6 +8,7 @@
#ifndef SkGradientShaderPriv_DEFINED
#define SkGradientShaderPriv_DEFINED
#include "SkGradientBitmapCache.h"
#include "SkGradientShader.h"
#include "SkClampRange.h"
#include "SkColorPriv.h"
@ -16,7 +17,6 @@
#include "SkMallocPixelRef.h"
#include "SkUtils.h"
#include "SkTemplates.h"
#include "SkBitmapCache.h"
#include "SkShader.h"
#include "SkOnce.h"