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

Unified Diff: include/core/SkImageGenerator.h

Issue 1017293002: guarded change to SkImageGenerator to make getInfo() const (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: include/core/SkImageGenerator.h
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index a5440bd3b4d88011bb70dee991a28c2c1c61771c..5684a93ebb80afb09b6b9584fb99ec1e7628d779 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -65,15 +65,19 @@ public:
SkData* refEncodedData() { return this->onRefEncodedData(); }
/**
- * Return some information about the image, allowing the owner of
- * this object to allocate pixels.
- *
- * Repeated calls to this function should give the same results,
scroggo 2015/03/19 13:27:47 Do you still want this comment (minus the part abo
reed1 2015/03/19 15:20:45 Don't think so, as it is now baked in during the c
- * allowing the PixelRef to be immutable.
- *
- * @return false if anything goes wrong.
+ * Return the ImageInfo associated with this generator.
*/
- bool getInfo(SkImageInfo* info);
+#ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO
+ SkImageInfo getInfo();
+ bool getInfo(SkImageInfo* info) {
+ if (info) {
+ *info = this->getInfo();
+ }
+ return true;
+ }
+#else
+ SkImageInfo getInfo() const { return fInfo; }
scroggo 2015/03/19 13:27:47 Why not return a const ref?
reed1 2015/03/19 15:20:45 Done.
+#endif
/**
* Used to describe the result of a call to getPixels().
@@ -206,8 +210,14 @@ public:
static SkImageGenerator* NewFromData(SkData*);
protected:
- virtual SkData* onRefEncodedData();
+#ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO
+ SkImageGenerator() : fInfo(SkImageInfo::MakeUnknown(0, 0) ) {}
virtual bool onGetInfo(SkImageInfo* info);
+#endif
+ SkImageGenerator(const SkImageInfo& info) : fInfo(info) {}
+
+ virtual SkData* onRefEncodedData();
+
#ifdef SK_SUPPORT_LEGACY_OPTIONLESS_GET_PIXELS
virtual Result onGetPixels(const SkImageInfo& info,
void* pixels, size_t rowBytes,
@@ -219,6 +229,9 @@ protected:
virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]);
virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
SkYUVColorSpace* colorSpace);
+
+private:
+ SkImageInfo fInfo;
scroggo 2015/03/19 13:27:47 Can we not already make this const?
};
#endif // SkImageGenerator_DEFINED

Powered by Google App Engine
This is Rietveld 408576698