1 // Copyright 2013 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_impl.h"
9 FakePictureLayerImpl::FakePictureLayerImpl(
10 LayerTreeImpl
* tree_impl
,
12 scoped_refptr
<PicturePileImpl
> pile
)
13 : PictureLayerImpl(tree_impl
, id
),
14 append_quads_count_(0) {
16 SetBounds(pile_
->size());
19 FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl
* tree_impl
, int id
)
20 : PictureLayerImpl(tree_impl
, id
), append_quads_count_(0) {}
22 scoped_ptr
<LayerImpl
> FakePictureLayerImpl::CreateLayerImpl(
23 LayerTreeImpl
* tree_impl
) {
24 return make_scoped_ptr(
25 new FakePictureLayerImpl(tree_impl
, id())).PassAs
<LayerImpl
>();
28 void FakePictureLayerImpl::AppendQuads(QuadSink
* quad_sink
,
29 AppendQuadsData
* append_quads_data
) {
30 PictureLayerImpl::AppendQuads(quad_sink
, append_quads_data
);
31 ++append_quads_count_
;
34 gfx::Size
FakePictureLayerImpl::CalculateTileSize(
35 gfx::Size content_bounds
) const {
36 if (fixed_tile_size_
.IsEmpty()) {
37 return PictureLayerImpl::CalculateTileSize(content_bounds
);
40 return fixed_tile_size_
;
43 PictureLayerTiling
* FakePictureLayerImpl::HighResTiling() const {
44 PictureLayerTiling
* result
= NULL
;
45 for (size_t i
= 0; i
< tilings_
->num_tilings(); ++i
) {
46 PictureLayerTiling
* tiling
= tilings_
->tiling_at(i
);
47 if (tiling
->resolution() == HIGH_RESOLUTION
) {
48 // There should be only one high res tiling.
56 PictureLayerTiling
* FakePictureLayerImpl::LowResTiling() const {
57 PictureLayerTiling
* result
= NULL
;
58 for (size_t i
= 0; i
< tilings_
->num_tilings(); ++i
) {
59 PictureLayerTiling
* tiling
= tilings_
->tiling_at(i
);
60 if (tiling
->resolution() == LOW_RESOLUTION
) {
61 // There should be only one low res tiling.