gfx/skia/trunk/src/effects/gradients/SkBitmapCache.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial