epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2008 The Android Open Source Project |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 4 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 10 | #ifndef SkPixelRef_DEFINED |
| 11 | #define SkPixelRef_DEFINED |
| 12 | |
senorblanco@chromium.org | ef843cd | 2011-12-02 19:11:17 +0000 | [diff] [blame] | 13 | #include "SkBitmap.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 14 | #include "SkRefCnt.h" |
| 15 | #include "SkString.h" |
djsollen@google.com | 5370cd9 | 2012-03-28 20:47:01 +0000 | [diff] [blame] | 16 | #include "SkFlattenable.h" |
commit-bot@chromium.org | 50a3043 | 2013-10-24 17:44:27 +0000 | [diff] [blame] | 17 | #include "SkTDArray.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 18 | |
reed@google.com | f171570 | 2013-12-06 22:07:17 +0000 | [diff] [blame^] | 19 | #define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR |
| 20 | |
reed@google.com | 2a3f08b | 2012-12-13 21:41:00 +0000 | [diff] [blame] | 21 | #ifdef SK_DEBUG |
| 22 | /** |
| 23 | * Defining SK_IGNORE_PIXELREF_SETPRELOCKED will force all pixelref |
| 24 | * subclasses to correctly handle lock/unlock pixels. For performance |
| 25 | * reasons, simple malloc-based subclasses call setPreLocked() to skip |
| 26 | * the overhead of implementing these calls. |
| 27 | * |
| 28 | * This build-flag disables that optimization, to add in debugging our |
| 29 | * call-sites, to ensure that they correctly balance their calls of |
| 30 | * lock and unlock. |
| 31 | */ |
| 32 | // #define SK_IGNORE_PIXELREF_SETPRELOCKED |
| 33 | #endif |
| 34 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 35 | class SkColorTable; |
reed@google.com | eb77612 | 2012-12-06 14:26:02 +0000 | [diff] [blame] | 36 | class SkData; |
reed@google.com | 50dfa01 | 2011-04-01 19:05:36 +0000 | [diff] [blame] | 37 | struct SkIRect; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 38 | class SkMutex; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 39 | |
commit-bot@chromium.org | b8d00db | 2013-06-26 19:18:23 +0000 | [diff] [blame] | 40 | class GrTexture; |
reed@android.com | ce4e53a | 2010-09-09 16:01:26 +0000 | [diff] [blame] | 41 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 42 | /** \class SkPixelRef |
| 43 | |
| 44 | This class is the smart container for pixel memory, and is used with |
| 45 | SkBitmap. A pixelref is installed into a bitmap, and then the bitmap can |
| 46 | access the actual pixel memory by calling lockPixels/unlockPixels. |
| 47 | |
| 48 | This class can be shared/accessed between multiple threads. |
| 49 | */ |
djsollen@google.com | 5370cd9 | 2012-03-28 20:47:01 +0000 | [diff] [blame] | 50 | class SK_API SkPixelRef : public SkFlattenable { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 51 | public: |
robertphillips@google.com | 0456e0b | 2012-06-27 14:03:26 +0000 | [diff] [blame] | 52 | SK_DECLARE_INST_COUNT(SkPixelRef) |
| 53 | |
reed@google.com | f171570 | 2013-12-06 22:07:17 +0000 | [diff] [blame^] | 54 | #ifdef SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR |
| 55 | // DEPRECATED -- use a constructor that takes SkImageInfo |
reed@google.com | 2ebc10d | 2013-12-06 21:43:05 +0000 | [diff] [blame] | 56 | explicit SkPixelRef(SkBaseMutex* mutex = NULL); |
reed@google.com | f171570 | 2013-12-06 22:07:17 +0000 | [diff] [blame^] | 57 | #endif |
| 58 | |
| 59 | explicit SkPixelRef(const SkImageInfo&); |
| 60 | explicit SkPixelRef(const SkImageInfo&, SkBaseMutex* mutex); |
commit-bot@chromium.org | 50a3043 | 2013-10-24 17:44:27 +0000 | [diff] [blame] | 61 | virtual ~SkPixelRef(); |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 62 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 63 | /** Return the pixel memory returned from lockPixels, or null if the |
| 64 | lockCount is 0. |
| 65 | */ |
reed@google.com | 2ebc10d | 2013-12-06 21:43:05 +0000 | [diff] [blame] | 66 | void* pixels() const { return fPixels; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 67 | |
| 68 | /** Return the current colorTable (if any) if pixels are locked, or null. |
| 69 | */ |
reed@google.com | 2ebc10d | 2013-12-06 21:43:05 +0000 | [diff] [blame] | 70 | SkColorTable* colorTable() const { return fColorTable; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 71 | |
reed@google.com | ff0da4f | 2012-05-17 13:14:52 +0000 | [diff] [blame] | 72 | /** |
| 73 | * Returns true if the lockcount > 0 |
| 74 | */ |
| 75 | bool isLocked() const { return fLockCount > 0; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 76 | |
reed@google.com | ea03360 | 2012-12-14 13:13:55 +0000 | [diff] [blame] | 77 | SkDEBUGCODE(int getLockCount() const { return fLockCount; }) |
| 78 | |
reed@google.com | 2ebc10d | 2013-12-06 21:43:05 +0000 | [diff] [blame] | 79 | /** Call to access the pixel memory, which is returned. Balance with a call |
| 80 | to unlockPixels(). |
| 81 | */ |
| 82 | void lockPixels(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 83 | /** Call to balanace a previous call to lockPixels(). Returns the pixels |
| 84 | (or null) after the unlock. NOTE: lock calls can be nested, but the |
| 85 | matching number of unlock calls must be made in order to free the |
| 86 | memory (if the subclass implements caching/deferred-decoding.) |
| 87 | */ |
| 88 | void unlockPixels(); |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 89 | |
reed@google.com | 9c49bc3 | 2011-07-07 13:42:37 +0000 | [diff] [blame] | 90 | /** |
| 91 | * Some bitmaps can return a copy of their pixels for lockPixels(), but |
| 92 | * that copy, if modified, will not be pushed back. These bitmaps should |
| 93 | * not be used as targets for a raster device/canvas (since all pixels |
| 94 | * modifications will be lost when unlockPixels() is called.) |
| 95 | */ |
| 96 | bool lockPixelsAreWritable() const; |
| 97 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 98 | /** Returns a non-zero, unique value corresponding to the pixels in this |
| 99 | pixelref. Each time the pixels are changed (and notifyPixelsChanged is |
| 100 | called), a different generation ID will be returned. |
| 101 | */ |
| 102 | uint32_t getGenerationID() const; |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 103 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 104 | /** Call this if you have changed the contents of the pixels. This will in- |
| 105 | turn cause a different generation ID value to be returned from |
| 106 | getGenerationID(). |
| 107 | */ |
| 108 | void notifyPixelsChanged(); |
| 109 | |
| 110 | /** Returns true if this pixelref is marked as immutable, meaning that the |
| 111 | contents of its pixels will not change for the lifetime of the pixelref. |
| 112 | */ |
| 113 | bool isImmutable() const { return fIsImmutable; } |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 114 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 115 | /** Marks this pixelref is immutable, meaning that the contents of its |
| 116 | pixels will not change for the lifetime of the pixelref. This state can |
| 117 | be set on a pixelref, but it cannot be cleared once it is set. |
| 118 | */ |
| 119 | void setImmutable(); |
| 120 | |
| 121 | /** Return the optional URI string associated with this pixelref. May be |
| 122 | null. |
| 123 | */ |
| 124 | const char* getURI() const { return fURI.size() ? fURI.c_str() : NULL; } |
| 125 | |
| 126 | /** Copy a URI string to this pixelref, or clear the URI if the uri is null |
| 127 | */ |
| 128 | void setURI(const char uri[]) { |
| 129 | fURI.set(uri); |
| 130 | } |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 131 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 132 | /** Copy a URI string to this pixelref |
| 133 | */ |
| 134 | void setURI(const char uri[], size_t len) { |
| 135 | fURI.set(uri, len); |
| 136 | } |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 137 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 138 | /** Assign a URI string to this pixelref. |
| 139 | */ |
| 140 | void setURI(const SkString& uri) { fURI = uri; } |
| 141 | |
reed@google.com | eb77612 | 2012-12-06 14:26:02 +0000 | [diff] [blame] | 142 | /** |
| 143 | * If the pixelRef has an encoded (i.e. compressed) representation, |
| 144 | * return a ref to its data. If the pixelRef |
| 145 | * is uncompressed or otherwise does not have this form, return NULL. |
| 146 | * |
| 147 | * If non-null is returned, the caller is responsible for calling unref() |
| 148 | * on the data when it is finished. |
| 149 | */ |
| 150 | SkData* refEncodedData() { |
| 151 | return this->onRefEncodedData(); |
| 152 | } |
| 153 | |
reed@google.com | cee9dcb | 2013-09-13 16:04:49 +0000 | [diff] [blame] | 154 | /** |
| 155 | * Experimental -- tells the caller if it is worth it to call decodeInto(). |
| 156 | * Just an optimization at this point, to avoid checking the cache first. |
| 157 | * We may remove/change this call in the future. |
| 158 | */ |
| 159 | bool implementsDecodeInto() { |
| 160 | return this->onImplementsDecodeInto(); |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Return a decoded instance of this pixelRef in bitmap. If this cannot be |
| 165 | * done, return false and the bitmap parameter is ignored/unchanged. |
| 166 | * |
| 167 | * pow2 is the requeste power-of-two downscale that the caller needs. This |
| 168 | * can be ignored, and the "original" size can be returned, but if the |
| 169 | * underlying codec can efficiently return a smaller size, that should be |
| 170 | * done. Some examples: |
| 171 | * |
| 172 | * To request the "base" version (original scale), pass 0 for pow2 |
| 173 | * To request 1/2 scale version (1/2 width, 1/2 height), pass 1 for pow2 |
| 174 | * To request 1/4 scale version (1/4 width, 1/4 height), pass 2 for pow2 |
| 175 | * ... |
| 176 | * |
| 177 | * If this returns true, then bitmap must be "locked" such that |
| 178 | * bitmap->getPixels() will return the correct address. |
| 179 | */ |
| 180 | bool decodeInto(int pow2, SkBitmap* bitmap) { |
| 181 | SkASSERT(pow2 >= 0); |
| 182 | return this->onDecodeInto(pow2, bitmap); |
| 183 | } |
| 184 | |
reed@android.com | ce4e53a | 2010-09-09 16:01:26 +0000 | [diff] [blame] | 185 | /** Are we really wrapping a texture instead of a bitmap? |
| 186 | */ |
commit-bot@chromium.org | b8d00db | 2013-06-26 19:18:23 +0000 | [diff] [blame] | 187 | virtual GrTexture* getTexture() { return NULL; } |
reed@android.com | ce4e53a | 2010-09-09 16:01:26 +0000 | [diff] [blame] | 188 | |
reed@google.com | 50dfa01 | 2011-04-01 19:05:36 +0000 | [diff] [blame] | 189 | bool readPixels(SkBitmap* dst, const SkIRect* subset = NULL); |
| 190 | |
scroggo@google.com | a2a3192 | 2012-12-07 19:14:45 +0000 | [diff] [blame] | 191 | /** |
| 192 | * Makes a deep copy of this PixelRef, respecting the requested config. |
| 193 | * @param config Desired config. |
| 194 | * @param subset Subset of this PixelRef to copy. Must be fully contained within the bounds of |
| 195 | * of this PixelRef. |
| 196 | * @return A new SkPixelRef, or NULL if either there is an error (e.g. the destination could |
| 197 | * not be created with the given config), or this PixelRef does not support deep |
| 198 | * copies. |
| 199 | */ |
| 200 | virtual SkPixelRef* deepCopy(SkBitmap::Config config, const SkIRect* subset = NULL) { |
| 201 | return NULL; |
| 202 | } |
senorblanco@chromium.org | ef843cd | 2011-12-02 19:11:17 +0000 | [diff] [blame] | 203 | |
djsollen@google.com | 56c6977 | 2011-11-08 19:00:26 +0000 | [diff] [blame] | 204 | #ifdef SK_BUILD_FOR_ANDROID |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 205 | /** |
| 206 | * Acquire a "global" ref on this object. |
| 207 | * The default implementation just calls ref(), but subclasses can override |
| 208 | * this method to implement additional behavior. |
| 209 | */ |
djsollen@google.com | 57f4969 | 2011-02-23 20:46:31 +0000 | [diff] [blame] | 210 | virtual void globalRef(void* data=NULL); |
| 211 | |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 212 | /** |
| 213 | * Release a "global" ref on this object. |
| 214 | * The default implementation just calls unref(), but subclasses can override |
| 215 | * this method to implement additional behavior. |
| 216 | */ |
djsollen@google.com | 57f4969 | 2011-02-23 20:46:31 +0000 | [diff] [blame] | 217 | virtual void globalUnref(); |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 218 | #endif |
djsollen@google.com | 57f4969 | 2011-02-23 20:46:31 +0000 | [diff] [blame] | 219 | |
commit-bot@chromium.org | c0b7e10 | 2013-10-23 17:06:21 +0000 | [diff] [blame] | 220 | SK_DEFINE_FLATTENABLE_TYPE(SkPixelRef) |
| 221 | |
commit-bot@chromium.org | 50a3043 | 2013-10-24 17:44:27 +0000 | [diff] [blame] | 222 | // Register a listener that may be called the next time our generation ID changes. |
| 223 | // |
| 224 | // We'll only call the listener if we're confident that we are the only SkPixelRef with this |
| 225 | // generation ID. If our generation ID changes and we decide not to call the listener, we'll |
| 226 | // never call it: you must add a new listener for each generation ID change. We also won't call |
| 227 | // the listener when we're certain no one knows what our generation ID is. |
| 228 | // |
| 229 | // This can be used to invalidate caches keyed by SkPixelRef generation ID. |
| 230 | struct GenIDChangeListener { |
| 231 | virtual ~GenIDChangeListener() {} |
| 232 | virtual void onChange() = 0; |
| 233 | }; |
| 234 | |
| 235 | // Takes ownership of listener. |
| 236 | void addGenIDChangeListener(GenIDChangeListener* listener); |
| 237 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 238 | protected: |
reed@google.com | 2ebc10d | 2013-12-06 21:43:05 +0000 | [diff] [blame] | 239 | /** Called when the lockCount goes from 0 to 1. The caller will have already |
| 240 | acquire a mutex for thread safety, so this method need not do that. |
| 241 | */ |
| 242 | virtual void* onLockPixels(SkColorTable**) = 0; |
| 243 | /** Called when the lock count goes from 1 to 0. The caller will have |
| 244 | already acquire a mutex for thread safety, so this method need not do |
| 245 | that. |
| 246 | */ |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 247 | virtual void onUnlockPixels() = 0; |
| 248 | |
reed@google.com | 9c49bc3 | 2011-07-07 13:42:37 +0000 | [diff] [blame] | 249 | /** Default impl returns true */ |
| 250 | virtual bool onLockPixelsAreWritable() const; |
| 251 | |
reed@google.com | cee9dcb | 2013-09-13 16:04:49 +0000 | [diff] [blame] | 252 | // returns false; |
| 253 | virtual bool onImplementsDecodeInto(); |
| 254 | // returns false; |
| 255 | virtual bool onDecodeInto(int pow2, SkBitmap* bitmap); |
| 256 | |
reed@google.com | 50dfa01 | 2011-04-01 19:05:36 +0000 | [diff] [blame] | 257 | /** |
| 258 | * For pixelrefs that don't have access to their raw pixels, they may be |
| 259 | * able to make a copy of them (e.g. if the pixels are on the GPU). |
| 260 | * |
| 261 | * The base class implementation returns false; |
| 262 | */ |
| 263 | virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subsetOrNull); |
| 264 | |
reed@google.com | eb77612 | 2012-12-06 14:26:02 +0000 | [diff] [blame] | 265 | // default impl returns NULL. |
| 266 | virtual SkData* onRefEncodedData(); |
| 267 | |
commit-bot@chromium.org | cd3b15c | 2013-12-04 17:06:49 +0000 | [diff] [blame] | 268 | /** |
| 269 | * Returns the size (in bytes) of the internally allocated memory. |
| 270 | * This should be implemented in all serializable SkPixelRef derived classes. |
| 271 | * SkBitmap::fPixelRefOffset + SkBitmap::getSafeSize() should never overflow this value, |
| 272 | * otherwise the rendering code may attempt to read memory out of bounds. |
| 273 | * |
| 274 | * @return default impl returns 0. |
| 275 | */ |
| 276 | virtual size_t getAllocatedSizeInBytes() const; |
| 277 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 278 | /** Return the mutex associated with this pixelref. This value is assigned |
| 279 | in the constructor, and cannot change during the lifetime of the object. |
| 280 | */ |
digit@google.com | 1771cbf | 2012-01-26 21:26:40 +0000 | [diff] [blame] | 281 | SkBaseMutex* mutex() const { return fMutex; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 282 | |
djsollen@google.com | 5492424 | 2012-03-29 15:18:04 +0000 | [diff] [blame] | 283 | // serialization |
digit@google.com | 1771cbf | 2012-01-26 21:26:40 +0000 | [diff] [blame] | 284 | SkPixelRef(SkFlattenableReadBuffer&, SkBaseMutex*); |
djsollen@google.com | 5492424 | 2012-03-29 15:18:04 +0000 | [diff] [blame] | 285 | virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 286 | |
reed@google.com | ff0da4f | 2012-05-17 13:14:52 +0000 | [diff] [blame] | 287 | // only call from constructor. Flags this to always be locked, removing |
| 288 | // the need to grab the mutex and call onLockPixels/onUnlockPixels. |
| 289 | // Performance tweak to avoid those calls (esp. in multi-thread use case). |
reed@google.com | 2ebc10d | 2013-12-06 21:43:05 +0000 | [diff] [blame] | 290 | void setPreLocked(void* pixels, SkColorTable* ctable); |
reed@google.com | ff0da4f | 2012-05-17 13:14:52 +0000 | [diff] [blame] | 291 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 292 | private: |
digit@google.com | 1771cbf | 2012-01-26 21:26:40 +0000 | [diff] [blame] | 293 | SkBaseMutex* fMutex; // must remain in scope for the life of this object |
reed@google.com | 2ebc10d | 2013-12-06 21:43:05 +0000 | [diff] [blame] | 294 | void* fPixels; |
| 295 | SkColorTable* fColorTable; // we do not track ownership, subclass does |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 296 | int fLockCount; |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 297 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 298 | mutable uint32_t fGenerationID; |
commit-bot@chromium.org | 50a3043 | 2013-10-24 17:44:27 +0000 | [diff] [blame] | 299 | mutable bool fUniqueGenerationID; |
reed@google.com | 93c5f9e | 2011-02-24 18:09:46 +0000 | [diff] [blame] | 300 | |
commit-bot@chromium.org | 50a3043 | 2013-10-24 17:44:27 +0000 | [diff] [blame] | 301 | SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owned |
scroggo@google.com | d5764e8 | 2012-08-22 15:00:05 +0000 | [diff] [blame] | 302 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 303 | SkString fURI; |
| 304 | |
| 305 | // can go from false to true, but never from true to false |
| 306 | bool fIsImmutable; |
reed@google.com | ff0da4f | 2012-05-17 13:14:52 +0000 | [diff] [blame] | 307 | // only ever set in constructor, const after that |
| 308 | bool fPreLocked; |
| 309 | |
commit-bot@chromium.org | 50a3043 | 2013-10-24 17:44:27 +0000 | [diff] [blame] | 310 | void needsNewGenID(); |
| 311 | void callGenIDChangeListeners(); |
| 312 | |
reed@google.com | ff0da4f | 2012-05-17 13:14:52 +0000 | [diff] [blame] | 313 | void setMutex(SkBaseMutex* mutex); |
caryclark@google.com | 9d0c6ec | 2011-12-20 20:26:56 +0000 | [diff] [blame] | 314 | |
commit-bot@chromium.org | 50a3043 | 2013-10-24 17:44:27 +0000 | [diff] [blame] | 315 | // When copying a bitmap to another with the same shape and config, we can safely |
| 316 | // clone the pixelref generation ID too, which makes them equivalent under caching. |
| 317 | friend class SkBitmap; // only for cloneGenID |
| 318 | void cloneGenID(const SkPixelRef&); |
| 319 | |
djsollen@google.com | 5370cd9 | 2012-03-28 20:47:01 +0000 | [diff] [blame] | 320 | typedef SkFlattenable INHERITED; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 321 | }; |
| 322 | |
| 323 | #endif |