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

Unified Diff: include/utils/mac/SkCGUtils.h

Issue 243463005: expose CGImage -> SkBitmap (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | « no previous file | src/ports/SkImageDecoder_CG.cpp » ('j') | src/ports/SkImageDecoder_CG.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/utils/mac/SkCGUtils.h
diff --git a/include/utils/mac/SkCGUtils.h b/include/utils/mac/SkCGUtils.h
index 54c858c1ae4d24aa4f217677ff268977a4ffbe2e..55d0458489b7c1ec52cede031593e2cfe156c169 100644
--- a/include/utils/mac/SkCGUtils.h
+++ b/include/utils/mac/SkCGUtils.h
@@ -8,7 +8,8 @@
#ifndef SkCGUtils_DEFINED
#define SkCGUtils_DEFINED
-#include "SkTypes.h"
+#include "SkSize.h"
+#include "SkImageInfo.h"
#ifdef SK_BUILD_FOR_MAC
#include <ApplicationServices/ApplicationServices.h>
@@ -23,6 +24,25 @@ class SkData;
class SkStream;
/**
+ * Given a CGImage, allocate a SkBitmap and copy the images's pixels into it. If scaleToFit is not
scroggo 2014/04/21 20:18:44 nit: an SkBitmap nit: image's
reed1 2014/04/21 20:44:41 Done.
+ * null, use it to determine the size of the bitmap, and scale the image to fill the bitmap.
+ * Otherwise use the image's width/height.
+ *
+ * On failure, return false, and leave bitmap unchanged.
+ */
+SK_API bool SkCreateBitmapFromCGImage(SkBitmap* dst, CGImageRef src, SkISize* scaleToFit = NULL);
scroggo 2014/04/21 20:18:44 This version is unused. Does Chrome want it?
reed1 2014/04/21 20:44:41 Yes, this is explicit added for chrome!
+
+/**
+ * Given a CGImage, allocate a SkBitmap and copy the images's pixels into it. If scaleToFit is not
hal.canary 2014/04/21 20:15:51 that's now what this does.
scroggo 2014/04/21 20:18:44 This comment describes the other function, not thi
reed1 2014/04/21 20:44:41 You caught me copy-pasting. Done.
+ * null, use it to determine the size of the bitmap, and scale the image to fill the bitmap.
+ * Otherwise use the image's width/height.
+ *
+ * On failure, return false, and leave bitmap unchanged.
+ */
+SK_API bool SkCopyPixelsFromCGImage(const SkImageInfo& info, size_t rowBytes, void* pixels,
+ CGImageRef src);
+
+/**
* Create an imageref from the specified bitmap using the specified colorspace.
* If space is NULL, then CGColorSpaceCreateDeviceRGB() is used.
*/
« no previous file with comments | « no previous file | src/ports/SkImageDecoder_CG.cpp » ('j') | src/ports/SkImageDecoder_CG.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698