| 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 BitmapPlatformDeviceMac_h | 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ |
| 6 #define BitmapPlatformDeviceMac_h | 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ |
| 7 | 7 |
| 8 #include "base/gfx/platform_device_mac.h" | |
| 9 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "skia/ext/platform_device_mac.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 | 12 |
| 13 // A device is basically a wrapper around SkBitmap that provides a surface for | 13 // A device is basically a wrapper around SkBitmap that provides a surface for |
| 14 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also | 14 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also |
| 15 // write to. BitmapPlatformDeviceMac creates a bitmap using | 15 // write to. BitmapPlatformDeviceMac creates a bitmap using |
| 16 // CGCreateBitmapContext() in a format that Skia supports and can then use this | 16 // CGCreateBitmapContext() in a format that Skia supports and can then use this |
| 17 // to draw text into, etc. This pixel data is provided to the bitmap that the | 17 // to draw text into, etc. This pixel data is provided to the bitmap that the |
| 18 // device contains so that it can be shared. | 18 // device contains so that it can be shared. |
| 19 // | 19 // |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // See warning for copy constructor above. | 55 // See warning for copy constructor above. |
| 56 BitmapPlatformDeviceMac& operator=(const BitmapPlatformDeviceMac& other); | 56 BitmapPlatformDeviceMac& operator=(const BitmapPlatformDeviceMac& other); |
| 57 | 57 |
| 58 virtual CGContextRef GetBitmapContext(); | 58 virtual CGContextRef GetBitmapContext(); |
| 59 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region); | 59 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region); |
| 60 | 60 |
| 61 virtual void DrawToContext(CGContextRef context, int x, int y, | 61 virtual void DrawToContext(CGContextRef context, int x, int y, |
| 62 const CGRect* src_rect); | 62 const CGRect* src_rect); |
| 63 virtual bool IsVectorial() { return false; } | 63 virtual bool IsVectorial() { return false; } |
| 64 virtual void fixupAlphaBeforeCompositing() { }; | 64 virtual void fixupAlphaBeforeCompositing() { }; |
| 65 | 65 |
| 66 // Returns the color value at the specified location. This does not | 66 // Returns the color value at the specified location. This does not |
| 67 // consider any transforms that may be set on the device. | 67 // consider any transforms that may be set on the device. |
| 68 SkColor getColorAt(int x, int y); | 68 SkColor getColorAt(int x, int y); |
| 69 | 69 |
| 70 protected: | 70 protected: |
| 71 // Reference counted data that can be shared between multiple devices. This | 71 // Reference counted data that can be shared between multiple devices. This |
| 72 // allows copy constructors and operator= for devices to work properly. The | 72 // allows copy constructors and operator= for devices to work properly. The |
| 73 // bitmaps used by the base device class are already refcounted and copyable. | 73 // bitmaps used by the base device class are already refcounted and copyable. |
| 74 class BitmapPlatformDeviceMacData; | 74 class BitmapPlatformDeviceMacData; |
| 75 | 75 |
| 76 BitmapPlatformDeviceMac(BitmapPlatformDeviceMacData* data, | 76 BitmapPlatformDeviceMac(BitmapPlatformDeviceMacData* data, |
| 77 const SkBitmap& bitmap); | 77 const SkBitmap& bitmap); |
| 78 | 78 |
| 79 // Flushes the CoreGraphics context so that the pixel data can be accessed | 79 // Flushes the CoreGraphics context so that the pixel data can be accessed |
| 80 // directly by Skia. Overridden from SkDevice, this is called when Skia | 80 // directly by Skia. Overridden from SkDevice, this is called when Skia |
| 81 // starts accessing pixel data. | 81 // starts accessing pixel data. |
| 82 virtual void onAccessBitmap(SkBitmap*); | 82 virtual void onAccessBitmap(SkBitmap*); |
| 83 | 83 |
| 84 // Data associated with this device, guaranteed non-null. | 84 // Data associated with this device, guaranteed non-null. |
| 85 scoped_refptr<BitmapPlatformDeviceMacData> data_; | 85 scoped_refptr<BitmapPlatformDeviceMacData> data_; |
| 86 | 86 |
| 87 virtual void processPixels(int x, int y, | 87 virtual void processPixels(int x, int y, |
| 88 int width, int height, | 88 int width, int height, |
| 89 adjustAlpha adjustor); | 89 adjustAlpha adjustor); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace gfx | 92 } // namespace gfx |
| 93 | 93 |
| 94 #endif // BitmapPlatformDeviceMac_h | 94 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ |
| 95 | 95 |
| OLD | NEW |