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

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

Issue 1495693003: Index8 GPU and CPU raster support. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: generate index8, n32 replaced by onGetColorType Created 5 years 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 * of this data. 67 * of this data.
68 * 68 *
69 * If non-NULL is returned, the caller is responsible for calling 69 * If non-NULL is returned, the caller is responsible for calling
70 * unref() on the data when it is finished. 70 * unref() on the data when it is finished.
71 */ 71 */
72 SkData* refEncodedData() { return this->onRefEncodedData(); } 72 SkData* refEncodedData() { return this->onRefEncodedData(); }
73 73
74 /** 74 /**
75 * Return the ImageInfo associated with this generator. 75 * Return the ImageInfo associated with this generator.
76 */ 76 */
77 const SkImageInfo& getInfo() const { return fInfo; } 77 const SkImageInfo& getInfo() {
78 SkColorType colorType;
79 if ((colorType = onGetColorType()) != fInfo.colorType())
80 fInfo = fInfo.makeColorType(colorType);
81 return fInfo;
82 }
78 83
79 /** 84 /**
80 * Decode into the given pixels, a block of memory of size at 85 * Decode into the given pixels, a block of memory of size at
81 * least (info.fHeight - 1) * rowBytes + (info.fWidth * 86 * least (info.fHeight - 1) * rowBytes + (info.fWidth *
82 * bytesPerPixel) 87 * bytesPerPixel)
83 * 88 *
84 * Repeated calls to this function should give the same results, 89 * Repeated calls to this function should give the same results,
85 * allowing the PixelRef to be immutable. 90 * allowing the PixelRef to be immutable.
86 * 91 *
87 * @param info A description of the format (config, size) 92 * @param info A description of the format (config, size)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy tes, 197 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy tes,
193 SkPMColor ctable[], int* ctableCount); 198 SkPMColor ctable[], int* ctableCount);
194 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3]); 199 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3]);
195 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3], 200 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy tes[3],
196 SkYUVColorSpace* colorSpace); 201 SkYUVColorSpace* colorSpace);
197 202
198 virtual GrTexture* onGenerateTexture(GrContext*, const SkIRect*) { 203 virtual GrTexture* onGenerateTexture(GrContext*, const SkIRect*) {
199 return nullptr; 204 return nullptr;
200 } 205 }
201 206
207 virtual SkColorType onGetColorType() { return fInfo.colorType(); }
aleksandar.stojiljkovic 2015/12/07 19:31:02 Does this look better? Implemented the chromium pa
208
202 bool tryGenerateBitmap(SkBitmap* bm, const SkImageInfo* optionalInfo, SkBitm ap::Allocator*); 209 bool tryGenerateBitmap(SkBitmap* bm, const SkImageInfo* optionalInfo, SkBitm ap::Allocator*);
203 210
204 private: 211 private:
205 const SkImageInfo fInfo; 212 SkImageInfo fInfo;
206 const uint32_t fUniqueID; 213 const uint32_t fUniqueID;
207 214
208 // This is our default impl, which may be different on different platforms. 215 // This is our default impl, which may be different on different platforms.
209 // It is called from NewFromEncoded() after it has checked for any runtime f actory. 216 // It is called from NewFromEncoded() after it has checked for any runtime f actory.
210 // The SkData will never be NULL, as that will have been checked by NewFromE ncoded. 217 // The SkData will never be NULL, as that will have been checked by NewFromE ncoded.
211 static SkImageGenerator* NewFromEncodedImpl(SkData*); 218 static SkImageGenerator* NewFromEncodedImpl(SkData*);
212 }; 219 };
213 220
214 #endif // SkImageGenerator_DEFINED 221 #endif // SkImageGenerator_DEFINED
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | src/core/SkBitmapDevice.cpp » ('j') | src/core/SkImageCacherator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698