[NaCl SDK]: use standard __BEGIN_DECLS macros in sys/select.h
[chromium-blink-merge.git] / cc / test / fake_picture_layer_tiling_client.cc
blob0503d22ad65348917759fe4b43050c6a8b7765a9
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_tiling_client.h"
7 #include <limits>
9 #include "cc/test/fake_picture_pile_impl.h"
10 #include "cc/test/fake_tile_manager.h"
12 namespace cc {
14 FakePictureLayerTilingClient::FakePictureLayerTilingClient()
15 : tile_manager_(new FakeTileManager(&tile_manager_client_)),
16 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
17 twin_tiling_(NULL),
18 recycled_twin_tiling_(NULL),
19 allow_create_tile_(true),
20 max_tiles_for_interest_area_(10000),
21 skewport_target_time_in_seconds_(1.0f),
22 skewport_extrapolation_limit_in_content_pixels_(2000) {
25 FakePictureLayerTilingClient::FakePictureLayerTilingClient(
26 ResourceProvider* resource_provider)
27 : resource_pool_(
28 ResourcePool::Create(resource_provider, GL_TEXTURE_2D, RGBA_8888)),
29 tile_manager_(
30 new FakeTileManager(&tile_manager_client_, resource_pool_.get())),
31 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
32 twin_tiling_(NULL),
33 recycled_twin_tiling_(NULL),
34 allow_create_tile_(true),
35 max_tiles_for_interest_area_(10000),
36 skewport_target_time_in_seconds_(1.0f) {
39 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
42 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile(
43 PictureLayerTiling*,
44 const gfx::Rect& rect) {
45 if (!allow_create_tile_)
46 return scoped_refptr<Tile>();
47 return tile_manager_->CreateTile(
48 pile_.get(), tile_size_, rect, gfx::Rect(), 1, 0, 0, 0);
51 PicturePileImpl* FakePictureLayerTilingClient::GetPile() {
52 return pile_.get();
55 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) {
56 tile_size_ = tile_size;
59 gfx::Size FakePictureLayerTilingClient::CalculateTileSize(
60 const gfx::Size& /* content_bounds */) const {
61 return tile_size_;
64 size_t FakePictureLayerTilingClient::GetMaxTilesForInterestArea() const {
65 return max_tiles_for_interest_area_;
68 float FakePictureLayerTilingClient::GetSkewportTargetTimeInSeconds() const {
69 return skewport_target_time_in_seconds_;
72 int FakePictureLayerTilingClient::GetSkewportExtrapolationLimitInContentPixels()
73 const {
74 return skewport_extrapolation_limit_in_content_pixels_;
77 const Region* FakePictureLayerTilingClient::GetInvalidation() {
78 return &invalidation_;
81 const PictureLayerTiling* FakePictureLayerTilingClient::GetTwinTiling(
82 const PictureLayerTiling* tiling) const {
83 return twin_tiling_;
86 PictureLayerTiling* FakePictureLayerTilingClient::GetRecycledTwinTiling(
87 const PictureLayerTiling* tiling) {
88 return recycled_twin_tiling_;
91 WhichTree FakePictureLayerTilingClient::GetTree() const {
92 return tree_;
95 } // namespace cc