OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_GFX_PLATFORM_DEVICE_MAC_H__ | 5 #ifndef PlatformDeviceMac_h |
6 #define BASE_GFX_PLATFORM_DEVICE_MAC_H__ | 6 #define PlatformDeviceMac_h |
7 | 7 |
8 #import <ApplicationServices/ApplicationServices.h> | 8 #import <ApplicationServices/ApplicationServices.h> |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 | 10 |
11 class SkMatrix; | 11 class SkMatrix; |
12 class SkPath; | 12 class SkPath; |
13 class SkRegion; | 13 class SkRegion; |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 | 16 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 virtual void fixupAlphaBeforeCompositing() = 0; | 48 virtual void fixupAlphaBeforeCompositing() = 0; |
49 | 49 |
50 // Initializes the default settings and colors in a device context. | 50 // Initializes the default settings and colors in a device context. |
51 static void InitializeCGContext(CGContextRef context); | 51 static void InitializeCGContext(CGContextRef context); |
52 | 52 |
53 // Loads a SkPath into the CG context. The path can there after be used for | 53 // Loads a SkPath into the CG context. The path can there after be used for |
54 // clipping or as a stroke. | 54 // clipping or as a stroke. |
55 static void LoadPathToCGContext(CGContextRef context, const SkPath& path); | 55 static void LoadPathToCGContext(CGContextRef context, const SkPath& path); |
56 | 56 |
57 // Loads a SkRegion into the CG context. | 57 // Loads a SkRegion into the CG context. |
58 static void LoadClippingRegionToCGContext(CGContextRef context, | 58 static void LoadClippingRegionToCGContext(CGContextRef context, |
59 const SkRegion& region, | 59 const SkRegion& region, |
60 const SkMatrix& transformation); | 60 const SkMatrix& transformation); |
61 | 61 |
62 protected: | 62 protected: |
63 // Forwards |bitmap| to SkDevice's constructor. | 63 // Forwards |bitmap| to SkDevice's constructor. |
64 PlatformDeviceMac(const SkBitmap& bitmap); | 64 PlatformDeviceMac(const SkBitmap& bitmap); |
65 | 65 |
66 // Loads the specified Skia transform into the device context | 66 // Loads the specified Skia transform into the device context |
67 static void LoadTransformToCGContext(CGContextRef context, | 67 static void LoadTransformToCGContext(CGContextRef context, |
68 const SkMatrix& matrix); | 68 const SkMatrix& matrix); |
69 | 69 |
70 // Function pointer used by the processPixels method for setting the alpha | 70 // Function pointer used by the processPixels method for setting the alpha |
71 // value of a particular pixel. | 71 // value of a particular pixel. |
72 typedef void (*adjustAlpha)(uint32_t* pixel); | 72 typedef void (*adjustAlpha)(uint32_t* pixel); |
73 | 73 |
74 // Loops through each of the pixels in the specified range, invoking | 74 // Loops through each of the pixels in the specified range, invoking |
75 // adjustor for the alpha value of each pixel. | 75 // adjustor for the alpha value of each pixel. |
76 virtual void processPixels(int x, | 76 virtual void processPixels(int x, |
77 int y, | 77 int y, |
78 int width, | 78 int width, |
79 int height, | 79 int height, |
80 adjustAlpha adjustor) = 0; | 80 adjustAlpha adjustor) = 0; |
81 }; | 81 }; |
82 | 82 |
83 } // namespace gfx | 83 } // namespace gfx |
84 | 84 |
85 #endif // BASE_GFX_PLATFORM_DEVICE_MAC_H__ | 85 #endif // PlatformDeviceMac_h |
86 | 86 |
OLD | NEW |