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. 4 5 #include "cc/test/fake_picture_layer_tiling_client.h" 6 7 #include <limits> 8 9 #include "cc/test/fake_tile_manager.h" 10 11 namespace cc { 12 13 FakePictureLayerTilingClient::FakePictureLayerTilingClient() 14 : tile_manager_(new FakeTileManager(&tile_manager_client_)), 15 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()), 16 twin_tiling_(NULL), 17 allow_create_tile_(true) {} 18 19 FakePictureLayerTilingClient::FakePictureLayerTilingClient( 20 ResourceProvider* resource_provider) 21 : tile_manager_( 22 new FakeTileManager(&tile_manager_client_, resource_provider)), 23 pile_(new FakeInfinitePicturePileImpl()), 24 twin_tiling_(NULL), 25 allow_create_tile_(true) {} 26 27 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() { 28 } 29 30 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( 31 PictureLayerTiling*, 32 gfx::Rect rect) { 33 if (!allow_create_tile_) 34 return scoped_refptr<Tile>(); 35 return tile_manager_->CreateTile( 36 pile_.get(), tile_size_, rect, gfx::Rect(), 1, 0, 0, Tile::USE_LCD_TEXT); 37 } 38 39 void FakePictureLayerTilingClient::SetTileSize(gfx::Size tile_size) { 40 tile_size_ = tile_size; 41 } 42 43 gfx::Size FakePictureLayerTilingClient::CalculateTileSize( 44 gfx::Size /* content_bounds */) const { 45 return tile_size_; 46 } 47 48 const Region* FakePictureLayerTilingClient::GetInvalidation() { 49 return &invalidation_; 50 } 51 52 const PictureLayerTiling* FakePictureLayerTilingClient::GetTwinTiling( 53 const PictureLayerTiling* tiling) const { 54 return twin_tiling_; 55 } 56 57 } // namespace cc 58