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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 913393004: Revert of cc: Make PaintedScrollbarLayer not use ContentsScalingLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 render_pass, bounds(), shared_quad_state, append_quads_data); 172 render_pass, bounds(), shared_quad_state, append_quads_data);
173 173
174 SolidColorLayerImpl::AppendSolidQuads( 174 SolidColorLayerImpl::AppendSolidQuads(
175 render_pass, occlusion_in_content_space, shared_quad_state, 175 render_pass, occlusion_in_content_space, shared_quad_state,
176 visible_content_rect(), raster_source_->GetSolidColor(), 176 visible_content_rect(), raster_source_->GetSolidColor(),
177 append_quads_data); 177 append_quads_data);
178 return; 178 return;
179 } 179 }
180 180
181 float max_contents_scale = MaximumTilingContentsScale(); 181 float max_contents_scale = MaximumTilingContentsScale();
182 PopulateScaledSharedQuadState(shared_quad_state, max_contents_scale); 182 gfx::Transform scaled_draw_transform = draw_transform();
183 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale,
184 SK_MScalar1 / max_contents_scale);
185 gfx::Size scaled_content_bounds =
186 gfx::ToCeiledSize(gfx::ScaleSize(bounds(), max_contents_scale));
187 gfx::Rect scaled_visible_content_rect =
188 gfx::ScaleToEnclosingRect(visible_content_rect(), max_contents_scale);
189 scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds));
183 Occlusion scaled_occlusion = 190 Occlusion scaled_occlusion =
184 occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( 191 occlusion_in_content_space.GetOcclusionWithGivenDrawTransform(
185 shared_quad_state->content_to_target_transform); 192 scaled_draw_transform);
193
194 shared_quad_state->SetAll(
195 scaled_draw_transform, scaled_content_bounds, scaled_visible_content_rect,
196 draw_properties().clip_rect, draw_properties().is_clipped,
197 draw_properties().opacity, draw_properties().blend_mode,
198 sorting_context_id_);
186 199
187 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { 200 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) {
188 AppendDebugBorderQuad( 201 AppendDebugBorderQuad(
189 render_pass, shared_quad_state->content_bounds, shared_quad_state, 202 render_pass,
190 append_quads_data, DebugColors::DirectPictureBorderColor(), 203 scaled_content_bounds,
204 shared_quad_state,
205 append_quads_data,
206 DebugColors::DirectPictureBorderColor(),
191 DebugColors::DirectPictureBorderWidth(layer_tree_impl())); 207 DebugColors::DirectPictureBorderWidth(layer_tree_impl()));
192 208
193 gfx::Rect geometry_rect = shared_quad_state->visible_content_rect; 209 gfx::Rect geometry_rect = scaled_visible_content_rect;
194 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); 210 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect();
195 gfx::Rect visible_geometry_rect = 211 gfx::Rect visible_geometry_rect =
196 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); 212 scaled_occlusion.GetUnoccludedContentRect(geometry_rect);
197 if (visible_geometry_rect.IsEmpty()) 213 if (visible_geometry_rect.IsEmpty())
198 return; 214 return;
199 215
200 gfx::Rect quad_content_rect = shared_quad_state->visible_content_rect; 216 gfx::Size texture_size = scaled_visible_content_rect.size();
201 gfx::Size texture_size = quad_content_rect.size();
202 gfx::RectF texture_rect = gfx::RectF(texture_size); 217 gfx::RectF texture_rect = gfx::RectF(texture_size);
218 gfx::Rect quad_content_rect = scaled_visible_content_rect;
203 219
204 PictureDrawQuad* quad = 220 PictureDrawQuad* quad =
205 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); 221 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>();
206 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, 222 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect,
207 visible_geometry_rect, texture_rect, texture_size, 223 visible_geometry_rect, texture_rect, texture_size,
208 nearest_neighbor_, RGBA_8888, quad_content_rect, 224 nearest_neighbor_, RGBA_8888, quad_content_rect,
209 max_contents_scale, raster_source_); 225 max_contents_scale, raster_source_);
210 return; 226 return;
211 } 227 }
212 228
213 AppendDebugBorderQuad(render_pass, shared_quad_state->content_bounds, 229 AppendDebugBorderQuad(
214 shared_quad_state, append_quads_data); 230 render_pass, scaled_content_bounds, shared_quad_state, append_quads_data);
215 231
216 if (ShowDebugBorders()) { 232 if (ShowDebugBorders()) {
217 for (PictureLayerTilingSet::CoverageIterator iter( 233 for (PictureLayerTilingSet::CoverageIterator iter(
218 tilings_.get(), max_contents_scale, 234 tilings_.get(),
219 shared_quad_state->visible_content_rect, ideal_contents_scale_); 235 max_contents_scale,
220 iter; ++iter) { 236 scaled_visible_content_rect,
237 ideal_contents_scale_);
238 iter;
239 ++iter) {
221 SkColor color; 240 SkColor color;
222 float width; 241 float width;
223 if (*iter && iter->IsReadyToDraw()) { 242 if (*iter && iter->IsReadyToDraw()) {
224 TileDrawInfo::Mode mode = iter->draw_info().mode(); 243 TileDrawInfo::Mode mode = iter->draw_info().mode();
225 if (mode == TileDrawInfo::SOLID_COLOR_MODE) { 244 if (mode == TileDrawInfo::SOLID_COLOR_MODE) {
226 color = DebugColors::SolidColorTileBorderColor(); 245 color = DebugColors::SolidColorTileBorderColor();
227 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); 246 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl());
228 } else if (mode == TileDrawInfo::PICTURE_PILE_MODE) { 247 } else if (mode == TileDrawInfo::PICTURE_PILE_MODE) {
229 color = DebugColors::PictureTileBorderColor(); 248 color = DebugColors::PictureTileBorderColor();
230 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); 249 width = DebugColors::PictureTileBorderWidth(layer_tree_impl());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 283
265 // Ignore missing tiles outside of viewport for tile priority. This is 284 // Ignore missing tiles outside of viewport for tile priority. This is
266 // normally the same as draw viewport but can be independently overridden by 285 // normally the same as draw viewport but can be independently overridden by
267 // embedders like Android WebView with SetExternalDrawConstraints. 286 // embedders like Android WebView with SetExternalDrawConstraints.
268 gfx::Rect scaled_viewport_for_tile_priority = gfx::ScaleToEnclosingRect( 287 gfx::Rect scaled_viewport_for_tile_priority = gfx::ScaleToEnclosingRect(
269 viewport_rect_for_tile_priority_in_content_space_, max_contents_scale); 288 viewport_rect_for_tile_priority_in_content_space_, max_contents_scale);
270 289
271 size_t missing_tile_count = 0u; 290 size_t missing_tile_count = 0u;
272 size_t on_demand_missing_tile_count = 0u; 291 size_t on_demand_missing_tile_count = 0u;
273 only_used_low_res_last_append_quads_ = true; 292 only_used_low_res_last_append_quads_ = true;
274 for (PictureLayerTilingSet::CoverageIterator iter( 293 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(),
275 tilings_.get(), max_contents_scale, 294 max_contents_scale,
276 shared_quad_state->visible_content_rect, ideal_contents_scale_); 295 scaled_visible_content_rect,
277 iter; ++iter) { 296 ideal_contents_scale_);
297 iter;
298 ++iter) {
278 gfx::Rect geometry_rect = iter.geometry_rect(); 299 gfx::Rect geometry_rect = iter.geometry_rect();
279 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); 300 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect();
280 gfx::Rect visible_geometry_rect = 301 gfx::Rect visible_geometry_rect =
281 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); 302 scaled_occlusion.GetUnoccludedContentRect(geometry_rect);
282 if (visible_geometry_rect.IsEmpty()) 303 if (visible_geometry_rect.IsEmpty())
283 continue; 304 continue;
284 305
285 append_quads_data->visible_content_area += 306 append_quads_data->visible_content_area +=
286 visible_geometry_rect.width() * visible_geometry_rect.height(); 307 visible_geometry_rect.width() * visible_geometry_rect.height();
287 308
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 1233
1213 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1234 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1214 return !layer_tree_impl()->IsRecycleTree(); 1235 return !layer_tree_impl()->IsRecycleTree();
1215 } 1236 }
1216 1237
1217 bool PictureLayerImpl::HasValidTilePriorities() const { 1238 bool PictureLayerImpl::HasValidTilePriorities() const {
1218 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); 1239 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember();
1219 } 1240 }
1220 1241
1221 } // namespace cc 1242 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/painted_scrollbar_layer_impl_unittest.cc ('k') | cc/layers/scrollbar_layer_impl_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698