OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkImageGenerator_DEFINED | 8 #ifndef SkImageGenerator_DEFINED |
9 #define SkImageGenerator_DEFINED | 9 #define SkImageGenerator_DEFINED |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 * - its internal context is the same | 141 * - its internal context is the same |
142 * - it can somehow convert its texture into one that is valid for the prov
ided context. | 142 * - it can somehow convert its texture into one that is valid for the prov
ided context. |
143 * | 143 * |
144 * Regarding the SkImageUsageType parameter: | 144 * Regarding the SkImageUsageType parameter: |
145 * | 145 * |
146 * If the context (the provided one or the generator's intrinsic one) deter
mines that to | 146 * If the context (the provided one or the generator's intrinsic one) deter
mines that to |
147 * support the specified usage, it must return a different sized texture it
may, | 147 * support the specified usage, it must return a different sized texture it
may, |
148 * so the caller must inspect the texture's width/height and compare them t
o the generator's | 148 * so the caller must inspect the texture's width/height and compare them t
o the generator's |
149 * getInfo() width/height. | 149 * getInfo() width/height. |
150 */ | 150 */ |
151 GrTexture* generateTexture(GrContext*, SkImageUsageType); | 151 GrTexture* generateTexture(GrContext*, SkImageUsageType, const SkIRect* subs
et = nullptr); |
152 | 152 |
153 /** | 153 /** |
154 * If the default image decoder system can interpret the specified (encoded
) data, then | 154 * If the default image decoder system can interpret the specified (encoded
) data, then |
155 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way | 155 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way |
156 * the caller is still responsible for managing their ownership of the data
. | 156 * the caller is still responsible for managing their ownership of the data
. |
157 */ | 157 */ |
158 static SkImageGenerator* NewFromEncoded(SkData*); | 158 static SkImageGenerator* NewFromEncoded(SkData*); |
159 | 159 |
160 /** Return a new image generator backed by the specified picture. If the si
ze is empty or | 160 /** Return a new image generator backed by the specified picture. If the si
ze is empty or |
161 * the picture is NULL, this returns NULL. | 161 * the picture is NULL, this returns NULL. |
162 * The optional matrix and paint arguments are passed to drawPicture() at r
asterization | 162 * The optional matrix and paint arguments are passed to drawPicture() at r
asterization |
163 * time. | 163 * time. |
164 */ | 164 */ |
165 static SkImageGenerator* NewFromPicture(const SkISize&, const SkPicture*, co
nst SkMatrix*, | 165 static SkImageGenerator* NewFromPicture(const SkISize&, const SkPicture*, co
nst SkMatrix*, |
166 const SkPaint*); | 166 const SkPaint*); |
167 | 167 |
168 protected: | 168 protected: |
169 SkImageGenerator(const SkImageInfo& info); | 169 SkImageGenerator(const SkImageInfo& info); |
170 | 170 |
171 virtual SkData* onRefEncodedData(); | 171 virtual SkData* onRefEncodedData(); |
172 | 172 |
173 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy
tes, | 173 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy
tes, |
174 SkPMColor ctable[], int* ctableCount); | 174 SkPMColor ctable[], int* ctableCount); |
175 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); | 175 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); |
176 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], | 176 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], |
177 SkYUVColorSpace* colorSpace); | 177 SkYUVColorSpace* colorSpace); |
178 | 178 |
179 virtual GrTexture* onGenerateTexture(GrContext*, SkImageUsageType) { return
nullptr; } | 179 virtual GrTexture* onGenerateTexture(GrContext*, SkImageUsageType, const SkI
Rect*) { |
| 180 return nullptr; |
| 181 } |
180 | 182 |
181 private: | 183 private: |
182 const SkImageInfo fInfo; | 184 const SkImageInfo fInfo; |
183 const uint32_t fUniqueID; | 185 const uint32_t fUniqueID; |
184 | 186 |
185 // This is our default impl, which may be different on different platforms. | 187 // This is our default impl, which may be different on different platforms. |
186 // It is called from NewFromEncoded() after it has checked for any runtime f
actory. | 188 // It is called from NewFromEncoded() after it has checked for any runtime f
actory. |
187 // The SkData will never be NULL, as that will have been checked by NewFromE
ncoded. | 189 // The SkData will never be NULL, as that will have been checked by NewFromE
ncoded. |
188 static SkImageGenerator* NewFromEncodedImpl(SkData*); | 190 static SkImageGenerator* NewFromEncodedImpl(SkData*); |
189 }; | 191 }; |
190 | 192 |
191 #endif // SkImageGenerator_DEFINED | 193 #endif // SkImageGenerator_DEFINED |
OLD | NEW |