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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 months 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
« no previous file with comments | « cc/test/fake_picture_pile.h ('k') | cc/test/fake_tile_manager.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_pile_impl.h" 5 #include "cc/test/fake_picture_pile_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 14 matching lines...) Expand all
25 : PicturePileImpl(other), 25 : PicturePileImpl(other),
26 playback_allowed_event_(playback_allowed_event), 26 playback_allowed_event_(playback_allowed_event),
27 tile_grid_size_(other->GetTileGridSizeForTesting()) { 27 tile_grid_size_(other->GetTileGridSizeForTesting()) {
28 } 28 }
29 29
30 FakePicturePileImpl::~FakePicturePileImpl() {} 30 FakePicturePileImpl::~FakePicturePileImpl() {}
31 31
32 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile( 32 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile(
33 const gfx::Size& tile_size, 33 const gfx::Size& tile_size,
34 const gfx::Size& layer_bounds) { 34 const gfx::Size& layer_bounds) {
35 FakePicturePile pile; 35 FakePicturePile pile(ImplSidePaintingSettings().minimum_contents_scale,
36 ImplSidePaintingSettings().default_tile_grid_size);
37 pile.tiling().SetBorderTexels(0);
36 pile.tiling().SetTilingSize(layer_bounds); 38 pile.tiling().SetTilingSize(layer_bounds);
37 pile.tiling().SetMaxTextureSize(tile_size); 39 pile.tiling().SetMaxTextureSize(tile_size);
38 pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size);
39 pile.SetRecordedViewport(gfx::Rect(layer_bounds)); 40 pile.SetRecordedViewport(gfx::Rect(layer_bounds));
40 pile.SetHasAnyRecordings(true); 41 pile.SetHasAnyRecordings(true);
41 42
42 scoped_refptr<FakePicturePileImpl> pile_impl( 43 scoped_refptr<FakePicturePileImpl> pile_impl(
43 new FakePicturePileImpl(&pile, nullptr)); 44 new FakePicturePileImpl(&pile, nullptr));
44 for (int x = 0; x < pile_impl->tiling().num_tiles_x(); ++x) { 45 for (int x = 0; x < pile_impl->tiling().num_tiles_x(); ++x) {
45 for (int y = 0; y < pile_impl->tiling().num_tiles_y(); ++y) 46 for (int y = 0; y < pile_impl->tiling().num_tiles_y(); ++y)
46 pile_impl->AddRecordingAt(x, y); 47 pile_impl->AddRecordingAt(x, y);
47 } 48 }
48 return pile_impl; 49 return pile_impl;
49 } 50 }
50 51
51 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( 52 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile(
52 const gfx::Size& tile_size, 53 const gfx::Size& tile_size,
53 const gfx::Size& layer_bounds) { 54 const gfx::Size& layer_bounds) {
54 FakePicturePile pile; 55 FakePicturePile pile(ImplSidePaintingSettings().minimum_contents_scale,
56 ImplSidePaintingSettings().default_tile_grid_size);
57 pile.tiling().SetBorderTexels(0);
55 pile.tiling().SetTilingSize(layer_bounds); 58 pile.tiling().SetTilingSize(layer_bounds);
56 pile.tiling().SetMaxTextureSize(tile_size); 59 pile.tiling().SetMaxTextureSize(tile_size);
57 pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size);
58 pile.SetRecordedViewport(gfx::Rect()); 60 pile.SetRecordedViewport(gfx::Rect());
59 pile.SetHasAnyRecordings(false); 61 pile.SetHasAnyRecordings(false);
60 return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr)); 62 return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr));
61 } 63 }
62 64
63 scoped_refptr<FakePicturePileImpl> 65 scoped_refptr<FakePicturePileImpl>
64 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( 66 FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
65 const gfx::Size& tile_size, 67 const gfx::Size& tile_size,
66 const gfx::Size& layer_bounds) { 68 const gfx::Size& layer_bounds) {
67 FakePicturePile pile; 69 FakePicturePile pile(ImplSidePaintingSettings().minimum_contents_scale,
70 ImplSidePaintingSettings().default_tile_grid_size);
71 pile.tiling().SetBorderTexels(0);
68 pile.tiling().SetTilingSize(layer_bounds); 72 pile.tiling().SetTilingSize(layer_bounds);
69 pile.tiling().SetMaxTextureSize(tile_size); 73 pile.tiling().SetMaxTextureSize(tile_size);
70 pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size);
71 // This simulates a false positive for this flag. 74 // This simulates a false positive for this flag.
72 pile.SetRecordedViewport(gfx::Rect()); 75 pile.SetRecordedViewport(gfx::Rect());
73 pile.SetHasAnyRecordings(true); 76 pile.SetHasAnyRecordings(true);
74 return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr)); 77 return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr));
75 } 78 }
76 79
77 scoped_refptr<FakePicturePileImpl> 80 scoped_refptr<FakePicturePileImpl>
78 FakePicturePileImpl::CreateInfiniteFilledPile() { 81 FakePicturePileImpl::CreateInfiniteFilledPile() {
79 FakePicturePile pile;
80 gfx::Size size(std::numeric_limits<int>::max(), 82 gfx::Size size(std::numeric_limits<int>::max(),
81 std::numeric_limits<int>::max()); 83 std::numeric_limits<int>::max());
84 FakePicturePile pile(ImplSidePaintingSettings().minimum_contents_scale, size);
85 pile.tiling().SetBorderTexels(0);
82 pile.tiling().SetTilingSize(size); 86 pile.tiling().SetTilingSize(size);
83 pile.tiling().SetMaxTextureSize(size); 87 pile.tiling().SetMaxTextureSize(size);
84 pile.SetTileGridSize(size);
85 pile.SetRecordedViewport(gfx::Rect(size)); 88 pile.SetRecordedViewport(gfx::Rect(size));
86 pile.SetHasAnyRecordings(true); 89 pile.SetHasAnyRecordings(true);
87 90
88 scoped_refptr<FakePicturePileImpl> pile_impl( 91 scoped_refptr<FakePicturePileImpl> pile_impl(
89 new FakePicturePileImpl(&pile, nullptr)); 92 new FakePicturePileImpl(&pile, nullptr));
90 pile_impl->AddRecordingAt(0, 0); 93 pile_impl->AddRecordingAt(0, 0);
91 return pile_impl; 94 return pile_impl;
92 } 95 }
93 96
94 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFromPile( 97 scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFromPile(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 Clear(); 183 Clear();
181 tiling_.SetBorderTexels(new_buffer_pixels); 184 tiling_.SetBorderTexels(new_buffer_pixels);
182 } 185 }
183 186
184 void FakePicturePileImpl::Clear() { 187 void FakePicturePileImpl::Clear() {
185 picture_map_.clear(); 188 picture_map_.clear();
186 recorded_viewport_ = gfx::Rect(); 189 recorded_viewport_ = gfx::Rect();
187 } 190 }
188 191
189 } // namespace cc 192 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_picture_pile.h ('k') | cc/test/fake_tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698