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

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

mercurial