mac: Add the flag "-gline-tables-only" to reduce dSYM size. (attempt #2)
[chromium-blink-merge.git] / ui / compositor / paint_context.cc
blob804a494b48e6c893770510e71ecc276e3b579870
1 // Copyright 2015 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.
5 #include "ui/compositor/paint_context.h"
7 #include "third_party/skia/include/core/SkPictureRecorder.h"
8 #include "ui/gfx/canvas.h"
10 namespace ui {
12 PaintContext::PaintContext(gfx::Canvas* canvas, const gfx::Rect& invalidation)
13 : canvas_(canvas),
14 list_(nullptr),
15 device_scale_factor_(canvas->image_scale()),
16 bounds_(invalidation),
17 invalidation_(invalidation) {
18 #if DCHECK_IS_ON()
19 root_visited_ = nullptr;
20 inside_paint_recorder_ = false;
21 #endif
24 PaintContext::PaintContext(cc::DisplayItemList* list,
25 float device_scale_factor,
26 const gfx::Rect& bounds,
27 const gfx::Rect& invalidation)
28 : canvas_(nullptr),
29 list_(list),
30 recorder_(new SkPictureRecorder),
31 device_scale_factor_(device_scale_factor),
32 bounds_(bounds),
33 invalidation_(invalidation) {
34 #if DCHECK_IS_ON()
35 root_visited_ = nullptr;
36 inside_paint_recorder_ = false;
37 #endif
40 PaintContext::PaintContext(gfx::Canvas* canvas)
41 : PaintContext(canvas, gfx::Rect()) {
44 PaintContext::PaintContext(const PaintContext& other)
45 : canvas_(other.canvas_),
46 list_(other.list_),
47 // The SkPictureRecorder doesn't hold state, it is only held on the
48 // PaintContext as an optimization for fewer allocations. So we can just
49 // make a new one here.
50 recorder_(new SkPictureRecorder),
51 device_scale_factor_(other.device_scale_factor_),
52 bounds_(other.bounds_),
53 invalidation_(other.invalidation_),
54 offset_(other.offset_) {
55 #if DCHECK_IS_ON()
56 root_visited_ = other.root_visited_;
57 inside_paint_recorder_ = other.inside_paint_recorder_;
58 #endif
61 PaintContext::PaintContext(const PaintContext& other,
62 const gfx::Vector2d& offset)
63 : PaintContext(other) {
64 offset_ += offset;
67 PaintContext::~PaintContext() {
70 } // namespace ui