| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_LINUX_H_ | 5 #ifndef SKIA_EXT_PLATFORM_DEVICE_LINUX_H_ |
| 6 #define SKIA_EXT_PLATFORM_DEVICE_LINUX_H_ | 6 #define SKIA_EXT_PLATFORM_DEVICE_LINUX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "skia/ext/platform_device.h" | 9 #include "skia/ext/platform_device.h" |
| 10 #include "third_party/skia/include/core/SkDevice.h" | 10 #include "third_party/skia/include/core/SkDevice.h" |
| 11 | 11 |
| 12 namespace skia { | 12 namespace skia { |
| 13 | 13 |
| 14 // Blindly copying the mac hierarchy. | 14 // Blindly copying the mac hierarchy. |
| 15 class PlatformDevice : public SkDevice { | 15 class PlatformDevice { |
| 16 public: | 16 public: |
| 17 typedef cairo_t* PlatformSurface; | 17 typedef cairo_t* PlatformSurface; |
| 18 | 18 |
| 19 // Returns if native platform APIs are allowed to render text to this device. | 19 // Returns if native platform APIs are allowed to render text to this device. |
| 20 virtual bool IsNativeFontRenderingAllowed(); | 20 virtual bool IsNativeFontRenderingAllowed(); |
| 21 | 21 |
| 22 virtual PlatformSurface BeginPlatformPaint() = 0; | 22 virtual PlatformSurface BeginPlatformPaint() = 0; |
| 23 virtual void EndPlatformPaint(); | 23 virtual void EndPlatformPaint(); |
| 24 | 24 |
| 25 virtual void DrawToNativeContext(PlatformSurface surface, int x, int y, | 25 virtual void DrawToNativeContext(PlatformSurface surface, int x, int y, |
| 26 const PlatformRect* src_rect ); | 26 const PlatformRect* src_rect ); |
| 27 | 27 |
| 28 // Sets the opacity of each pixel in the specified region to be opaque. | 28 // Sets the opacity of each pixel in the specified region to be opaque. |
| 29 virtual void MakeOpaque(int x, int y, int width, int height) { } | 29 virtual void MakeOpaque(int x, int y, int width, int height) { } |
| 30 | 30 |
| 31 // Return the SkDevice instance which is associated with this PlatformDevice. |
| 32 SkDevice* GetOwningDevice() const { return device_; } |
| 33 |
| 31 protected: | 34 protected: |
| 32 // Forwards |bitmap| to SkDevice's constructor. | 35 |
| 33 explicit PlatformDevice(const SkBitmap& bitmap); | 36 explicit PlatformDevice(SkDevice* device); |
| 37 |
| 38 // The device to which the PlatformDevice interface is bound. |
| 39 SkDevice* device_; |
| 34 }; | 40 }; |
| 35 | 41 |
| 36 } // namespace skia | 42 } // namespace skia |
| 37 | 43 |
| 38 #endif // SKIA_EXT_PLATFORM_DEVICE_LINUX_H_ | 44 #endif // SKIA_EXT_PLATFORM_DEVICE_LINUX_H_ |
| OLD | NEW |