OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2015 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef GrYUVProvider_DEFINED | |
9 #define GrYUVProvider_DEFINED | |
10 | |
11 #include "GrTypes.h" | |
12 #include "SkImageInfo.h" | |
13 | |
14 class GrContext; | |
15 class GrTexture; | |
16 | |
17 /** | |
18 * There are at least 2 different ways to extract/retrieve YUV planar data... | |
19 * - SkPixelRef | |
20 * - SkImageGeneartor | |
21 * | |
robertphillips
2015/09/08 15:04:47
typo (abstarct)
reed1
2015/09/08 15:22:52
Done.
| |
22 * To share common functionality around using the planar data, we use this abst arct base-class | |
23 * to represent accessing that data. | |
24 */ | |
25 class GrYUVProvider { | |
26 public: | |
27 virtual ~GrYUVProvider() {} | |
28 | |
29 /** | |
30 * On success, this returns a texture that has converted the YUV data from the provider | |
31 * into a form that is supported by the GPU (typically transformed into RGB ). If useCache | |
32 * is true, then the texture will automatically have a key added, so it can be retrived | |
robertphillips
2015/09/08 15:04:47
typo (retrived)
reed1
2015/09/08 15:22:52
Done.
| |
33 * from the cache (assuming it is requested by a provider w/ the same genID ). | |
34 * | |
35 * On failure (e.g. the provider had no data), this returns NULL. | |
36 */ | |
37 GrTexture* refAsTexture(GrContext*, const GrSurfaceDesc&, bool useCache); | |
38 | |
39 virtual uint32_t onGetID() = 0; | |
40 | |
41 enum { | |
42 kY_Index = 0, | |
43 kU_Index = 1, | |
44 kV_Index = 2, | |
45 | |
46 kPlaneCount = 3 | |
47 }; | |
48 | |
49 // These are not meant to be called by a client, only by the implementation | |
50 | |
51 /** | |
52 * Return the 3 dimensions for each plane and return true. On failure, retu rn false and | |
53 * ignore the sizes parameter. Typical failure is that the provider does no t contain YUV | |
54 * data, and may just be an RGB src. | |
55 */ | |
56 virtual bool onGetYUVSizes(SkISize sizes[kPlaneCount]) = 0; | |
57 | |
58 /** | |
59 * On success, return true, and set sizes, rowbytes and colorspace to the a ppropriate values. | |
60 * planes[] will have already been allocated by the client (based on the wo rst-case sizes | |
61 * returned by onGetYUVSizes(). This method copies its planar data into tho se buffers. | |
62 * | |
63 * On failure, return false and ignore other parameters. | |
64 */ | |
65 virtual bool onGetYUVPlanes(SkISize sizes[kPlaneCount], void* planes[kPlaneC ount], | |
66 size_t rowBytes[kPlaneCount], SkYUVColorSpace*) = 0; | |
67 }; | |
68 | |
69 #endif | |
OLD | NEW |