| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "third_party/skia/include/core/SkDevice.h" | 9 #include "third_party/skia/include/core/SkDevice.h" |
| 10 | 10 |
| 11 typedef struct CGContext* CGContextRef; | 11 typedef struct CGContext* CGContextRef; |
| 12 typedef struct CGRect CGRect; | 12 typedef struct CGRect CGRect; |
| 13 | 13 |
| 14 class SkMatrix; | 14 class SkMatrix; |
| 15 class SkPath; | 15 class SkPath; |
| 16 class SkRegion; | 16 class SkRegion; |
| 17 | 17 |
| 18 namespace skia { | 18 namespace skia { |
| 19 | 19 |
| 20 namespace platform_util { |
| 21 |
| 22 // Draws to the given graphics context. Forwards to the PlatformDevice bound |
| 23 // to |device|. Otherwise is a NOP. |
| 24 void DrawToContext(SkDevice* device, CGContextRef context, int x, int y, |
| 25 const CGRect* src_rect); |
| 26 |
| 27 // Returns the CGContext that backing the SkDevice. Forwards to the bound |
| 28 // PlatformDevice. Returns NULL if no PlatformDevice is bound. |
| 29 CGContextRef GetBitmapContext(SkDevice* device); |
| 30 |
| 31 } // namespace platform_util |
| 32 |
| 20 // A device is basically a wrapper around SkBitmap that provides a surface for | 33 // A device is basically a wrapper around SkBitmap that provides a surface for |
| 21 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also | 34 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also |
| 22 // write to. It also provides functionality to play well with CG drawing | 35 // write to. It also provides functionality to play well with CG drawing |
| 23 // functions. | 36 // functions. |
| 24 // This class is abstract and must be subclassed. It provides the basic | 37 // This class is abstract and must be subclassed. It provides the basic |
| 25 // interface to implement it either with or without a bitmap backend. | 38 // interface to implement it either with or without a bitmap backend. |
| 26 class PlatformDevice : public SkDevice { | 39 class PlatformDevice : public SkDevice { |
| 27 public: | 40 public: |
| 28 typedef CGContextRef PlatformSurface; | 41 typedef CGContextRef PlatformSurface; |
| 29 | 42 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 80 |
| 68 // Loads the specified Skia transform into the device context | 81 // Loads the specified Skia transform into the device context |
| 69 static void LoadTransformToCGContext(CGContextRef context, | 82 static void LoadTransformToCGContext(CGContextRef context, |
| 70 const SkMatrix& matrix); | 83 const SkMatrix& matrix); |
| 71 }; | 84 }; |
| 72 | 85 |
| 73 } // namespace skia | 86 } // namespace skia |
| 74 | 87 |
| 75 #endif // SKIA_EXT_PLATFORM_DEVICE_MAC_H_ | 88 #endif // SKIA_EXT_PLATFORM_DEVICE_MAC_H_ |
| 76 | 89 |
| OLD | NEW |