OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef SkCGUtils_DEFINED | 8 #ifndef SkCGUtils_DEFINED |
9 #define SkCGUtils_DEFINED | 9 #define SkCGUtils_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkSize.h" |
12 #include "SkImageInfo.h" | |
12 | 13 |
13 #ifdef SK_BUILD_FOR_MAC | 14 #ifdef SK_BUILD_FOR_MAC |
14 #include <ApplicationServices/ApplicationServices.h> | 15 #include <ApplicationServices/ApplicationServices.h> |
15 #endif | 16 #endif |
16 | 17 |
17 #ifdef SK_BUILD_FOR_IOS | 18 #ifdef SK_BUILD_FOR_IOS |
18 #include <CoreGraphics/CoreGraphics.h> | 19 #include <CoreGraphics/CoreGraphics.h> |
19 #endif | 20 #endif |
20 | 21 |
21 class SkBitmap; | 22 class SkBitmap; |
22 class SkData; | 23 class SkData; |
23 class SkStream; | 24 class SkStream; |
24 | 25 |
25 /** | 26 /** |
27 * Given a CGImage, allocate a SkBitmap and copy the images's pixels into it. I f scaleToFit is not | |
scroggo
2014/04/21 20:18:44
nit: an SkBitmap
nit: image's
reed1
2014/04/21 20:44:41
Done.
| |
28 * null, use it to determine the size of the bitmap, and scale the image to fil l the bitmap. | |
29 * Otherwise use the image's width/height. | |
30 * | |
31 * On failure, return false, and leave bitmap unchanged. | |
32 */ | |
33 SK_API bool SkCreateBitmapFromCGImage(SkBitmap* dst, CGImageRef src, SkISize* sc aleToFit = 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!
| |
34 | |
35 /** | |
36 * Given a CGImage, allocate a SkBitmap and copy the images's pixels into it. I f 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.
| |
37 * null, use it to determine the size of the bitmap, and scale the image to fil l the bitmap. | |
38 * Otherwise use the image's width/height. | |
39 * | |
40 * On failure, return false, and leave bitmap unchanged. | |
41 */ | |
42 SK_API bool SkCopyPixelsFromCGImage(const SkImageInfo& info, size_t rowBytes, vo id* pixels, | |
43 CGImageRef src); | |
44 | |
45 /** | |
26 * Create an imageref from the specified bitmap using the specified colorspace. | 46 * Create an imageref from the specified bitmap using the specified colorspace. |
27 * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used. | 47 * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used. |
28 */ | 48 */ |
29 SK_API CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, | 49 SK_API CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, |
30 CGColorSpaceRef space); | 50 CGColorSpaceRef space); |
31 | 51 |
32 /** | 52 /** |
33 * Create an imageref from the specified bitmap using the colorspace returned | 53 * Create an imageref from the specified bitmap using the colorspace returned |
34 * by CGColorSpaceCreateDeviceRGB() | 54 * by CGColorSpaceCreateDeviceRGB() |
35 */ | 55 */ |
(...skipping 22 matching lines...) Expand all Loading... | |
58 * CGDataProviderRef provider = SkStreamToDataProvider(stream); | 78 * CGDataProviderRef provider = SkStreamToDataProvider(stream); |
59 * stream->unref(); | 79 * stream->unref(); |
60 * | 80 * |
61 * Now when the provider is finally deleted, it will delete the stream. | 81 * Now when the provider is finally deleted, it will delete the stream. |
62 */ | 82 */ |
63 CGDataProviderRef SkCreateDataProviderFromStream(SkStream*); | 83 CGDataProviderRef SkCreateDataProviderFromStream(SkStream*); |
64 | 84 |
65 CGDataProviderRef SkCreateDataProviderFromData(SkData*); | 85 CGDataProviderRef SkCreateDataProviderFromData(SkData*); |
66 | 86 |
67 #endif | 87 #endif |
OLD | NEW |