1 // Copyright 2012 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 "cc/test/fake_picture_layer.h"
7 #include "cc/test/fake_picture_layer_impl.h"
11 FakePictureLayer::FakePictureLayer(const LayerSettings
& settings
,
12 ContentLayerClient
* client
)
13 : PictureLayer(settings
, client
),
15 push_properties_count_(0),
16 output_surface_created_count_(0),
17 always_update_resources_(false),
18 disable_lcd_text_(false) {
19 SetBounds(gfx::Size(1, 1));
23 FakePictureLayer::FakePictureLayer(const LayerSettings
& settings
,
24 ContentLayerClient
* client
,
25 scoped_ptr
<RecordingSource
> source
)
26 : PictureLayer(settings
, client
, source
.Pass()),
28 push_properties_count_(0),
29 output_surface_created_count_(0),
30 always_update_resources_(false),
31 disable_lcd_text_(false) {
32 SetBounds(gfx::Size(1, 1));
36 FakePictureLayer::~FakePictureLayer() {}
38 scoped_ptr
<LayerImpl
> FakePictureLayer::CreateLayerImpl(
39 LayerTreeImpl
* tree_impl
) {
41 return FakePictureLayerImpl::CreateMask(tree_impl
, layer_id_
);
42 return FakePictureLayerImpl::Create(tree_impl
, layer_id_
);
45 bool FakePictureLayer::Update() {
46 if (disable_lcd_text_
)
47 draw_properties().can_use_lcd_text
= false;
48 bool updated
= PictureLayer::Update();
50 return updated
|| always_update_resources_
;
53 void FakePictureLayer::PushPropertiesTo(LayerImpl
* layer
) {
54 PictureLayer::PushPropertiesTo(layer
);
55 push_properties_count_
++;
58 void FakePictureLayer::OnOutputSurfaceCreated() {
59 PictureLayer::OnOutputSurfaceCreated();
60 output_surface_created_count_
++;