Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: include/core/SkImageGenerator.h

Issue 1240093004: SkPictureImageGenerator (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: added GM Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "SkColor.h" 11 #include "SkColor.h"
12 #include "SkImageInfo.h" 12 #include "SkImageInfo.h"
13 13
14 class SkBitmap; 14 class SkBitmap;
15 class SkData; 15 class SkData;
16 class SkImageGenerator; 16 class SkImageGenerator;
17 class SkMatrix;
18 class SkPaint;
19 class SkPicture;
17 20
18 //#define SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS 21 //#define SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
19 22
20 /** 23 /**
21 * Takes ownership of SkImageGenerator. If this method fails for 24 * Takes ownership of SkImageGenerator. If this method fails for
22 * whatever reason, it will return false and immediatetely delete 25 * whatever reason, it will return false and immediatetely delete
23 * the generator. If it succeeds, it will modify destination 26 * the generator. If it succeeds, it will modify destination
24 * bitmap. 27 * bitmap.
25 * 28 *
26 * If generator is NULL, will safely return false. 29 * If generator is NULL, will safely return false.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], 197 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
195 SkYUVColorSpace* colorSpace); 198 SkYUVColorSpace* colorSpace);
196 199
197 /** 200 /**
198 * If the default image decoder system can interpret the specified (encoded ) data, then 201 * If the default image decoder system can interpret the specified (encoded ) data, then
199 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E ither way 202 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E ither way
200 * the caller is still responsible for managing their ownership of the data . 203 * the caller is still responsible for managing their ownership of the data .
201 */ 204 */
202 static SkImageGenerator* NewFromEncoded(SkData*); 205 static SkImageGenerator* NewFromEncoded(SkData*);
203 206
207 /** Return a new image generator backed by the specified picture. If the si ze is empty or
208 * the picture is NULL, this returns NULL.
209 * The optional matrix and paint arguments are passed to drawPicture() at r asterization
210 * time.
211 */
212 static SkImageGenerator* NewFromPicture(const SkISize&, const SkPicture*, co nst SkMatrix*,
213 const SkPaint*);
214
204 protected: 215 protected:
205 SkImageGenerator(const SkImageInfo& info) : fInfo(info) {} 216 SkImageGenerator(const SkImageInfo& info) : fInfo(info) {}
206 217
207 virtual SkData* onRefEncodedData(); 218 virtual SkData* onRefEncodedData();
208 219
209 #ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS 220 #ifdef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS
210 virtual Result onGetPixels(const SkImageInfo& info, 221 virtual Result onGetPixels(const SkImageInfo& info,
211 void* pixels, size_t rowBytes, const Options&, 222 void* pixels, size_t rowBytes, const Options&,
212 SkPMColor ctable[], int* ctableCount); 223 SkPMColor ctable[], int* ctableCount);
213 #else 224 #else
214 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy tes, 225 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy tes,
215 SkPMColor ctable[], int* ctableCount); 226 SkPMColor ctable[], int* ctableCount);
216 #endif 227 #endif
217 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3]); 228 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3]);
218 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3], 229 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3],
219 SkYUVColorSpace* colorSpace); 230 SkYUVColorSpace* colorSpace);
220 231
221 private: 232 private:
222 const SkImageInfo fInfo; 233 const SkImageInfo fInfo;
223 234
224 // This is our default impl, which may be different on different platforms. 235 // This is our default impl, which may be different on different platforms.
225 // It is called from NewFromEncoded() after it has checked for any runtime f actory. 236 // It is called from NewFromEncoded() after it has checked for any runtime f actory.
226 // The SkData will never be NULL, as that will have been checked by NewFromE ncoded. 237 // The SkData will never be NULL, as that will have been checked by NewFromE ncoded.
227 static SkImageGenerator* NewFromEncodedImpl(SkData*); 238 static SkImageGenerator* NewFromEncodedImpl(SkData*);
228 }; 239 };
229 240
230 #endif // SkImageGenerator_DEFINED 241 #endif // SkImageGenerator_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698