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

Side by Side Diff: cc/picture_layer_impl.cc

Issue 11678003: cc: Fix low-res impl-side painting artifacts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on latest patch Created 7 years, 11 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 | Annotate | Revision Log
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/picture_layer_impl.h" 5 #include "cc/picture_layer_impl.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "cc/append_quads_data.h" 8 #include "cc/append_quads_data.h"
9 #include "cc/checkerboard_draw_quad.h" 9 #include "cc/checkerboard_draw_quad.h"
10 #include "cc/debug_border_draw_quad.h" 10 #include "cc/debug_border_draw_quad.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void PictureLayerImpl::calculateContentsScale( 162 void PictureLayerImpl::calculateContentsScale(
163 float ideal_contents_scale, 163 float ideal_contents_scale,
164 float* contents_scale_x, 164 float* contents_scale_x,
165 float* contents_scale_y, 165 float* contents_scale_y,
166 gfx::Size* content_bounds) { 166 gfx::Size* content_bounds) {
167 if (!drawsContent()) { 167 if (!drawsContent()) {
168 DCHECK(!tilings_.num_tilings()); 168 DCHECK(!tilings_.num_tilings());
169 return; 169 return;
170 } 170 }
171 171
172 float min_contents_scale = layerTreeImpl()->settings().minimumContentsScale;
173 ideal_contents_scale = std::max(ideal_contents_scale, min_contents_scale);
174
172 ManageTilings(ideal_contents_scale); 175 ManageTilings(ideal_contents_scale);
173 176
174 // The content scale and bounds for a PictureLayerImpl is somewhat fictitious. 177 // The content scale and bounds for a PictureLayerImpl is somewhat fictitious.
175 // There are (usually) several tilings at different scales. However, the 178 // There are (usually) several tilings at different scales. However, the
176 // content bounds is the (integer!) space in which quads are generated. 179 // content bounds is the (integer!) space in which quads are generated.
177 // In order to guarantee that we can fill this integer space with any set of 180 // In order to guarantee that we can fill this integer space with any set of
178 // tilings (and then map back to floating point texture coordinates), the 181 // tilings (and then map back to floating point texture coordinates), the
179 // contents scale must be at least as large as the largest of the tilings. 182 // contents scale must be at least as large as the largest of the tilings.
180 float max_contents_scale = 1.f; 183 float max_contents_scale = min_contents_scale;
danakj 2013/01/07 20:24:02 ah, i see, cool
181 for (size_t i = 0; i < tilings_.num_tilings(); ++i) { 184 for (size_t i = 0; i < tilings_.num_tilings(); ++i) {
182 const PictureLayerTiling* tiling = tilings_.tiling_at(i); 185 const PictureLayerTiling* tiling = tilings_.tiling_at(i);
183 max_contents_scale = std::max(max_contents_scale, tiling->contents_scale()); 186 max_contents_scale = std::max(max_contents_scale, tiling->contents_scale());
184 } 187 }
185 188
186 *contents_scale_x = max_contents_scale; 189 *contents_scale_x = max_contents_scale;
187 *contents_scale_y = max_contents_scale; 190 *contents_scale_y = max_contents_scale;
188 *content_bounds = gfx::ToCeiledSize( 191 *content_bounds = gfx::ToCeiledSize(
189 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale)); 192 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale));
190 } 193 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 return 0; 247 return 0;
245 // Masks only supported if they fit on exactly one tile. 248 // Masks only supported if they fit on exactly one tile.
246 if (iter.geometry_rect() != content_rect) 249 if (iter.geometry_rect() != content_rect)
247 return 0; 250 return 0;
248 return iter->GetResourceId(); 251 return iter->GetResourceId();
249 } 252 }
250 return 0; 253 return 0;
251 } 254 }
252 255
253 void PictureLayerImpl::AddTiling(float contents_scale, gfx::Size tile_size) { 256 void PictureLayerImpl::AddTiling(float contents_scale, gfx::Size tile_size) {
257 if (contents_scale < layerTreeImpl()->settings().minimumContentsScale)
danakj 2013/01/07 20:24:02 should this be a dcheck? (having trouble seeing wh
258 return;
259
254 const PictureLayerTiling* tiling = tilings_.AddTiling( 260 const PictureLayerTiling* tiling = tilings_.AddTiling(
255 contents_scale, 261 contents_scale,
256 tile_size); 262 tile_size);
257 263
258 // If a new tiling is created on the active tree, sync it to the pending tree 264 // If a new tiling is created on the active tree, sync it to the pending tree
259 // so that it can share the same tiles. 265 // so that it can share the same tiles.
260 if (layerTreeImpl()->IsPendingTree()) 266 if (layerTreeImpl()->IsPendingTree())
261 return; 267 return;
262 268
263 PictureLayerImpl* pending_twin = static_cast<PictureLayerImpl*>( 269 PictureLayerImpl* pending_twin = static_cast<PictureLayerImpl*>(
(...skipping 23 matching lines...) Expand all
287 AddTiling(ideal_contents_scale, TileSize()); 293 AddTiling(ideal_contents_scale, TileSize());
288 // TODO(enne): Add a low-res tiling as well. 294 // TODO(enne): Add a low-res tiling as well.
289 } 295 }
290 } else { 296 } else {
291 // TODO(enne): This should be unnecessary once there are two trees. 297 // TODO(enne): This should be unnecessary once there are two trees.
292 tilings_.Reset(); 298 tilings_.Reset();
293 } 299 }
294 } 300 }
295 301
296 } // namespace cc 302 } // namespace cc
OLDNEW
« cc/layer_tree_settings.cc ('K') | « cc/picture_layer.cc ('k') | cc/picture_pile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698