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

Side by Side Diff: cc/paint/paint_canvas.cc

Issue 2686033005: Move metafile printing code from platform canvas to PaintCanvas (Closed)
Patch Set: Fix missing build_config include Created 3 years, 10 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 | « cc/paint/paint_canvas.h ('k') | components/printing/renderer/print_web_view_helper.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "cc/paint/paint_canvas.h" 5 #include "cc/paint/paint_canvas.h"
6 6
7 #include "third_party/skia/include/core/SkMetaData.h"
8
9 #if defined(OS_MACOSX)
10 namespace {
11 const char kIsPreviewMetafileKey[] = "CrIsPreviewMetafile";
12 }
13 #endif
14
7 namespace cc { 15 namespace cc {
8 16
9 PaintCanvasPassThrough::PaintCanvasPassThrough(SkCanvas* canvas) 17 PaintCanvasPassThrough::PaintCanvasPassThrough(SkCanvas* canvas)
10 : SkNWayCanvas(canvas->getBaseLayerSize().width(), 18 : SkNWayCanvas(canvas->getBaseLayerSize().width(),
11 canvas->getBaseLayerSize().height()) { 19 canvas->getBaseLayerSize().height()) {
12 SkIRect raster_bounds; 20 SkIRect raster_bounds;
13 canvas->getDeviceClipBounds(&raster_bounds); 21 canvas->getDeviceClipBounds(&raster_bounds);
14 clipRect(SkRect::MakeFromIRect(raster_bounds)); 22 clipRect(SkRect::MakeFromIRect(raster_bounds));
15 setMatrix(canvas->getTotalMatrix()); 23 setMatrix(canvas->getTotalMatrix());
16 addCanvas(canvas); 24 addCanvas(canvas);
(...skipping 10 matching lines...) Expand all
27 void* pixels = canvas->accessTopLayerPixels(&info, &row_bytes); 35 void* pixels = canvas->accessTopLayerPixels(&info, &row_bytes);
28 if (!pixels) { 36 if (!pixels) {
29 output->reset(); 37 output->reset();
30 return false; 38 return false;
31 } 39 }
32 40
33 output->reset(info, pixels, row_bytes); 41 output->reset(info, pixels, row_bytes);
34 return true; 42 return true;
35 } 43 }
36 44
45 #if defined(OS_MACOSX)
46 void SetIsPreviewMetafile(PaintCanvas* canvas, bool is_preview) {
47 SkMetaData& meta = canvas->getMetaData();
48 meta.setBool(kIsPreviewMetafileKey, is_preview);
49 }
50
51 bool IsPreviewMetafile(PaintCanvas* canvas) {
52 bool value;
53 SkMetaData& meta = canvas->getMetaData();
54 if (!meta.findBool(kIsPreviewMetafileKey, &value))
55 value = false;
56 return value;
57 }
58 #endif
59
37 } // namespace cc 60 } // namespace cc
OLDNEW
« no previous file with comments | « cc/paint/paint_canvas.h ('k') | components/printing/renderer/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698