| 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 GrYUVProvider_DEFINED | 8 #ifndef GrYUVProvider_DEFINED |
| 9 #define GrYUVProvider_DEFINED | 9 #define GrYUVProvider_DEFINED |
| 10 | 10 |
| 11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
| 12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
| 13 #include "SkYUVSizeInfo.h" |
| 13 | 14 |
| 14 class GrContext; | 15 class GrContext; |
| 15 class GrTexture; | 16 class GrTexture; |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * There are at least 2 different ways to extract/retrieve YUV planar data... | 19 * There are at least 2 different ways to extract/retrieve YUV planar data... |
| 19 * - SkPixelRef | 20 * - SkPixelRef |
| 20 * - SkImageGeneartor | 21 * - SkImageGeneartor |
| 21 * | 22 * |
| 22 * To share common functionality around using the planar data, we use this abst
ract base-class | 23 * To share common functionality around using the planar data, we use this abst
ract base-class |
| (...skipping 19 matching lines...) Expand all Loading... |
| 42 kY_Index = 0, | 43 kY_Index = 0, |
| 43 kU_Index = 1, | 44 kU_Index = 1, |
| 44 kV_Index = 2, | 45 kV_Index = 2, |
| 45 | 46 |
| 46 kPlaneCount = 3 | 47 kPlaneCount = 3 |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 // These are not meant to be called by a client, only by the implementation | 50 // These are not meant to be called by a client, only by the implementation |
| 50 | 51 |
| 51 /** | 52 /** |
| 52 * Return the 3 dimensions for each plane and return true. On failure, retu
rn false and | 53 * If decoding to YUV is supported, this returns true. Otherwise, this |
| 53 * ignore the sizes parameter. Typical failure is that the provider does no
t contain YUV | 54 * returns false and does not modify any of the parameters. |
| 54 * data, and may just be an RGB src. | 55 * |
| 56 * @param sizeInfo Output parameter indicating the sizes and required |
| 57 * allocation widths of the Y, U, and V planes. |
| 58 * @param colorSpace Output parameter. |
| 55 */ | 59 */ |
| 56 virtual bool onGetYUVSizes(SkISize sizes[kPlaneCount]) = 0; | 60 virtual bool onQueryYUV8(YUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpace)
const = 0; |
| 57 | 61 |
| 58 /** | 62 /** |
| 59 * On success, return true, and set sizes, rowbytes and colorspace to the a
ppropriate values. | 63 * Returns true on success and false on failure. |
| 60 * planes[] will have already been allocated by the client (based on the wo
rst-case sizes | 64 * This always attempts to perform a full decode. If the client only |
| 61 * returned by onGetYUVSizes(). This method copies its planar data into tho
se buffers. | 65 * wants size, it should call onQueryYUV8(). |
| 62 * | 66 * |
| 63 * On failure, return false and ignore other parameters. | 67 * @param sizeInfo Needs to exactly match the values returned by the |
| 68 * query, except the WidthBytes may be larger than the |
| 69 * recommendation (but not smaller). |
| 70 * @param planes Memory for each of the Y, U, and V planes. |
| 64 */ | 71 */ |
| 65 virtual bool onGetYUVPlanes(SkISize sizes[kPlaneCount], void* planes[kPlaneC
ount], | 72 virtual bool onGetYUV8Planes(const YUVSizeInfo& sizeInfo, void* planes[kPlan
eCount]) = 0; |
| 66 size_t rowBytes[kPlaneCount], SkYUVColorSpace*)
= 0; | |
| 67 }; | 73 }; |
| 68 | 74 |
| 69 #endif | 75 #endif |
| OLD | NEW |