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

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

Issue 2434323002: Add isEncoded to SkImageGenerator (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | src/core/SkImageGenerator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 public: 63 public:
64 /** 64 /**
65 * The PixelRef which takes ownership of this SkImageGenerator 65 * The PixelRef which takes ownership of this SkImageGenerator
66 * will call the image generator's destructor. 66 * will call the image generator's destructor.
67 */ 67 */
68 virtual ~SkImageGenerator() { } 68 virtual ~SkImageGenerator() { }
69 69
70 uint32_t uniqueID() const { return fUniqueID; } 70 uint32_t uniqueID() const { return fUniqueID; }
71 71
72 /** 72 /**
73 * Returns true if the image is encoded (i.e. compressed).
74 */
75 bool isEncoded() const { return this->onIsEncoded(); }
cblume 2016/10/20 19:08:39 Note that this is adding a function to the public
76
77 /**
73 * Return a ref to the encoded (i.e. compressed) representation, 78 * Return a ref to the encoded (i.e. compressed) representation,
74 * of this data. If the GrContext is non-null, then the caller is only inte rested in 79 * of this data. If the GrContext is non-null, then the caller is only inte rested in
75 * gpu-specific formats, so the impl may return null even if they have enco ded data, 80 * gpu-specific formats, so the impl may return null even if they have enco ded data,
76 * assuming they know it is not suitable for the gpu. 81 * assuming they know it is not suitable for the gpu.
77 * 82 *
78 * If non-NULL is returned, the caller is responsible for calling 83 * If non-NULL is returned, the caller is responsible for calling
79 * unref() on the data when it is finished. 84 * unref() on the data when it is finished.
80 */ 85 */
81 SkData* refEncodedData(GrContext* ctx = nullptr) { 86 SkData* refEncodedData(GrContext* ctx = nullptr) {
82 #ifdef SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX 87 #ifdef SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 255 }
251 } 256 }
252 257
253 protected: 258 protected:
254 enum { 259 enum {
255 kNeedNewImageUniqueID = 0 260 kNeedNewImageUniqueID = 0
256 }; 261 };
257 262
258 SkImageGenerator(const SkImageInfo& info, uint32_t uniqueId = kNeedNewImageU niqueID); 263 SkImageGenerator(const SkImageInfo& info, uint32_t uniqueId = kNeedNewImageU niqueID);
259 264
265 virtual bool onIsEncoded() const;
266
260 virtual SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM); 267 virtual SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM);
261 268
262 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy tes, 269 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy tes,
263 SkPMColor ctable[], int* ctableCount); 270 SkPMColor ctable[], int* ctableCount);
264 271
265 virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const { 272 virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const {
266 return false; 273 return false;
267 } 274 }
268 virtual bool onGetYUV8Planes(const SkYUVSizeInfo&, void*[3] /*planes*/) { 275 virtual bool onGetYUV8Planes(const SkYUVSizeInfo&, void*[3] /*planes*/) {
269 return false; 276 return false;
(...skipping 16 matching lines...) Expand all
286 const SkImageInfo fInfo; 293 const SkImageInfo fInfo;
287 const uint32_t fUniqueID; 294 const uint32_t fUniqueID;
288 295
289 // This is our default impl, which may be different on different platforms. 296 // This is our default impl, which may be different on different platforms.
290 // It is called from NewFromEncoded() after it has checked for any runtime f actory. 297 // It is called from NewFromEncoded() after it has checked for any runtime f actory.
291 // The SkData will never be NULL, as that will have been checked by NewFromE ncoded. 298 // The SkData will never be NULL, as that will have been checked by NewFromE ncoded.
292 static SkImageGenerator* NewFromEncodedImpl(SkData*); 299 static SkImageGenerator* NewFromEncodedImpl(SkData*);
293 }; 300 };
294 301
295 #endif // SkImageGenerator_DEFINED 302 #endif // SkImageGenerator_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/core/SkImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698