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

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

Issue 1464783003: Fix build after https://codereview.chromium.org/1457033002 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | no next file » | 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 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "skia/ext/platform_device.h" 6 #include "skia/ext/platform_device.h"
7 7
8 #include "third_party/skia/include/core/SkMetaData.h" 8 #include "third_party/skia/include/core/SkMetaData.h"
9 9
10 namespace skia { 10 namespace skia {
11 11
12 namespace { 12 namespace {
13 13
14 const char kDevicePlatformBehaviour[] = "CrDevicePlatformBehaviour"; 14 const char kDevicePlatformBehaviour[] = "CrDevicePlatformBehaviour";
15 15
16 #if defined(OS_MACOSX) 16 #if defined(OS_MACOSX)
17 const char kIsPreviewMetafileKey[] = "CrIsPreviewMetafile"; 17 const char kIsPreviewMetafileKey[] = "CrIsPreviewMetafile";
18 #endif
19 18
20 void SetBoolMetaData(const SkCanvas& canvas, const char* key, bool value) { 19 void SetBoolMetaData(const SkCanvas& canvas, const char* key, bool value) {
21 SkMetaData& meta = skia::getMetaData(canvas); 20 SkMetaData& meta = skia::getMetaData(canvas);
22 meta.setBool(key, value); 21 meta.setBool(key, value);
23 } 22 }
24 23
25 bool GetBoolMetaData(const SkCanvas& canvas, const char* key) { 24 bool GetBoolMetaData(const SkCanvas& canvas, const char* key) {
26 bool value; 25 bool value;
27 SkMetaData& meta = skia::getMetaData(canvas); 26 SkMetaData& meta = skia::getMetaData(canvas);
28 if (!meta.findBool(key, &value)) 27 if (!meta.findBool(key, &value))
29 value = false; 28 value = false;
30 return value; 29 return value;
31 } 30 }
31 #endif
32 32
33 } // namespace 33 } // namespace
34 34
35 void SetPlatformDevice(SkBaseDevice* device, PlatformDevice* platform_behaviour) { 35 void SetPlatformDevice(SkBaseDevice* device,
36 PlatformDevice* platform_behaviour) {
36 SkMetaData& meta_data = device->getMetaData(); 37 SkMetaData& meta_data = device->getMetaData();
37 meta_data.setPtr(kDevicePlatformBehaviour, platform_behaviour); 38 meta_data.setPtr(kDevicePlatformBehaviour, platform_behaviour);
38 } 39 }
39 40
40 PlatformDevice* GetPlatformDevice(SkBaseDevice* device) { 41 PlatformDevice* GetPlatformDevice(SkBaseDevice* device) {
41 if (device) { 42 if (device) {
42 SkMetaData& meta_data = device->getMetaData(); 43 SkMetaData& meta_data = device->getMetaData();
43 PlatformDevice* device_behaviour = NULL; 44 PlatformDevice* device_behaviour = NULL;
44 if (meta_data.findPtr(kDevicePlatformBehaviour, 45 if (meta_data.findPtr(kDevicePlatformBehaviour,
45 reinterpret_cast<void**>(&device_behaviour))) 46 reinterpret_cast<void**>(&device_behaviour)))
(...skipping 16 matching lines...) Expand all
62 bool IsPreviewMetafile(const SkCanvas& canvas) { 63 bool IsPreviewMetafile(const SkCanvas& canvas) {
63 return GetBoolMetaData(canvas, kIsPreviewMetafileKey); 64 return GetBoolMetaData(canvas, kIsPreviewMetafileKey);
64 } 65 }
65 #endif 66 #endif
66 67
67 bool PlatformDevice::SupportsPlatformPaint() { 68 bool PlatformDevice::SupportsPlatformPaint() {
68 return true; 69 return true;
69 } 70 }
70 71
71 } // namespace skia 72 } // namespace skia
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698