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 |
(...skipping 17 matching lines...) Expand all Loading... |
28 virtual ~GrYUVProvider() {} | 28 virtual ~GrYUVProvider() {} |
29 | 29 |
30 /** | 30 /** |
31 * On success, this returns a texture that has converted the YUV data from
the provider | 31 * On success, this returns a texture that has converted the YUV data from
the provider |
32 * into a form that is supported by the GPU (typically transformed into RGB
). If useCache | 32 * into a form that is supported by the GPU (typically transformed into RGB
). If useCache |
33 * is true, then the texture will automatically have a key added, so it can
be retrieved | 33 * is true, then the texture will automatically have a key added, so it can
be retrieved |
34 * from the cache (assuming it is requested by a provider w/ the same genID
). | 34 * from the cache (assuming it is requested by a provider w/ the same genID
). |
35 * | 35 * |
36 * On failure (e.g. the provider had no data), this returns NULL. | 36 * On failure (e.g. the provider had no data), this returns NULL. |
37 */ | 37 */ |
38 GrTexture* refAsTexture(GrContext*, const GrSurfaceDesc&, bool useCache); | 38 sk_sp<GrTexture> refAsTexture(GrContext*, const GrSurfaceDesc&, bool useCach
e); |
39 | 39 |
40 virtual uint32_t onGetID() = 0; | 40 virtual uint32_t onGetID() = 0; |
41 | 41 |
42 // These are not meant to be called by a client, only by the implementation | 42 // These are not meant to be called by a client, only by the implementation |
43 | 43 |
44 /** | 44 /** |
45 * If decoding to YUV is supported, this returns true. Otherwise, this | 45 * If decoding to YUV is supported, this returns true. Otherwise, this |
46 * returns false and does not modify any of the parameters. | 46 * returns false and does not modify any of the parameters. |
47 * | 47 * |
48 * @param sizeInfo Output parameter indicating the sizes and required | 48 * @param sizeInfo Output parameter indicating the sizes and required |
49 * allocation widths of the Y, U, and V planes. | 49 * allocation widths of the Y, U, and V planes. |
50 * @param colorSpace Output parameter. | 50 * @param colorSpace Output parameter. |
51 */ | 51 */ |
52 virtual bool onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpac
e) const = 0; | 52 virtual bool onQueryYUV8(SkYUVSizeInfo* sizeInfo, SkYUVColorSpace* colorSpac
e) const = 0; |
53 | 53 |
54 /** | 54 /** |
55 * Returns true on success and false on failure. | 55 * Returns true on success and false on failure. |
56 * This always attempts to perform a full decode. If the client only | 56 * This always attempts to perform a full decode. If the client only |
57 * wants size, it should call onQueryYUV8(). | 57 * wants size, it should call onQueryYUV8(). |
58 * | 58 * |
59 * @param sizeInfo Needs to exactly match the values returned by the | 59 * @param sizeInfo Needs to exactly match the values returned by the |
60 * query, except the WidthBytes may be larger than the | 60 * query, except the WidthBytes may be larger than the |
61 * recommendation (but not smaller). | 61 * recommendation (but not smaller). |
62 * @param planes Memory for each of the Y, U, and V planes. | 62 * @param planes Memory for each of the Y, U, and V planes. |
63 */ | 63 */ |
64 virtual bool onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3])
= 0; | 64 virtual bool onGetYUV8Planes(const SkYUVSizeInfo& sizeInfo, void* planes[3])
= 0; |
65 }; | 65 }; |
66 | 66 |
67 #endif | 67 #endif |
OLD | NEW |