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

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

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressing comments. Created 9 years, 7 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_PLATFORM_DEVICE_H_ 5 #ifndef SKIA_EXT_PLATFORM_DEVICE_H_
6 #define SKIA_EXT_PLATFORM_DEVICE_H_ 6 #define SKIA_EXT_PLATFORM_DEVICE_H_
7 #pragma once 7 #pragma once
8 8
9 // This file provides an easy way to include the appropriate PlatformDevice 9 // This file provides an easy way to include the appropriate PlatformDevice
10 // header file for your platform. 10 // header file for your platform.
11 11
12 #if defined(WIN32) 12 #if defined(WIN32)
alokp 2011/05/19 18:15:15 This is fine for the first iteration. But I would
Jeff Timanus 2011/05/19 20:38:29 Noted. Will start working on a follow-up CL that
13 #include <windows.h>
14 #endif
15
16 #include "third_party/skia/include/core/SkPreConfig.h"
17 #include "third_party/skia/include/core/SkColor.h"
18
19
20 class SkDevice;
21 struct SkIRect;
22
23 #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
24 typedef struct _cairo cairo_t;
25 typedef struct _cairo_rectangle cairo_rectangle_t;
26 #elif defined(__APPLE__)
27 typedef struct CGContext* CGContextRef;
28 typedef struct CGRect CGRect;
29 #endif
30
31 namespace skia {
32
33 class PlatformDevice;
34
35 #if defined(WIN32)
36 typedef HDC PlatformSurface;
37 typedef RECT PlatformRect;
38 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
39 typedef cairo_t* PlatformSurface;
40 typedef cairo_rectangle_t PlatformRect;
41 #elif defined(__APPLE__)
42 typedef CGContextRef PlatformSurface;
43 typedef CGRect PlatformRect;
44 #endif
45
46 // The following routines provide accessor points for the functionality
47 // exported by the various PlatformDevice ports. The PlatformDevice, and
48 // BitmapPlatformDevice classes inherit directly from SkDevice, which is no
49 // longer a supported usage-pattern for skia. In preparation of the removal of
50 // these classes, all calls to PlatformDevice::* should be routed through these
51 // helper functions.
52
53 // Bind a PlatformDevice instance, |platform_device| to |device|. Subsequent
54 // calls to the functions exported below will forward the request to the
55 // corresponding method on the bound PlatformDevice instance. If no
56 // PlatformDevice has been bound to the SkDevice passed, then the routines are
57 // NOPS.
58 SK_API void SetPlatformDevice(SkDevice* device,
59 PlatformDevice* platform_device);
60 SK_API PlatformDevice* GetPlatformDevice(SkDevice* device);
61
62 // Returns if the preferred rendering engine is vectorial or bitmap based.
63 // Forwards to PlatformDevice::IsVectorial, if a PlatformDevice is bound,
64 // otherwise falls-back to the SkDevice::getDeviceCapabilities routine.
65 SK_API bool IsVectorial(SkDevice* device);
66
67 // Returns if the native font rendering engine is allowed to render text to
68 // this device.
69 SK_API bool IsNativeFontRenderingAllowed(SkDevice* device);
70
71 // Returns the PlatformSurface used for native rendering into the device.
72 SK_API PlatformSurface BeginPlatformPaint(SkDevice* device);
73
74 // Finish a previous call to BeginPlatformPaint.
75 SK_API void EndPlatformPaint(SkDevice* device);
76
77 // Draws to the given PlatformSurface, |context|. Forwards to the
78 // PlatformDevice bound to |device|. Otherwise is a NOP.
79 SK_API void DrawToNativeContext(SkDevice* device, PlatformSurface context,
80 int x, int y, const PlatformRect* src_rect);
81
82 } // namespace skia
83
84 #if defined(WIN32)
13 #include "skia/ext/platform_device_win.h" 85 #include "skia/ext/platform_device_win.h"
14 #elif defined(__APPLE__) 86 #elif defined(__APPLE__)
15 #include "skia/ext/platform_device_mac.h" 87 #include "skia/ext/platform_device_mac.h"
16 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ 88 #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
17 defined(__Solaris__) 89 defined(__Solaris__)
18 #include "skia/ext/platform_device_linux.h" 90 #include "skia/ext/platform_device_linux.h"
19 #endif 91 #endif
20 92
21 #endif 93 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698