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

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

Issue 2686033005: Move metafile printing code from platform canvas to PaintCanvas (Closed)
Patch Set: 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
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 #if defined(OS_MACOSX)
8 namespace {
9 const char kIsPreviewMetafileKey[] = "CrIsPreviewMetafile";
10 }
11 #endif
12
7 namespace cc { 13 namespace cc {
8 14
9 PaintCanvasPassThrough::PaintCanvasPassThrough(SkCanvas* canvas) 15 PaintCanvasPassThrough::PaintCanvasPassThrough(SkCanvas* canvas)
10 : SkNWayCanvas(canvas->getBaseLayerSize().width(), 16 : SkNWayCanvas(canvas->getBaseLayerSize().width(),
11 canvas->getBaseLayerSize().height()) { 17 canvas->getBaseLayerSize().height()) {
12 SkIRect raster_bounds; 18 SkIRect raster_bounds;
13 canvas->getDeviceClipBounds(&raster_bounds); 19 canvas->getDeviceClipBounds(&raster_bounds);
14 clipRect(SkRect::MakeFromIRect(raster_bounds)); 20 clipRect(SkRect::MakeFromIRect(raster_bounds));
15 setMatrix(canvas->getTotalMatrix()); 21 setMatrix(canvas->getTotalMatrix());
16 addCanvas(canvas); 22 addCanvas(canvas);
(...skipping 14 matching lines...) Expand all
31 void* pixels = canvas->accessTopLayerPixels(&info, &row_bytes); 37 void* pixels = canvas->accessTopLayerPixels(&info, &row_bytes);
32 if (!pixels) { 38 if (!pixels) {
33 output->reset(); 39 output->reset();
34 return false; 40 return false;
35 } 41 }
36 42
37 output->reset(info, pixels, row_bytes); 43 output->reset(info, pixels, row_bytes);
38 return true; 44 return true;
39 } 45 }
40 46
47 #if defined(OS_MACOSX)
48 void SetIsPreviewMetafile(PaintCanvas* canvas, bool is_preview) {
49 SkMetaData& meta = canvas->getMetaData();
50 meta.setBool(kIsPreviewMetafileKey, is_preview);
51 }
52
53 bool IsPreviewMetafile(PaintCanvas* canvas) {
54 bool value;
55 SkMetaData& meta = canvas->getMetaData();
56 if (!meta.findBool(kIsPreviewMetafileKey, &value))
57 value = false;
58 return value;
59 }
60 #endif
61
41 } // namespace cc 62 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698