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 VectorPlatformDeviceSkia : public PlatformDevice { | 25 class VectorPlatformDeviceSkia : public PlatformDevice { |
26 public: | 26 public: |
27 SK_API VectorPlatformDeviceSkia(SkPDFDevice* pdf_device); | 27 SK_API VectorPlatformDeviceSkia(SkPDFDevice* pdf_device); |
28 virtual ~VectorPlatformDeviceSkia(); | 28 virtual ~VectorPlatformDeviceSkia(); |
29 | 29 |
30 SkPDFDevice* PdfDevice() { return pdf_device_.get(); } | 30 #if 0 |
| 31 SkPDFDevice* PdfDevice() { return GetOwningDevice();/*pdf_device_.get();*/ } |
| 32 #endif |
31 | 33 |
32 // PlatformDevice methods. | 34 // PlatformDevice methods. |
33 virtual bool IsNativeFontRenderingAllowed(); | 35 virtual bool IsNativeFontRenderingAllowed(); |
34 | 36 |
35 virtual PlatformSurface BeginPlatformPaint(); | 37 virtual PlatformSurface BeginPlatformPaint(); |
36 virtual void EndPlatformPaint(); | 38 virtual void EndPlatformPaint(); |
37 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
38 virtual void DrawToNativeContext(HDC dc, int x, int y, const RECT* src_rect); | 40 virtual void DrawToNativeContext(HDC dc, int x, int y, const RECT* src_rect); |
39 #elif defined(OS_MACOSX) | 41 #elif defined(OS_MACOSX) |
40 virtual void DrawToNativeContext(CGContext* context, int x, int y, | 42 virtual void DrawToNativeContext(CGContext* context, int x, int y, |
41 const CGRect* src_rect); | 43 const CGRect* src_rect); |
42 virtual CGContextRef GetBitmapContext(); | 44 virtual CGContextRef GetBitmapContext(); |
43 #endif | 45 #endif |
44 | 46 |
45 // SkDevice methods. | 47 // SkDevice methods. |
| 48 #if 0 |
46 virtual uint32_t getDeviceCapabilities(); | 49 virtual uint32_t getDeviceCapabilities(); |
47 virtual int width() const; | 50 virtual int width() const; |
48 virtual int height() const; | 51 virtual int height() const; |
49 virtual void setMatrixClip(const SkMatrix& matrix, const SkRegion& region, | 52 virtual void setMatrixClip(const SkMatrix& matrix, const SkRegion& region, |
50 const SkClipStack& stack); | 53 const SkClipStack& stack); |
51 virtual bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap); | 54 virtual bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap); |
52 | 55 |
53 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint); | 56 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint); |
54 virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, | 57 virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, |
55 size_t count, const SkPoint[], const SkPaint& paint); | 58 size_t count, const SkPoint[], const SkPaint& paint); |
(...skipping 15 matching lines...) Expand all Loading... |
71 virtual void drawTextOnPath(const SkDraw& draw, const void* text, size_t len, | 74 virtual void drawTextOnPath(const SkDraw& draw, const void* text, size_t len, |
72 const SkPath& path, const SkMatrix* matrix, | 75 const SkPath& path, const SkMatrix* matrix, |
73 const SkPaint& paint); | 76 const SkPaint& paint); |
74 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, | 77 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode, |
75 int vertexCount, const SkPoint verts[], | 78 int vertexCount, const SkPoint verts[], |
76 const SkPoint texs[], const SkColor colors[], | 79 const SkPoint texs[], const SkColor colors[], |
77 SkXfermode* xmode, const uint16_t indices[], | 80 SkXfermode* xmode, const uint16_t indices[], |
78 int indexCount, const SkPaint& paint); | 81 int indexCount, const SkPaint& paint); |
79 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, | 82 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y, |
80 const SkPaint&); | 83 const SkPaint&); |
| 84 #endif |
81 | 85 |
82 protected: | 86 protected: |
| 87 #if 0 |
83 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, | 88 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, |
84 int height, bool isOpaque, | 89 int height, bool isOpaque, |
85 Usage usage); | 90 Usage usage); |
| 91 #endif |
86 | 92 |
87 private: | 93 private: |
88 SkRefPtr<SkPDFDevice> pdf_device_; | 94 //SkRefPtr<SkPDFDevice> pdf_device_; |
89 SkRefPtr<BitmapPlatformDevice> raster_surface_; | 95 //SkRefPtr<BitmapPlatformDevice> raster_surface_; |
| 96 SkRefPtr<SkDevice> raster_surface_; |
| 97 SkRefPtr<SkCanvas> raster_canvas_; |
90 | 98 |
91 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceSkia); | 99 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceSkia); |
92 }; | 100 }; |
93 | 101 |
94 } // namespace skia | 102 } // namespace skia |
95 | 103 |
96 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ | 104 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ |
OLD | NEW |