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"
12 PaintContext::PaintContext(cc::DisplayItemList
* list
,
13 float device_scale_factor
,
14 const gfx::Rect
& invalidation
)
16 owned_recorder_(new SkPictureRecorder
),
17 recorder_(owned_recorder_
.get()),
18 device_scale_factor_(device_scale_factor
),
19 invalidation_(invalidation
) {
21 root_visited_
= nullptr;
22 inside_paint_recorder_
= false;
26 PaintContext::PaintContext(const PaintContext
& other
,
27 const gfx::Vector2d
& offset
)
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
) {
35 root_visited_
= other
.root_visited_
;
36 inside_paint_recorder_
= other
.inside_paint_recorder_
;
40 PaintContext::PaintContext(const PaintContext
& other
,
41 CloneWithoutInvalidation c
)
43 owned_recorder_(nullptr),
44 recorder_(other
.recorder_
),
45 device_scale_factor_(other
.device_scale_factor_
),
47 offset_(other
.offset_
) {
49 root_visited_
= other
.root_visited_
;
50 inside_paint_recorder_
= other
.inside_paint_recorder_
;
54 PaintContext::~PaintContext() {