| 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_SKIA_H_ | 5 #ifndef SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ |
| 6 #define SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ | 6 #define SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "skia/ext/platform_device.h" | 11 #include "skia/ext/platform_device.h" |
| 12 #include "third_party/skia/include/core/SkRefCnt.h" | 12 #include "third_party/skia/include/core/SkRefCnt.h" |
| 13 #include "third_party/skia/include/core/SkTScopedPtr.h" | 13 #include "third_party/skia/include/core/SkTScopedPtr.h" |
| 14 #include "third_party/skia/include/pdf/SkPDFDevice.h" | 14 #include "third_party/skia/include/pdf/SkPDFDevice.h" |
| 15 | 15 |
| 16 class SkClipStack; | 16 class SkClipStack; |
| 17 class SkMatrix; | 17 class SkMatrix; |
| 18 struct SkIRect; | 18 struct SkIRect; |
| 19 struct SkRect; | 19 struct SkRect; |
| 20 | 20 |
| 21 namespace skia { | 21 namespace skia { |
| 22 | 22 |
| 23 class BitmapPlatformDevice; | 23 class BitmapPlatformDevice; |
| 24 | 24 |
| 25 class VectorPlatformDeviceSkiaFactory : public SkDeviceFactory { | |
| 26 public: | |
| 27 virtual SkDevice* newDevice(SkCanvas* notUsed, SkBitmap::Config config, | |
| 28 int width, int height, bool isOpaque, | |
| 29 bool isForLayer); | |
| 30 private: | |
| 31 SkPDFDeviceFactory factory_; | |
| 32 }; | |
| 33 | |
| 34 class VectorPlatformDeviceSkia : public PlatformDevice { | 25 class VectorPlatformDeviceSkia : public PlatformDevice { |
| 35 public: | 26 public: |
| 36 SK_API VectorPlatformDeviceSkia(SkPDFDevice* pdf_device); | 27 SK_API VectorPlatformDeviceSkia(SkPDFDevice* pdf_device); |
| 37 virtual ~VectorPlatformDeviceSkia(); | 28 virtual ~VectorPlatformDeviceSkia(); |
| 38 | 29 |
| 39 SkPDFDevice* PdfDevice() { return pdf_device_.get(); } | 30 SkPDFDevice* PdfDevice() { return pdf_device_.get(); } |
| 40 | 31 |
| 41 // PlatformDevice methods. | 32 // PlatformDevice methods. |
| 42 virtual bool IsNativeFontRenderingAllowed(); | 33 virtual bool IsNativeFontRenderingAllowed(); |
| 43 | 34 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 const SkPaint& paint); | 73 const SkPaint& paint); |
| 83 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, | 74 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, |
| 84 int vertexCount, const SkPoint verts[], | 75 int vertexCount, const SkPoint verts[], |
| 85 const SkPoint texs[], const SkColor colors[], | 76 const SkPoint texs[], const SkColor colors[], |
| 86 SkXfermode* xmode, const uint16_t indices[], | 77 SkXfermode* xmode, const uint16_t indices[], |
| 87 int indexCount, const SkPaint& paint); | 78 int indexCount, const SkPaint& paint); |
| 88 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, | 79 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, |
| 89 const SkPaint&); | 80 const SkPaint&); |
| 90 | 81 |
| 91 protected: | 82 protected: |
| 92 // Override from SkDevice (through PlatformDevice). | 83 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, |
| 93 virtual SkDeviceFactory* onNewDeviceFactory(); | 84 int height, bool isOpaque, |
| 85 Usage usage); |
| 94 | 86 |
| 95 private: | 87 private: |
| 96 SkRefPtr<SkPDFDevice> pdf_device_; | 88 SkRefPtr<SkPDFDevice> pdf_device_; |
| 97 SkRefPtr<BitmapPlatformDevice> raster_surface_; | 89 SkRefPtr<BitmapPlatformDevice> raster_surface_; |
| 98 | 90 |
| 99 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceSkia); | 91 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceSkia); |
| 100 }; | 92 }; |
| 101 | 93 |
| 102 } // namespace skia | 94 } // namespace skia |
| 103 | 95 |
| 104 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ | 96 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ |
| OLD | NEW |