cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / cc / test / fake_picture_layer_tiling_client.cc
blob4127b017d404330f7a4808ca0b3c1f7957d53dd7
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_tile_manager.h"
11 namespace cc {
13 class FakeInfinitePicturePileImpl : public PicturePileImpl {
14 public:
15 FakeInfinitePicturePileImpl() {
16 gfx::Size size(std::numeric_limits<int>::max(),
17 std::numeric_limits<int>::max());
18 Resize(size);
19 recorded_region_ = Region(gfx::Rect(size));
22 protected:
23 virtual ~FakeInfinitePicturePileImpl() {}
26 FakePictureLayerTilingClient::FakePictureLayerTilingClient()
27 : tile_manager_(new FakeTileManager(&tile_manager_client_)),
28 pile_(new FakeInfinitePicturePileImpl()),
29 twin_tiling_(NULL),
30 allow_create_tile_(true) {}
32 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
35 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile(
36 PictureLayerTiling*,
37 gfx::Rect rect) {
38 if (!allow_create_tile_)
39 return NULL;
40 return new Tile(tile_manager_.get(),
41 pile_.get(),
42 tile_size_,
43 rect,
44 gfx::Rect(),
48 true);
51 void FakePictureLayerTilingClient::SetTileSize(gfx::Size tile_size) {
52 tile_size_ = tile_size;
55 gfx::Size FakePictureLayerTilingClient::CalculateTileSize(
56 gfx::Size /* content_bounds */) const {
57 return tile_size_;
60 const Region* FakePictureLayerTilingClient::GetInvalidation() {
61 return &invalidation_;
64 const PictureLayerTiling* FakePictureLayerTilingClient::GetTwinTiling(
65 const PictureLayerTiling* tiling) {
66 return twin_tiling_;
69 } // namespace cc