Lots of random cleanups, mostly for native_theme_win.cc:
[chromium-blink-merge.git] / cc / test / fake_picture_layer_tiling_client.cc
blob7834bc0362774f946a188a638437a8545c51d7d2
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 allow_create_tile_(true),
19 max_tiles_for_interest_area_(10000),
20 skewport_target_time_in_seconds_(1.0f),
21 skewport_extrapolation_limit_in_content_pixels_(2000) {}
23 FakePictureLayerTilingClient::FakePictureLayerTilingClient(
24 ResourceProvider* resource_provider)
25 : resource_pool_(
26 ResourcePool::Create(resource_provider, GL_TEXTURE_2D, RGBA_8888)),
27 tile_manager_(
28 new FakeTileManager(&tile_manager_client_, resource_pool_.get())),
29 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
30 twin_tiling_(NULL),
31 allow_create_tile_(true),
32 max_tiles_for_interest_area_(10000),
33 skewport_target_time_in_seconds_(1.0f) {}
35 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
38 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile(
39 PictureLayerTiling*,
40 const gfx::Rect& rect) {
41 if (!allow_create_tile_)
42 return scoped_refptr<Tile>();
43 return tile_manager_->CreateTile(
44 pile_.get(), tile_size_, rect, gfx::Rect(), 1, 0, 0, 0);
47 PicturePileImpl* FakePictureLayerTilingClient::GetPile() {
48 return pile_.get();
51 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) {
52 tile_size_ = tile_size;
55 gfx::Size FakePictureLayerTilingClient::CalculateTileSize(
56 const gfx::Size& /* content_bounds */) const {
57 return tile_size_;
60 size_t FakePictureLayerTilingClient::GetMaxTilesForInterestArea() const {
61 return max_tiles_for_interest_area_;
64 float FakePictureLayerTilingClient::GetSkewportTargetTimeInSeconds() const {
65 return skewport_target_time_in_seconds_;
68 int FakePictureLayerTilingClient::GetSkewportExtrapolationLimitInContentPixels()
69 const {
70 return skewport_extrapolation_limit_in_content_pixels_;
73 const Region* FakePictureLayerTilingClient::GetInvalidation() {
74 return &invalidation_;
77 const PictureLayerTiling* FakePictureLayerTilingClient::GetTwinTiling(
78 const PictureLayerTiling* tiling) const {
79 return twin_tiling_;
82 } // namespace cc