Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / compositor / paint_context.cc
blobaea2aec90134feb9521cf7a043bb1db1a1dfd999
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(cc::DisplayItemList* list,
13 float device_scale_factor,
14 const gfx::Rect& invalidation)
15 : list_(list),
16 owned_recorder_(new SkPictureRecorder),
17 recorder_(owned_recorder_.get()),
18 device_scale_factor_(device_scale_factor),
19 invalidation_(invalidation) {
20 #if DCHECK_IS_ON()
21 root_visited_ = nullptr;
22 inside_paint_recorder_ = false;
23 #endif
26 PaintContext::PaintContext(const PaintContext& other,
27 const gfx::Vector2d& offset)
28 : list_(other.list_),
29 owned_recorder_(nullptr),
30 recorder_(other.recorder_),
31 device_scale_factor_(other.device_scale_factor_),
32 invalidation_(other.invalidation_),
33 offset_(other.offset_ + offset) {
34 #if DCHECK_IS_ON()
35 root_visited_ = other.root_visited_;
36 inside_paint_recorder_ = other.inside_paint_recorder_;
37 #endif
40 PaintContext::PaintContext(const PaintContext& other,
41 CloneWithoutInvalidation c)
42 : list_(other.list_),
43 owned_recorder_(nullptr),
44 recorder_(other.recorder_),
45 device_scale_factor_(other.device_scale_factor_),
46 invalidation_(),
47 offset_(other.offset_) {
48 #if DCHECK_IS_ON()
49 root_visited_ = other.root_visited_;
50 inside_paint_recorder_ = other.inside_paint_recorder_;
51 #endif
54 PaintContext::~PaintContext() {
57 } // namespace ui