| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkDiscardablePixelRef_DEFINED | 8 #ifndef SkDiscardablePixelRef_DEFINED |
| 9 #define SkDiscardablePixelRef_DEFINED | 9 #define SkDiscardablePixelRef_DEFINED |
| 10 | 10 |
| 11 #include "SkDiscardableMemory.h" | 11 #include "SkDiscardableMemory.h" |
| 12 #include "SkImageGenerator.h" | 12 #include "SkImageGenerator.h" |
| 13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
| 14 #include "SkPixelRef.h" | 14 #include "SkPixelRef.h" |
| 15 | 15 |
| 16 /** |
| 17 * A PixelRef backed by SkDiscardableMemory, with the ability to |
| 18 * re-generate the pixels (via a SkImageGenerator) if the DM is |
| 19 * purged. |
| 20 * |
| 21 * Since SkColorTable is reference-counted, we do not support indexed |
| 22 * color with this class; there would be no way for the discardable |
| 23 * memory system to unref the color table. |
| 24 */ |
| 16 class SkDiscardablePixelRef : public SkPixelRef { | 25 class SkDiscardablePixelRef : public SkPixelRef { |
| 17 public: | 26 public: |
| 18 SK_DECLARE_UNFLATTENABLE_OBJECT() | 27 SK_DECLARE_UNFLATTENABLE_OBJECT() |
| 19 | 28 |
| 20 protected: | 29 protected: |
| 21 ~SkDiscardablePixelRef(); | 30 ~SkDiscardablePixelRef(); |
| 22 | 31 |
| 23 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; | 32 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; |
| 24 virtual void onUnlockPixels() SK_OVERRIDE; | 33 virtual void onUnlockPixels() SK_OVERRIDE; |
| 25 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } | 34 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 44 SkDiscardableMemory::Factory* factory); | 53 SkDiscardableMemory::Factory* factory); |
| 45 | 54 |
| 46 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, | 55 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, |
| 47 SkBitmap*, | 56 SkBitmap*, |
| 48 SkDiscardableMemory::Factory*); | 57 SkDiscardableMemory::Factory*); |
| 49 | 58 |
| 50 typedef SkPixelRef INHERITED; | 59 typedef SkPixelRef INHERITED; |
| 51 }; | 60 }; |
| 52 | 61 |
| 53 #endif // SkDiscardablePixelRef_DEFINED | 62 #endif // SkDiscardablePixelRef_DEFINED |
| OLD | NEW |