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 "SkImageGeneratorPriv.h" |
13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
14 #include "SkPixelRef.h" | 14 #include "SkPixelRef.h" |
15 | 15 |
16 /** | 16 /** |
17 * A PixelRef backed by SkDiscardableMemory, with the ability to | 17 * A PixelRef backed by SkDiscardableMemory, with the ability to |
18 * re-generate the pixels (via a SkImageGenerator) if the DM is | 18 * re-generate the pixels (via a SkImageGenerator) if the DM is |
19 * purged. | 19 * purged. |
20 */ | 20 */ |
21 class SkDiscardablePixelRef : public SkPixelRef { | 21 class SkDiscardablePixelRef : public SkPixelRef { |
22 public: | 22 public: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 size_t rowBytes[3], | 54 size_t rowBytes[3], |
55 SkYUVColorSpace* colorSpace) override { | 55 SkYUVColorSpace* colorSpace) override { |
56 // If the image was already decoded with lockPixels(), favor not | 56 // If the image was already decoded with lockPixels(), favor not |
57 // re-decoding to YUV8 planes. | 57 // re-decoding to YUV8 planes. |
58 if (fDiscardableMemory) { | 58 if (fDiscardableMemory) { |
59 return false; | 59 return false; |
60 } | 60 } |
61 return fGenerator->getYUV8Planes(sizes, planes, rowBytes, colorSpace); | 61 return fGenerator->getYUV8Planes(sizes, planes, rowBytes, colorSpace); |
62 } | 62 } |
63 | 63 |
64 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, SkBitmap*, | 64 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, const SkIRect*,
SkBitmap*, |
65 SkDiscardableMemory::Factory*); | 65 SkDiscardableMemory::Factory*); |
66 | 66 |
67 typedef SkPixelRef INHERITED; | 67 typedef SkPixelRef INHERITED; |
68 }; | 68 }; |
69 | 69 |
70 #endif // SkDiscardablePixelRef_DEFINED | 70 #endif // SkDiscardablePixelRef_DEFINED |
OLD | NEW |