| 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_VECTOR_PLATFORM_DEVICE_CAIRO_LINUX_H_ | 5 #ifndef SKIA_EXT_VECTOR_PLATFORM_DEVICE_CAIRO_LINUX_H_ |
| 6 #define SKIA_EXT_VECTOR_PLATFORM_DEVICE_CAIRO_LINUX_H_ | 6 #define SKIA_EXT_VECTOR_PLATFORM_DEVICE_CAIRO_LINUX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "skia/ext/platform_device.h" | 11 #include "skia/ext/platform_device.h" |
| 12 #include "third_party/skia/include/core/SkMatrix.h" | 12 #include "third_party/skia/include/core/SkMatrix.h" |
| 13 #include "third_party/skia/include/core/SkRegion.h" | 13 #include "third_party/skia/include/core/SkRegion.h" |
| 14 | 14 |
| 15 namespace skia { | 15 namespace skia { |
| 16 | 16 |
| 17 class SK_API VectorPlatformDeviceCairoFactory : public SkDeviceFactory { | 17 class SK_API VectorPlatformDeviceCairoFactory { |
| 18 public: | 18 public: |
| 19 static PlatformDevice* CreateDevice(cairo_t* context, int width, int height, | 19 static PlatformDevice* CreateDevice(cairo_t* context, int width, int height, |
| 20 bool isOpaque); | 20 bool isOpaque); |
| 21 | |
| 22 // Overridden from SkDeviceFactory: | |
| 23 virtual SkDevice* newDevice(SkCanvas* ignored, SkBitmap::Config config, | |
| 24 int width, int height, | |
| 25 bool isOpaque, bool isForLayer); | |
| 26 }; | 21 }; |
| 27 | 22 |
| 28 // This device is basically a wrapper that provides a surface for SkCanvas | 23 // This device is basically a wrapper that provides a surface for SkCanvas |
| 29 // to draw into. It is basically an adaptor which converts skia APIs into | 24 // to draw into. It is basically an adaptor which converts skia APIs into |
| 30 // cooresponding Cairo APIs and outputs to a Cairo surface. Please NOTE that | 25 // cooresponding Cairo APIs and outputs to a Cairo surface. Please NOTE that |
| 31 // since it is completely vectorial, the bitmap content in it is thus | 26 // since it is completely vectorial, the bitmap content in it is thus |
| 32 // meaningless. | 27 // meaningless. |
| 33 class SK_API VectorPlatformDeviceCairo : public PlatformDevice { | 28 class SK_API VectorPlatformDeviceCairo : public PlatformDevice { |
| 34 public: | 29 public: |
| 35 virtual ~VectorPlatformDeviceCairo(); | 30 virtual ~VectorPlatformDeviceCairo(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, | 76 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, |
| 82 const SkClipStack&); | 77 const SkClipStack&); |
| 83 | 78 |
| 84 // Overridden from PlatformDevice | 79 // Overridden from PlatformDevice |
| 85 virtual PlatformSurface BeginPlatformPaint(); | 80 virtual PlatformSurface BeginPlatformPaint(); |
| 86 | 81 |
| 87 protected: | 82 protected: |
| 88 explicit VectorPlatformDeviceCairo(PlatformSurface context, | 83 explicit VectorPlatformDeviceCairo(PlatformSurface context, |
| 89 const SkBitmap& bitmap); | 84 const SkBitmap& bitmap); |
| 90 | 85 |
| 91 // Override from SkDevice (through PlatformDevice). | 86 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, |
| 92 virtual SkDeviceFactory* onNewDeviceFactory(); | 87 int height, bool isOpaque, Usage); |
| 93 | 88 |
| 94 private: | 89 private: |
| 95 // Apply paint's color in the context. | 90 // Apply paint's color in the context. |
| 96 void ApplyPaintColor(const SkPaint& paint); | 91 void ApplyPaintColor(const SkPaint& paint); |
| 97 | 92 |
| 98 // Apply path's fill style in the context. | 93 // Apply path's fill style in the context. |
| 99 void ApplyFillStyle(const SkPath& path); | 94 void ApplyFillStyle(const SkPath& path); |
| 100 | 95 |
| 101 // Apply paint's stroke style in the context. | 96 // Apply paint's stroke style in the context. |
| 102 void ApplyStrokeStyle(const SkPaint& paint); | 97 void ApplyStrokeStyle(const SkPaint& paint); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 131 | 126 |
| 132 // Device context. | 127 // Device context. |
| 133 PlatformSurface context_; | 128 PlatformSurface context_; |
| 134 | 129 |
| 135 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceCairo); | 130 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceCairo); |
| 136 }; | 131 }; |
| 137 | 132 |
| 138 } // namespace skia | 133 } // namespace skia |
| 139 | 134 |
| 140 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_CAIRO_LINUX_H_ | 135 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_CAIRO_LINUX_H_ |
| OLD | NEW |