| 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 SKIA_EXT_PLATFORM_DEVICE_MAC_H_ | 5 #ifndef SKIA_EXT_PLATFORM_DEVICE_MAC_H_ |
| 6 #define SKIA_EXT_PLATFORM_DEVICE_MAC_H_ | 6 #define SKIA_EXT_PLATFORM_DEVICE_MAC_H_ |
| 7 | 7 |
| 8 #import <ApplicationServices/ApplicationServices.h> | 8 #import <ApplicationServices/ApplicationServices.h> |
| 9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 virtual CGContextRef GetBitmapContext() = 0; | 28 virtual CGContextRef GetBitmapContext() = 0; |
| 29 | 29 |
| 30 // Draws to the given graphics context. If the bitmap context doesn't exist, | 30 // Draws to the given graphics context. If the bitmap context doesn't exist, |
| 31 // this will temporarily create it. However, if you have created the bitmap | 31 // this will temporarily create it. However, if you have created the bitmap |
| 32 // context, it will be more efficient if you don't free it until after this | 32 // context, it will be more efficient if you don't free it until after this |
| 33 // call so it doesn't have to be created twice. If src_rect is null, then | 33 // call so it doesn't have to be created twice. If src_rect is null, then |
| 34 // the entirety of the source device will be copied. | 34 // the entirety of the source device will be copied. |
| 35 virtual void DrawToContext(CGContextRef context, int x, int y, | 35 virtual void DrawToContext(CGContextRef context, int x, int y, |
| 36 const CGRect* src_rect) = 0; | 36 const CGRect* src_rect) = 0; |
| 37 | 37 |
| 38 // Sets the opacity of each pixel in the specified region to be opaque. | |
| 39 void makeOpaque(int x, int y, int width, int height); | |
| 40 | |
| 41 // Returns if the preferred rendering engine is vectorial or bitmap based. | 38 // Returns if the preferred rendering engine is vectorial or bitmap based. |
| 42 virtual bool IsVectorial() = 0; | 39 virtual bool IsVectorial() = 0; |
| 43 | 40 |
| 44 // On platforms where the native rendering API does not support rendering | |
| 45 // into bitmaps with a premultiplied alpha channel, this call is responsible | |
| 46 // for doing any fixup necessary. It is not used on the Mac, since | |
| 47 // CoreGraphics can handle premultiplied alpha just fine. | |
| 48 virtual void fixupAlphaBeforeCompositing() = 0; | |
| 49 | |
| 50 // Initializes the default settings and colors in a device context. | 41 // Initializes the default settings and colors in a device context. |
| 51 static void InitializeCGContext(CGContextRef context); | 42 static void InitializeCGContext(CGContextRef context); |
| 52 | 43 |
| 53 // Loads a SkPath into the CG context. The path can there after be used for | 44 // Loads a SkPath into the CG context. The path can there after be used for |
| 54 // clipping or as a stroke. | 45 // clipping or as a stroke. |
| 55 static void LoadPathToCGContext(CGContextRef context, const SkPath& path); | 46 static void LoadPathToCGContext(CGContextRef context, const SkPath& path); |
| 56 | 47 |
| 57 // Loads a SkRegion into the CG context. | 48 // Loads a SkRegion into the CG context. |
| 58 static void LoadClippingRegionToCGContext(CGContextRef context, | 49 static void LoadClippingRegionToCGContext(CGContextRef context, |
| 59 const SkRegion& region, | 50 const SkRegion& region, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 77 int y, | 68 int y, |
| 78 int width, | 69 int width, |
| 79 int height, | 70 int height, |
| 80 adjustAlpha adjustor) = 0; | 71 adjustAlpha adjustor) = 0; |
| 81 }; | 72 }; |
| 82 | 73 |
| 83 } // namespace skia | 74 } // namespace skia |
| 84 | 75 |
| 85 #endif // SKIA_EXT_PLATFORM_DEVICE_MAC_H_ | 76 #endif // SKIA_EXT_PLATFORM_DEVICE_MAC_H_ |
| 86 | 77 |
| OLD | NEW |