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

Unified Diff: src/lazy/SkDiscardablePixelRef.h

Issue 74793011: Add SkImageGenerator Interface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: SkDiscardablePixelRef 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 | « src/images/SkDecodingImageGenerator.cpp ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy/SkDiscardablePixelRef.h
diff --git a/src/lazy/SkDiscardablePixelRef.h b/src/lazy/SkDiscardablePixelRef.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b598eed154337b16f8cce17b53f87f691bc7d80
--- /dev/null
+++ b/src/lazy/SkDiscardablePixelRef.h
@@ -0,0 +1,55 @@
+/*
+ * 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 SkDiscardablePixelRef_DEFINED
+#define SkDiscardablePixelRef_DEFINED
+
+#include "SkPixelRef.h"
+#include "SkImageGenerator.h"
+#include "SkImageInfo.h"
+
+class SkDiscardableMemory;
+
+/**
+ * An interface that allows a purgable PixelRef to re-decode an image.
+ */
+
+class SkDiscardablePixelRef : public SkPixelRef {
+public:
+ /**
+ * Takes ownership of SkImageGenerator.
+ * Will modify SkBitmap
+ */
+ static bool Install(SkImageGenerator* generator, SkBitmap* destination);
+
+ ~SkDiscardablePixelRef();
reed1 2013/11/19 15:51:54 this can be protected (or private I think)
hal.canary 2013/11/19 21:38:19 Done.
+
+ SK_DECLARE_UNFLATTENABLE_OBJECT()
+
+protected:
+ virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE;
+ virtual void onUnlockPixels() SK_OVERRIDE;
+ virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; }
+
+ virtual SkData* onRefEncodedData() SK_OVERRIDE {
+ return fGenerator->refEncodedData();
+ }
+
+private:
+ SkImageGenerator* fGenerator;
+ SkDiscardableMemory* fDiscardableMemory;
+ SkImageInfo fInfo;
+ size_t fSize; // size of memeory to be allocated
+ size_t fRowBytes; // ???
+
+ /* Takes ownership of SkImageGenerator. */
+ SkDiscardablePixelRef(SkImageGenerator* generator,
+ const SkImageInfo& info,
+ size_t size,
+ size_t rowBytes);
+};
+#endif // SkDiscardablePixelRef_DEFINED
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698