blob: 0dcd32272e6f70a8a7015975b924a671f187de55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
* Copyright 2010 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkGradientBitmapCache_DEFINED
#define SkGradientBitmapCache_DEFINED
#include "SkBitmap.h"
class SkGradientBitmapCache : SkNoncopyable {
public:
SkGradientBitmapCache(int maxEntries);
~SkGradientBitmapCache();
bool find(const void* buffer, size_t len, SkBitmap*) const;
void add(const void* buffer, size_t len, const SkBitmap&);
private:
int fEntryCount;
const int fMaxEntries;
struct Entry;
mutable Entry* fHead;
mutable Entry* fTail;
inline Entry* release(Entry*) const;
inline void attachToHead(Entry*) const;
#ifdef SK_DEBUG
void validate() const;
#else
void validate() const {}
#endif
class AutoValidate : SkNoncopyable {
public:
AutoValidate(const SkGradientBitmapCache* bc) : fBC(bc) { bc->validate(); }
~AutoValidate() { fBC->validate(); }
private:
const SkGradientBitmapCache* fBC;
};
};
#endif
|