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_content_layer.h"
7 #include "cc/resources/prioritized_resource.h"
8 #include "cc/test/fake_content_layer_impl.h"
12 FakeContentLayer::FakeContentLayer(ContentLayerClient
* client
)
13 : ContentLayer(client
),
15 push_properties_count_(0),
16 always_update_resources_(false) {
17 SetAnchorPoint(gfx::PointF(0.f
, 0.f
));
18 SetBounds(gfx::Size(1, 1));
22 FakeContentLayer::~FakeContentLayer() {}
24 scoped_ptr
<LayerImpl
> FakeContentLayer::CreateLayerImpl(
25 LayerTreeImpl
* tree_impl
) {
26 return FakeContentLayerImpl::Create(tree_impl
, layer_id_
).PassAs
<LayerImpl
>();
29 bool FakeContentLayer::Update(ResourceUpdateQueue
* queue
,
30 const OcclusionTracker
* occlusion
) {
31 bool updated
= ContentLayer::Update(queue
, occlusion
);
33 return updated
|| always_update_resources_
;
36 void FakeContentLayer::PushPropertiesTo(LayerImpl
* layer
) {
37 ContentLayer::PushPropertiesTo(layer
);
38 push_properties_count_
++;
41 bool FakeContentLayer::HaveBackingAt(int i
, int j
) {
42 const PrioritizedResource
* resource
= ResourceAtForTesting(i
, j
);
43 return resource
&& resource
->have_backing_texture();