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

Unified Diff: src/images/SkDecodingImageGenerator.cpp

Issue 304443003: add colortable support to imagegenerator (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add guard for chrome Created 6 years, 7 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: src/images/SkDecodingImageGenerator.cpp
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp
index b3924a7daa4d2b342cb6ea29f333ce93aa4b7390..763d0d81a36b7b0ce38f91e0812a70741ae46eb3 100644
--- a/src/images/SkDecodingImageGenerator.cpp
+++ b/src/images/SkDecodingImageGenerator.cpp
@@ -23,12 +23,6 @@ bool equal_modulo_alpha(const SkImageInfo& a, const SkImageInfo& b) {
class DecodingImageGenerator : public SkImageGenerator {
public:
virtual ~DecodingImageGenerator();
- virtual SkData* refEncodedData() SK_OVERRIDE;
- // This implementaion of getInfo() always returns true.
- virtual bool getInfo(SkImageInfo* info) SK_OVERRIDE;
- virtual bool getPixels(const SkImageInfo& info,
- void* pixels,
- size_t rowBytes) SK_OVERRIDE;
SkData* fData;
SkStreamRewindable* fStream;
@@ -41,6 +35,16 @@ public:
const SkImageInfo& info,
int sampleSize,
bool ditherImage);
+
+protected:
+ virtual SkData* onRefEncodedData() SK_OVERRIDE;
+ // This implementaion of getInfo() always returns true.
scroggo 2014/05/27 18:31:23 nits: implementation* onGetInfo()*
reed1 2014/05/27 18:47:34 Done.
+ virtual bool onGetInfo(SkImageInfo* info) SK_OVERRIDE;
+ virtual bool onGetPixels(const SkImageInfo& info,
+ void* pixels, size_t rowBytes,
+ SkPMColor ctable[], int* ctableCount) SK_OVERRIDE;
+
+private:
typedef SkImageGenerator INHERITED;
};
@@ -123,14 +127,12 @@ DecodingImageGenerator::~DecodingImageGenerator() {
fStream->unref();
}
-bool DecodingImageGenerator::getInfo(SkImageInfo* info) {
- if (info != NULL) {
- *info = fInfo;
- }
+bool DecodingImageGenerator::onGetInfo(SkImageInfo* info) {
+ *info = fInfo;
return true;
}
-SkData* DecodingImageGenerator::refEncodedData() {
+SkData* DecodingImageGenerator::onRefEncodedData() {
// This functionality is used in `gm --serialize`
// Does not encode options.
if (fData != NULL) {
@@ -151,22 +153,15 @@ SkData* DecodingImageGenerator::refEncodedData() {
return SkSafeRef(fData);
}
-bool DecodingImageGenerator::getPixels(const SkImageInfo& info,
- void* pixels,
- size_t rowBytes) {
- if (NULL == pixels) {
- return false;
- }
+bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info,
+ void* pixels, size_t rowBytes,
+ SkPMColor ctable[], int* ctableCount) {
if (fInfo != info) {
// The caller has specified a different info. This is an
// error for this kind of SkImageGenerator. Use the Options
// to change the settings.
return false;
}
- if (info.minRowBytes() > rowBytes) {
- // The caller has specified a bad rowBytes.
- return false;
- }
SkAssertResult(fStream->rewind());
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(fStream));

Powered by Google App Engine
This is Rietveld 408576698