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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 SkDiscardableMemory* fDiscardableMemory; | 48 SkDiscardableMemory* fDiscardableMemory; |
49 bool fDiscardableMemoryIsLocked; | 49 bool fDiscardableMemoryIsLocked; |
50 SkAutoTUnref<SkColorTable> fCTable; | 50 SkAutoTUnref<SkColorTable> fCTable; |
51 | 51 |
52 /* Takes ownership of SkImageGenerator. */ | 52 /* Takes ownership of SkImageGenerator. */ |
53 SkDiscardablePixelRef(const SkImageInfo&, SkImageGenerator*, | 53 SkDiscardablePixelRef(const SkImageInfo&, SkImageGenerator*, |
54 size_t rowBytes, | 54 size_t rowBytes, |
55 SkDiscardableMemory::Factory* factory); | 55 SkDiscardableMemory::Factory* factory); |
56 | 56 |
57 bool onGetYUV8Planes(SkISize sizes[3], | 57 bool onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace) const
override { |
58 void* planes[3], | |
59 size_t rowBytes[3], | |
60 SkYUVColorSpace* colorSpace) override { | |
61 // If the image was already decoded with lockPixels(), favor not | 58 // If the image was already decoded with lockPixels(), favor not |
62 // re-decoding to YUV8 planes. | 59 // re-decoding to YUV8 planes. |
63 if (fDiscardableMemory) { | 60 if (fDiscardableMemory) { |
64 return false; | 61 return false; |
65 } | 62 } |
66 return fGenerator->getYUV8Planes(sizes, planes, rowBytes, colorSpace); | 63 return fGenerator->queryYUV8(sizeInfo, colorSpace); |
| 64 } |
| 65 |
| 66 bool onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3]) overrid
e { |
| 67 // If the image was already decoded with lockPixels(), favor not |
| 68 // re-decoding to YUV8 planes. |
| 69 if (fDiscardableMemory) { |
| 70 return false; |
| 71 } |
| 72 return fGenerator->getYUV8Planes(sizeInfo, planes); |
67 } | 73 } |
68 | 74 |
69 friend bool SkDEPRECATED_InstallDiscardablePixelRef(SkImageGenerator*, const
SkIRect*, SkBitmap*, | 75 friend bool SkDEPRECATED_InstallDiscardablePixelRef(SkImageGenerator*, const
SkIRect*, SkBitmap*, |
70 SkDiscardableMemory::Factory*); | 76 SkDiscardableMemory::Factory*); |
71 | 77 |
72 typedef SkPixelRef INHERITED; | 78 typedef SkPixelRef INHERITED; |
73 }; | 79 }; |
74 | 80 |
75 #endif // SkDiscardablePixelRef_DEFINED | 81 #endif // SkDiscardablePixelRef_DEFINED |
OLD | NEW |