3 * Copyright 2010 Google Inc.
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
10 #ifndef SkBitmapCache_DEFINED
11 #define SkBitmapCache_DEFINED
15 class SkBitmapCache : SkNoncopyable {
17 SkBitmapCache(int maxEntries);
20 bool find(const void* buffer, size_t len, SkBitmap*) const;
21 void add(const void* buffer, size_t len, const SkBitmap&);
25 const int fMaxEntries;
31 inline Entry* detach(Entry*) const;
32 inline void attachToHead(Entry*) const;
35 void validate() const;
37 void validate() const {}
40 class AutoValidate : SkNoncopyable {
42 AutoValidate(const SkBitmapCache* bc) : fBC(bc) { bc->validate(); }
43 ~AutoValidate() { fBC->validate(); }
45 const SkBitmapCache* fBC;