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

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

Issue 3590011: Update use of SkCanvas and SkDevice to match change in Skia (Closed)
Patch Set: Bump deps again to bring in fix for memory leak Created 10 years, 2 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
« no previous file with comments | « skia/ext/platform_canvas_win.cc ('k') | skia/ext/vector_canvas.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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_CANVAS_H_ 5 #ifndef SKIA_EXT_VECTOR_CANVAS_H_
6 #define SKIA_EXT_VECTOR_CANVAS_H_ 6 #define SKIA_EXT_VECTOR_CANVAS_H_
7 #pragma once 7 #pragma once
8 8
9 #include "skia/ext/platform_canvas.h" 9 #include "skia/ext/platform_canvas.h"
10 #include "skia/ext/vector_platform_device.h" 10 #include "skia/ext/vector_platform_device.h"
11 11
12 #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) 12 #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
13 typedef struct _cairo cairo_t; 13 typedef struct _cairo cairo_t;
14 #endif 14 #endif
15 15
16 namespace skia { 16 namespace skia {
17 17
18 // This class is a specialization of the regular PlatformCanvas. It is designed 18 // This class is a specialization of the regular PlatformCanvas. It is designed
19 // to work with a VectorDevice to manage platform-specific drawing. It allows 19 // to work with a VectorDevice to manage platform-specific drawing. It allows
20 // using both Skia operations and platform-specific operations. It *doesn't* 20 // using both Skia operations and platform-specific operations. It *doesn't*
21 // support reading back from the bitmap backstore since it is not used. 21 // support reading back from the bitmap backstore since it is not used.
22 class VectorCanvas : public PlatformCanvas { 22 class VectorCanvas : public PlatformCanvas {
23 public: 23 public:
24 VectorCanvas(); 24 VectorCanvas();
25 explicit VectorCanvas(SkDeviceFactory* factory);
25 #if defined(WIN32) 26 #if defined(WIN32)
26 VectorCanvas(HDC dc, int width, int height); 27 VectorCanvas(HDC dc, int width, int height);
27 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) 28 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
28 // Caller owns |context|. Ownership is not transferred. 29 // Caller owns |context|. Ownership is not transferred.
29 VectorCanvas(cairo_t* context, int width, int height); 30 VectorCanvas(cairo_t* context, int width, int height);
30 #endif 31 #endif
31 virtual ~VectorCanvas(); 32 virtual ~VectorCanvas();
32 33
33 // For two-part init, call if you use the no-argument constructor above 34 // For two-part init, call if you use the no-argument constructor above
34 #if defined(WIN32) 35 #if defined(WIN32)
35 bool initialize(HDC context, int width, int height); 36 bool initialize(HDC context, int width, int height);
36 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) 37 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
37 // Ownership of |context| is not transferred. 38 // Ownership of |context| is not transferred.
38 bool initialize(cairo_t* context, int width, int height); 39 bool initialize(cairo_t* context, int width, int height);
39 #endif 40 #endif
40 41
41 virtual SkBounder* setBounder(SkBounder* bounder); 42 virtual SkBounder* setBounder(SkBounder* bounder);
42 #if defined(WIN32) || defined(__linux__) || defined(__FreeBSD__) || \
43 defined(__OpenBSD__)
44 virtual SkDevice* createDevice(SkBitmap::Config config,
45 int width, int height,
46 bool is_opaque, bool isForLayer);
47 #endif
48 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter); 43 virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter);
49 44
50 private: 45 private:
51 #if defined(WIN32)
52 // |shared_section| is in fact the HDC used for output. |is_opaque| is unused.
53 virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque,
54 HANDLE shared_section);
55 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
56 // Ownership of |context| is not transferred. |is_opaque| is unused.
57 virtual SkDevice* createPlatformDevice(cairo_t* context,
58 int width, int height,
59 bool is_opaque);
60 #endif
61
62 // Returns true if the top device is vector based and not bitmap based. 46 // Returns true if the top device is vector based and not bitmap based.
63 bool IsTopDeviceVectorial() const; 47 bool IsTopDeviceVectorial() const;
64 48
65 // Copy & assign are not supported. 49 // Copy & assign are not supported.
66 VectorCanvas(const VectorCanvas&); 50 VectorCanvas(const VectorCanvas&);
67 const VectorCanvas& operator=(const VectorCanvas&); 51 const VectorCanvas& operator=(const VectorCanvas&);
68 }; 52 };
69 53
70 } // namespace skia 54 } // namespace skia
71 55
72 #endif // SKIA_EXT_VECTOR_CANVAS_H_ 56 #endif // SKIA_EXT_VECTOR_CANVAS_H_
73 57
OLDNEW
« no previous file with comments | « skia/ext/platform_canvas_win.cc ('k') | skia/ext/vector_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698