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

Unified Diff: src/images/SkDecodingImageGenerator.h

Issue 74793011: Add SkImageGenerator Interface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: whitespace Created 7 years, 1 month 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
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkDecodingImageGenerator.h
diff --git a/src/images/SkDecodingImageGenerator.h b/src/images/SkDecodingImageGenerator.h
new file mode 100644
index 0000000000000000000000000000000000000000..682aeb619cee14c6d3593e6cde664a93ea79592b
--- /dev/null
+++ b/src/images/SkDecodingImageGenerator.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkDecodingImageGenerator_DEFINED
+#define SkDecodingImageGenerator_DEFINED
+
+#include "SkImageGenerator.h"
+
+class SkBitmap;
+
+/**
+ * Calls into SkImageDecoder::DecodeMemoryToTarget to implement a
+ * SkImageGenerator
+ */
+class SkDecodingImageGenerator : public SkImageGenerator {
+public:
+ /*
+ * The constructor will take a reference to the SkData. The
+ * destructor will unref() it.
+ */
+ SkDecodingImageGenerator(SkData* data);
+ virtual ~SkDecodingImageGenerator();
+
+ virtual SkData* refEncodedData() SK_OVERRIDE;
+
+ virtual bool getInfo(SkImageInfo* info) SK_OVERRIDE;
+
+ virtual bool getPixels(const SkImageInfo& info,
+ void* pixels,
+ size_t rowBytes) SK_OVERRIDE;
+
+ /**
+ * Install the SkData into the destination bitmap, using a new
+ * SkDiscardablePixelRef and a new SkDecodingImageGenerator.
+ */
+ static bool Install(SkData* data, SkBitmap* destination);
+
+private:
+ SkData* fData;
+};
+#endif // SkDecodingImageGenerator_DEFINED
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698