Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: cc/test/fake_picture_layer_tiling_client.cc

Issue 62283012: cc: Added tile bundles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/test/fake_picture_layer_tiling_client.h ('k') | cc/test/fake_tile_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/fake_picture_layer_tiling_client.h" 5 #include "cc/test/fake_picture_layer_tiling_client.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "cc/test/fake_tile_manager.h" 9 #include "cc/test/fake_tile_manager.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 class FakeInfinitePicturePileImpl : public PicturePileImpl { 13 class FakeInfinitePicturePileImpl : public PicturePileImpl {
14 public: 14 public:
15 FakeInfinitePicturePileImpl() { 15 FakeInfinitePicturePileImpl() {
16 gfx::Size size(std::numeric_limits<int>::max(), 16 gfx::Size size(std::numeric_limits<int>::max(),
17 std::numeric_limits<int>::max()); 17 std::numeric_limits<int>::max());
18 Resize(size); 18 Resize(size);
19 recorded_region_ = Region(gfx::Rect(size)); 19 recorded_region_ = Region(gfx::Rect(size));
20 } 20 }
21 21
22 protected: 22 protected:
23 virtual ~FakeInfinitePicturePileImpl() {} 23 virtual ~FakeInfinitePicturePileImpl() {}
24 }; 24 };
25 25
26 FakePictureLayerTilingClient::FakePictureLayerTilingClient() 26 FakePictureLayerTilingClient::FakePictureLayerTilingClient(
27 : tile_manager_(new FakeTileManager(&tile_manager_client_)), 27 TileManager* tile_manager)
28 : tile_manager_(tile_manager),
28 pile_(new FakeInfinitePicturePileImpl()), 29 pile_(new FakeInfinitePicturePileImpl()),
29 twin_tiling_(NULL), 30 twin_tiling_(NULL),
30 allow_create_tile_(true) {} 31 allow_create_tile_(true),
31 32 is_active_(false),
32 FakePictureLayerTilingClient::FakePictureLayerTilingClient( 33 is_pending_(false) {}
33 ResourceProvider* resource_provider)
34 : tile_manager_(
35 new FakeTileManager(&tile_manager_client_, resource_provider)),
36 pile_(new FakeInfinitePicturePileImpl()),
37 twin_tiling_(NULL),
38 allow_create_tile_(true) {}
39 34
40 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() { 35 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
41 } 36 }
42 37
43 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile( 38 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile(
44 PictureLayerTiling*, 39 PictureLayerTiling*,
45 gfx::Rect rect) { 40 gfx::Rect rect) {
46 if (!allow_create_tile_) 41 if (!allow_create_tile_)
47 return scoped_refptr<Tile>(); 42 return scoped_refptr<Tile>();
48 return tile_manager_->CreateTile( 43 return tile_manager()->CreateTile(
49 pile_.get(), tile_size_, rect, gfx::Rect(), 1, 0, 0, Tile::USE_LCD_TEXT); 44 pile_.get(), tile_size_, rect, gfx::Rect(), 1, 0, 0, Tile::USE_LCD_TEXT);
50 } 45 }
51 46
47 scoped_refptr<TileBundle> FakePictureLayerTilingClient::CreateTileBundle(
48 int offset_x,
49 int offset_y,
50 int width,
51 int height) {
52 return tile_manager()->CreateTileBundle(offset_x, offset_y, width, height);
53 }
54
52 void FakePictureLayerTilingClient::SetTileSize(gfx::Size tile_size) { 55 void FakePictureLayerTilingClient::SetTileSize(gfx::Size tile_size) {
53 tile_size_ = tile_size; 56 tile_size_ = tile_size;
54 } 57 }
55 58
56 gfx::Size FakePictureLayerTilingClient::CalculateTileSize( 59 gfx::Size FakePictureLayerTilingClient::CalculateTileSize(
57 gfx::Size /* content_bounds */) const { 60 gfx::Size /* content_bounds */) const {
58 return tile_size_; 61 return tile_size_;
59 } 62 }
60 63
61 const Region* FakePictureLayerTilingClient::GetInvalidation() { 64 const Region* FakePictureLayerTilingClient::GetInvalidation() {
62 return &invalidation_; 65 return &invalidation_;
63 } 66 }
64 67
65 const PictureLayerTiling* FakePictureLayerTilingClient::GetTwinTiling( 68 const PictureLayerTiling* FakePictureLayerTilingClient::GetTwinTiling(
66 const PictureLayerTiling* tiling) const { 69 const PictureLayerTiling* tiling) const {
67 return twin_tiling_; 70 return twin_tiling_;
68 } 71 }
69 72
70 } // namespace cc 73 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_picture_layer_tiling_client.h ('k') | cc/test/fake_tile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698