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

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

Issue 834633006: add ImageGenerator::NewFromData to porting layer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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
(...skipping 15 matching lines...) Expand all
26 * If this fails or when the SkDiscardablePixelRef that is 26 * If this fails or when the SkDiscardablePixelRef that is
27 * installed into destination is destroyed, it will call 27 * installed into destination is destroyed, it will call
28 * SkDELETE() on the generator. Therefore, generator should be 28 * SkDELETE() on the generator. Therefore, generator should be
29 * allocated with SkNEW() or SkNEW_ARGS(). 29 * allocated with SkNEW() or SkNEW_ARGS().
30 * 30 *
31 * @param destination Upon success, this bitmap will be 31 * @param destination Upon success, this bitmap will be
32 * configured and have a pixelref installed. 32 * configured and have a pixelref installed.
33 * 33 *
34 * @return true iff successful. 34 * @return true iff successful.
35 */ 35 */
36 SK_API bool SkInstallDiscardablePixelRef(SkImageGenerator*, SkBitmap* destinatio n); 36 SK_API bool SkInstallDiscardablePixelRef(SkImageGenerator*, SkBitmap* destinatio n);
hal.canary 2015/01/06 20:06:40 Since we have a porting layer now, let's add conve
hal.canary 2015/01/06 20:14:48 Also, class SkImage { static SkImage* NewFro
reed1 2015/01/07 16:09:23 Acknowledged.
37 37
38 38
39 /** 39 /**
40 * An interface that allows a purgeable PixelRef (such as a 40 * An interface that allows a purgeable PixelRef (such as a
41 * SkDiscardablePixelRef) to decode and re-decode an image as needed. 41 * SkDiscardablePixelRef) to decode and re-decode an image as needed.
42 */ 42 */
43 class SK_API SkImageGenerator { 43 class SK_API SkImageGenerator {
44 public: 44 public:
45 /** 45 /**
46 * The PixelRef which takes ownership of this SkImageGenerator 46 * The PixelRef which takes ownership of this SkImageGenerator
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 * rowBytes are both fully defined and non NULL/non 0 or they are both NULL or have NULL or 0 109 * rowBytes are both fully defined and non NULL/non 0 or they are both NULL or have NULL or 0
110 * entries only. Having only partial planes/rowBytes information is not sup ported. 110 * entries only. Having only partial planes/rowBytes information is not sup ported.
111 * 111 *
112 * If all planes and rowBytes entries are non NULL or non 0, then it should copy the 112 * If all planes and rowBytes entries are non NULL or non 0, then it should copy the
113 * associated YUV data into those planes of memory supplied by the caller. It should validate 113 * associated YUV data into those planes of memory supplied by the caller. It should validate
114 * that the sizes match what it expected. If the sizes do not match, it sho uld return false. 114 * that the sizes match what it expected. If the sizes do not match, it sho uld return false.
115 */ 115 */
116 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], 116 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
117 SkYUVColorSpace* colorSpace); 117 SkYUVColorSpace* colorSpace);
118 118
119 /**
120 * If the default image decoder system can interpret the specified (encoded ) data, then
121 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E ither way
122 * the caller is still responsible for managing their ownership of the data .
123 */
124 static SkImageGenerator* NewFromData(SkData*);
125
119 protected: 126 protected:
120 virtual SkData* onRefEncodedData(); 127 virtual SkData* onRefEncodedData();
121 virtual bool onGetInfo(SkImageInfo* info); 128 virtual bool onGetInfo(SkImageInfo* info);
122 virtual bool onGetPixels(const SkImageInfo& info, 129 virtual bool onGetPixels(const SkImageInfo& info,
123 void* pixels, size_t rowBytes, 130 void* pixels, size_t rowBytes,
124 SkPMColor ctable[], int* ctableCount); 131 SkPMColor ctable[], int* ctableCount);
125 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3]); 132 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3]);
126 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3], 133 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3],
127 SkYUVColorSpace* colorSpace); 134 SkYUVColorSpace* colorSpace);
128 }; 135 };
129 136
130 #endif // SkImageGenerator_DEFINED 137 #endif // SkImageGenerator_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698