| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 SkYUVPlanesCache_DEFINED | 8 #ifndef SkYUVPlanesCache_DEFINED |
| 9 #define SkYUVPlanesCache_DEFINED | 9 #define SkYUVPlanesCache_DEFINED |
| 10 | 10 |
| 11 #include "SkCachedData.h" | 11 #include "SkCachedData.h" |
| 12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
| 13 #include "SkYUVSizeInfo.h" |
| 13 | 14 |
| 14 class SkResourceCache; | 15 class SkResourceCache; |
| 15 | 16 |
| 16 class SkYUVPlanesCache { | 17 class SkYUVPlanesCache { |
| 17 public: | 18 public: |
| 18 /** | 19 /** |
| 19 * The Info struct contains data about the 3 Y, U and V planes of memory sto
red | 20 * The Info struct contains data about the 3 Y, U and V planes of memory sto
red |
| 20 * contiguously, in that order, as a single block of memory within SkYUVPlan
esCache. | 21 * contiguously, in that order, as a single block of memory within SkYUVPlan
esCache. |
| 21 * | 22 * |
| 22 * fSize: Width and height of each of the 3 planes (in pixels). | 23 * fSizeInfo: fWidth, fHeight, and fWidthBytes of each of the Y, U, and V pl
anes. |
| 23 * fSizeInMemory: Amount of memory allocated for each plane (may be differen
t from | |
| 24 "height * rowBytes", depending on the jpeg decoder's block
size). | |
| 25 * The sum of these is the total size stored within SkYUVPlan
esCache. | |
| 26 * fRowBytes: rowBytes for each of the 3 planes (in bytes). | |
| 27 * fColorSpace: color space that will be used for the YUV -> RGB conversion. | 24 * fColorSpace: color space that will be used for the YUV -> RGB conversion. |
| 28 */ | 25 */ |
| 29 struct Info { | 26 struct Info { |
| 30 SkISize fSize[3]; | 27 SkYUVSizeInfo fSizeInfo; |
| 31 size_t fSizeInMemory[3]; | |
| 32 size_t fRowBytes[3]; | |
| 33 SkYUVColorSpace fColorSpace; | 28 SkYUVColorSpace fColorSpace; |
| 34 }; | 29 }; |
| 35 /** | 30 /** |
| 36 * On success, return a ref to the SkCachedData that holds the pixels. | 31 * On success, return a ref to the SkCachedData that holds the pixels. |
| 37 * | 32 * |
| 38 * On failure, return nullptr. | 33 * On failure, return nullptr. |
| 39 */ | 34 */ |
| 40 static SkCachedData* FindAndRef(uint32_t genID, Info* info, | 35 static SkCachedData* FindAndRef(uint32_t genID, Info* info, |
| 41 SkResourceCache* localCache = nullptr); | 36 SkResourceCache* localCache = nullptr); |
| 42 | 37 |
| 43 /** | 38 /** |
| 44 * Add a pixelRef ID and its YUV planes data to the cache. | 39 * Add a pixelRef ID and its YUV planes data to the cache. |
| 45 */ | 40 */ |
| 46 static void Add(uint32_t genID, SkCachedData* data, Info* info, | 41 static void Add(uint32_t genID, SkCachedData* data, Info* info, |
| 47 SkResourceCache* localCache = nullptr); | 42 SkResourceCache* localCache = nullptr); |
| 48 }; | 43 }; |
| 49 | 44 |
| 50 #endif | 45 #endif |
| OLD | NEW |