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
& bounds
,
15 const gfx::Rect
& invalidation
)
17 owned_recorder_(new SkPictureRecorder
),
18 recorder_(owned_recorder_
.get()),
19 device_scale_factor_(device_scale_factor
),
21 invalidation_(invalidation
) {
23 root_visited_
= nullptr;
24 inside_paint_recorder_
= false;
28 PaintContext::PaintContext(const PaintContext
& other
,
29 const gfx::Vector2d
& offset
)
31 owned_recorder_(nullptr),
32 recorder_(other
.recorder_
),
33 device_scale_factor_(other
.device_scale_factor_
),
34 bounds_(other
.bounds_
),
35 invalidation_(other
.invalidation_
),
36 offset_(other
.offset_
+ offset
) {
38 root_visited_
= other
.root_visited_
;
39 inside_paint_recorder_
= other
.inside_paint_recorder_
;
43 PaintContext::PaintContext(const PaintContext
& other
,
44 CloneWithoutInvalidation c
)
46 owned_recorder_(nullptr),
47 recorder_(other
.recorder_
),
48 device_scale_factor_(other
.device_scale_factor_
),
49 bounds_(other
.bounds_
),
51 offset_(other
.offset_
) {
53 root_visited_
= other
.root_visited_
;
54 inside_paint_recorder_
= other
.inside_paint_recorder_
;
58 PaintContext::~PaintContext() {