OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 SkImage_DEFINED | 8 #ifndef SkImage_DEFINED |
9 #define SkImage_DEFINED | 9 #define SkImage_DEFINED |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 /** | 58 /** |
59 * Construct a new SkImage based on the specified encoded data. Returns NUL
L on failure, | 59 * Construct a new SkImage based on the specified encoded data. Returns NUL
L on failure, |
60 * which can mean that the format of the encoded data was not recognized/su
pported. | 60 * which can mean that the format of the encoded data was not recognized/su
pported. |
61 * | 61 * |
62 * Regardless of success or failure, the caller is responsible for managing
their ownership | 62 * Regardless of success or failure, the caller is responsible for managing
their ownership |
63 * of the data. | 63 * of the data. |
64 */ | 64 */ |
65 static SkImage* NewFromData(SkData* data); | 65 static SkImage* NewFromData(SkData* data); |
66 | 66 |
| 67 /** |
| 68 * Create a new image from the specified descriptor. Note - the caller is r
esponsible for |
| 69 * managing the lifetime of the underlying platform texture. |
| 70 * |
| 71 * Will return NULL if the specified descriptor is unsupported. |
| 72 */ |
| 73 static SkImage* NewFromTexture(GrContext*, const GrBackendTextureDesc&, |
| 74 SkAlphaType = kPremul_SkAlphaType); |
| 75 |
| 76 /** |
| 77 * Create a new image by copying the pixels from the specified descriptor.
No reference is |
| 78 * kept to the original platform texture. |
| 79 * |
| 80 * Will return NULL if the specified descriptor is unsupported. |
| 81 */ |
| 82 static SkImage* NewFromTextureCopy(GrContext*, const GrBackendTextureDesc&, |
| 83 SkAlphaType = kPremul_SkAlphaType); |
| 84 |
67 int width() const { return fWidth; } | 85 int width() const { return fWidth; } |
68 int height() const { return fHeight; } | 86 int height() const { return fHeight; } |
69 uint32_t uniqueID() const { return fUniqueID; } | 87 uint32_t uniqueID() const { return fUniqueID; } |
70 virtual bool isOpaque() const { return false; } | 88 virtual bool isOpaque() const { return false; } |
71 | 89 |
72 /** | 90 /** |
73 * Return the GrTexture that stores the image pixels. Calling getTexture | 91 * Return the GrTexture that stores the image pixels. Calling getTexture |
74 * does not affect the reference count of the GrTexture object. | 92 * does not affect the reference count of the GrTexture object. |
75 * Will return NULL if the image does not use a texture. | 93 * Will return NULL if the image does not use a texture. |
76 */ | 94 */ |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 const int fWidth; | 186 const int fWidth; |
169 const int fHeight; | 187 const int fHeight; |
170 const uint32_t fUniqueID; | 188 const uint32_t fUniqueID; |
171 | 189 |
172 static uint32_t NextUniqueID(); | 190 static uint32_t NextUniqueID(); |
173 | 191 |
174 typedef SkRefCnt INHERITED; | 192 typedef SkRefCnt INHERITED; |
175 }; | 193 }; |
176 | 194 |
177 #endif | 195 #endif |
OLD | NEW |