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

Side by Side Diff: printing/metafile_skia_wrapper.cc

Issue 1462163002: Move uncoupled code out of skia/ext/platform_device.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-draft-metadata
Patch Set: Trim superfluous SK_API Created 5 years 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 | « content/renderer/pepper/ppb_image_data_impl.cc ('k') | printing/printed_document.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "printing/metafile_skia_wrapper.h" 5 #include "printing/metafile_skia_wrapper.h"
6 #include "skia/ext/platform_device.h" 6 #include "skia/ext/platform_canvas.h"
7 #include "skia/ext/refptr.h" 7 #include "skia/ext/refptr.h"
8 #include "third_party/skia/include/core/SkMetaData.h" 8 #include "third_party/skia/include/core/SkMetaData.h"
9 9
10 class SkCanvas;
11
12 namespace printing { 10 namespace printing {
13 11
14 namespace { 12 namespace {
15 13
16 const char* kMetafileKey = "CrMetafile"; 14 const char* kMetafileKey = "CrMetafile";
17 15
18 } // namespace 16 } // namespace
19 17
20 // static 18 // static
21 void MetafileSkiaWrapper::SetMetafileOnCanvas(const SkCanvas& canvas, 19 void MetafileSkiaWrapper::SetMetafileOnCanvas(const SkCanvas& canvas,
22 PdfMetafileSkia* metafile) { 20 PdfMetafileSkia* metafile) {
23 skia::RefPtr<MetafileSkiaWrapper> wrapper; 21 skia::RefPtr<MetafileSkiaWrapper> wrapper;
24 if (metafile) 22 if (metafile)
25 wrapper = skia::AdoptRef(new MetafileSkiaWrapper(metafile)); 23 wrapper = skia::AdoptRef(new MetafileSkiaWrapper(metafile));
26 24
27 SkMetaData& meta = skia::getMetaData(canvas); 25 SkMetaData& meta = skia::GetMetaData(canvas);
28 meta.setRefCnt(kMetafileKey, wrapper.get()); 26 meta.setRefCnt(kMetafileKey, wrapper.get());
29 } 27 }
30 28
31 // static 29 // static
32 PdfMetafileSkia* MetafileSkiaWrapper::GetMetafileFromCanvas( 30 PdfMetafileSkia* MetafileSkiaWrapper::GetMetafileFromCanvas(
33 const SkCanvas& canvas) { 31 const SkCanvas& canvas) {
34 SkMetaData& meta = skia::getMetaData(canvas); 32 SkMetaData& meta = skia::GetMetaData(canvas);
35 SkRefCnt* value; 33 SkRefCnt* value;
36 if (!meta.findRefCnt(kMetafileKey, &value) || !value) 34 if (!meta.findRefCnt(kMetafileKey, &value) || !value)
37 return NULL; 35 return NULL;
38 36
39 return static_cast<MetafileSkiaWrapper*>(value)->metafile_; 37 return static_cast<MetafileSkiaWrapper*>(value)->metafile_;
40 } 38 }
41 39
42 MetafileSkiaWrapper::MetafileSkiaWrapper(PdfMetafileSkia* metafile) 40 MetafileSkiaWrapper::MetafileSkiaWrapper(PdfMetafileSkia* metafile)
43 : metafile_(metafile) { 41 : metafile_(metafile) {
44 } 42 }
45 43
46 } // namespace printing 44 } // namespace printing
OLDNEW
« no previous file with comments | « content/renderer/pepper/ppb_image_data_impl.cc ('k') | printing/printed_document.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698