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

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

Issue 2817833002: Replacing ScaleToEnclosedRect with ScaleToEnclosingRect (Closed)
Patch Set: Modified unit test to add test case that would fail without this patch Created 3 years, 7 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 | « no previous file | cc/layers/surface_layer_impl_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/surface_layer_impl.h" 5 #include "cc/layers/surface_layer_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/trace_event/trace_event_argument.h" 9 #include "base/trace_event/trace_event_argument.h"
10 #include "cc/debug/debug_colors.h" 10 #include "cc/debug/debug_colors.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 static_cast<float>(surface_info.size_in_pixels().width()) / 110 static_cast<float>(surface_info.size_in_pixels().width()) /
111 bounds().width(); 111 bounds().width();
112 layer_to_content_scale_y = 112 layer_to_content_scale_y =
113 static_cast<float>(surface_info.size_in_pixels().height()) / 113 static_cast<float>(surface_info.size_in_pixels().height()) /
114 bounds().height(); 114 bounds().height();
115 } else { 115 } else {
116 layer_to_content_scale_x = layer_to_content_scale_y = 116 layer_to_content_scale_x = layer_to_content_scale_y =
117 surface_info.device_scale_factor(); 117 surface_info.device_scale_factor();
118 } 118 }
119 119
120 visible_quad_rect = gfx::ScaleToEnclosedRect( 120 visible_quad_rect = gfx::ScaleToEnclosingRect(
121 visible_quad_rect, layer_to_content_scale_x, layer_to_content_scale_y); 121 visible_quad_rect, layer_to_content_scale_x, layer_to_content_scale_y);
122 visible_quad_rect = gfx::IntersectRects(quad_rect, visible_quad_rect); 122 visible_quad_rect = gfx::IntersectRects(quad_rect, visible_quad_rect);
123 123
124 if (visible_quad_rect.IsEmpty()) 124 if (visible_quad_rect.IsEmpty())
125 return nullptr; 125 return nullptr;
126 126
127 // If a |common_shared_quad_state| is provided then use that. Otherwise, 127 // If a |common_shared_quad_state| is provided then use that. Otherwise,
128 // allocate a new SharedQuadState. Assign the new SharedQuadState to 128 // allocate a new SharedQuadState. Assign the new SharedQuadState to
129 // *|common_shared_quad_state| so that it may be reused by another emitted 129 // *|common_shared_quad_state| so that it may be reused by another emitted
130 // SurfaceDrawQuad. 130 // SurfaceDrawQuad.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 dict->SetString("surface_id", primary_surface_info_.id().ToString()); 245 dict->SetString("surface_id", primary_surface_info_.id().ToString());
246 dict->SetString("fallback_surface_id", 246 dict->SetString("fallback_surface_id",
247 fallback_surface_info_.id().ToString()); 247 fallback_surface_info_.id().ToString());
248 } 248 }
249 249
250 const char* SurfaceLayerImpl::LayerTypeAsString() const { 250 const char* SurfaceLayerImpl::LayerTypeAsString() const {
251 return "cc::SurfaceLayerImpl"; 251 return "cc::SurfaceLayerImpl";
252 } 252 }
253 253
254 } // namespace cc 254 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/surface_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698