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

Unified Diff: src/ports/SkImageGeneratorCG.h

Issue 1718273004: Add an SkImageGeneratorCG (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 80 chars Created 4 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
« no previous file with comments | « gyp/ports.gyp ('k') | src/ports/SkImageGeneratorCG.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkImageGeneratorCG.h
diff --git a/src/ports/SkImageGeneratorCG.h b/src/ports/SkImageGeneratorCG.h
new file mode 100644
index 0000000000000000000000000000000000000000..cdfeae02b60f6cf263812a9d0379cef289ec28e5
--- /dev/null
+++ b/src/ports/SkImageGeneratorCG.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
+
+#include "SkCGUtils.h"
+#include "SkData.h"
+#include "SkImageGenerator.h"
+#include "SkTemplates.h"
+
+class SkImageGeneratorCG : public SkImageGenerator {
+public:
+ /*
+ * Refs the data if an image generator can be returned. Otherwise does
+ * not affect the data.
+ */
+ static SkImageGenerator* NewFromEncodedCG(SkData* data);
+
+protected:
+ SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) override;
+
+ bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctable[],
+ int* ctableCount) override;
+
+private:
+ /*
+ * Takes ownership of the imageSrc
+ * Refs the data
+ */
+ SkImageGeneratorCG(const SkImageInfo& info, const void* imageSrc, SkData* data);
+
+ SkAutoTCallVProc<const void, CFRelease> fImageSrc;
+ SkAutoTUnref<SkData> fData;
+
+ typedef SkImageGenerator INHERITED;
+};
+
+#endif //defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
« no previous file with comments | « gyp/ports.gyp ('k') | src/ports/SkImageGeneratorCG.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698