Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1081)

Side by Side Diff: skia/ext/vector_platform_device_skia.h

Issue 7633040: CL removing inheritance of SkDevice from PlatformDevice. Flavours of PlatformDevice classes now ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « skia/ext/vector_platform_device_emf_win.cc ('k') | skia/ext/vector_platform_device_skia.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, public SkPDFDevice {
26 public: 26 public:
27 SK_API VectorPlatformDeviceSkia(SkPDFDevice* pdf_device); 27 SK_API VectorPlatformDeviceSkia(const SkISize& pageSize,
28 const SkISize& contentSize,
29 const SkMatrix& initialTransform);
28 virtual ~VectorPlatformDeviceSkia(); 30 virtual ~VectorPlatformDeviceSkia();
29 31
30 SkPDFDevice* PdfDevice() { return pdf_device_.get(); }
31
32 // PlatformDevice methods. 32 // PlatformDevice methods.
33 virtual bool IsNativeFontRenderingAllowed(); 33 virtual bool IsNativeFontRenderingAllowed();
34 34
35 virtual PlatformSurface BeginPlatformPaint(); 35 virtual PlatformSurface BeginPlatformPaint();
36 virtual void EndPlatformPaint(); 36 virtual void EndPlatformPaint();
37 #if defined(OS_WIN) 37 #if defined(OS_WIN)
38 virtual void DrawToNativeContext(HDC dc, int x, int y, const RECT* src_rect); 38 virtual void DrawToNativeContext(HDC dc, int x, int y, const RECT* src_rect);
39 #elif defined(OS_MACOSX) 39 #elif defined(OS_MACOSX)
40 virtual void DrawToNativeContext(CGContext* context, int x, int y, 40 virtual void DrawToNativeContext(CGContext* context, int x, int y,
41 const CGRect* src_rect); 41 const CGRect* src_rect);
42 virtual CGContextRef GetBitmapContext(); 42 virtual CGContextRef GetBitmapContext();
43 #elif defined(OS_LINUX)
44 virtual void DrawToNativeContext(PlatformSurface surface, int x, int y,
45 const PlatformRect* src_rect);
43 #endif 46 #endif
44 47
45 // SkDevice methods.
46 virtual uint32_t getDeviceCapabilities();
47 virtual int width() const;
48 virtual int height() const;
49 virtual void setMatrixClip(const SkMatrix& matrix, const SkRegion& region,
50 const SkClipStack& stack);
51 virtual bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap);
52
53 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint);
54 virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
55 size_t count, const SkPoint[], const SkPaint& paint);
56 virtual void drawRect(const SkDraw& draw, const SkRect& rect,
57 const SkPaint& paint);
58 virtual void drawPath(const SkDraw& draw, const SkPath& path,
59 const SkPaint& paint, const SkMatrix* prePathMatrix,
60 bool pathIsMutable);
61 virtual void drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
62 const SkIRect* srcRectOrNull, const SkMatrix& matrix,
63 const SkPaint& paint);
64 virtual void drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
65 int x, int y, const SkPaint& paint);
66 virtual void drawText(const SkDraw& draw, const void* text, size_t len,
67 SkScalar x, SkScalar y, const SkPaint& paint);
68 virtual void drawPosText(const SkDraw& draw, const void* text, size_t len,
69 const SkScalar pos[], SkScalar constY,
70 int scalarsPerPos, const SkPaint& paint);
71 virtual void drawTextOnPath(const SkDraw& draw, const void* text, size_t len,
72 const SkPath& path, const SkMatrix* matrix,
73 const SkPaint& paint);
74 virtual void drawVertices(const SkDraw& draw, SkCanvas::VertexMode,
75 int vertexCount, const SkPoint verts[],
76 const SkPoint texs[], const SkColor colors[],
77 SkXfermode* xmode, const uint16_t indices[],
78 int indexCount, const SkPaint& paint);
79 virtual void drawDevice(const SkDraw& draw, SkDevice*, int x, int y,
80 const SkPaint&);
81
82 // Sets the drawing area for the device. Subsequent draw calls are
83 // directed to the specific drawing area (margin or content area).
84 SK_API void setDrawingArea(SkPDFDevice::DrawingArea area);
85
86 protected:
87 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width,
88 int height, bool isOpaque,
89 Usage usage);
90
91 private: 48 private:
92 SkRefPtr<SkPDFDevice> pdf_device_;
93 SkRefPtr<BitmapPlatformDevice> raster_surface_; 49 SkRefPtr<BitmapPlatformDevice> raster_surface_;
94 50
95 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceSkia); 51 DISALLOW_COPY_AND_ASSIGN(VectorPlatformDeviceSkia);
96 }; 52 };
97 53
98 } // namespace skia 54 } // namespace skia
99 55
100 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_ 56 #endif // SKIA_EXT_VECTOR_PLATFORM_DEVICE_SKIA_H_
OLDNEW
« no previous file with comments | « skia/ext/vector_platform_device_emf_win.cc ('k') | skia/ext/vector_platform_device_skia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698