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

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

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Syncing merge conflicts. 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
« no previous file with comments | « skia/ext/platform_device.h ('k') | skia/ext/platform_device_linux.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "skia/ext/platform_device.h"
6
7 #include "third_party/skia/include/core/SkMetaData.h"
8
9 namespace skia {
10
11 namespace {
12 const char* kDevicePlatformBehaviour = "CrDevicePlatformBehaviour";
13 }
14
15 void SetPlatformDevice(SkDevice* device, PlatformDevice* platform_behaviour) {
16 SkMetaData& meta_data = device->getMetaData();
17 meta_data.setPtr(kDevicePlatformBehaviour, platform_behaviour);
18 }
19
20 PlatformDevice* GetPlatformDevice(SkDevice* device) {
21 SkMetaData& meta_data = device->getMetaData();
22 PlatformDevice* device_behaviour = NULL;
23 if (meta_data.findPtr(kDevicePlatformBehaviour,
24 reinterpret_cast<void**>(&device_behaviour)))
25 return device_behaviour;
26
27 return NULL;
28 }
29
30 PlatformSurface BeginPlatformPaint(SkDevice* device) {
31 PlatformDevice* platform_device = GetPlatformDevice(device);
32 if (platform_device)
33 return platform_device->BeginPlatformPaint();
34
35 return 0;
36 }
37
38 void EndPlatformPaint(SkDevice* device) {
39 PlatformDevice* platform_device = GetPlatformDevice(device);
40 if (platform_device)
41 return platform_device->EndPlatformPaint();
42 }
43
44 bool IsVectorial(SkDevice* device) {
45 PlatformDevice* platform_device = GetPlatformDevice(device);
46 if (platform_device)
47 return platform_device->IsVectorial();
48
49 return device->getDeviceCapabilities() & SkDevice::kVector_Capability;
50 }
51
52 bool IsNativeFontRenderingAllowed(SkDevice* device) {
53 PlatformDevice* platform_device = GetPlatformDevice(device);
54 if (platform_device)
55 return platform_device->IsNativeFontRenderingAllowed();
56
57 return false;
58 }
59
60 void DrawToNativeContext(SkDevice* device, PlatformSurface context,
61 int x, int y, const PlatformRect* src_rect) {
62 PlatformDevice* platform_device = GetPlatformDevice(device);
63 if (platform_device)
64 platform_device->DrawToNativeContext(context, x, y, src_rect);
65 }
66
67 void MakeOpaque(SkDevice* device, int x, int y, int width, int height) {
68 PlatformDevice* platform_device = GetPlatformDevice(device);
69 if (platform_device)
70 platform_device->MakeOpaque(x, y, width, height);
71 }
72
73 } // namespace skia
74
OLDNEW
« no previous file with comments | « skia/ext/platform_device.h ('k') | skia/ext/platform_device_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698