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

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

Issue 637913003: Revert of "Converted LayerImpl::bounds() to return SizeF." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/layers/picture_layer_unittest.cc ('k') | cc/layers/ui_resource_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 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/layers/ui_resource_layer_impl.h" 5 #include "cc/layers/ui_resource_layer_impl.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/quads/texture_draw_quad.h" 10 #include "cc/quads/texture_draw_quad.h"
11 #include "cc/trees/layer_tree_impl.h" 11 #include "cc/trees/layer_tree_impl.h"
12 #include "cc/trees/occlusion.h" 12 #include "cc/trees/occlusion.h"
13 #include "ui/gfx/geometry/size_conversions.h"
14 #include "ui/gfx/rect_f.h" 13 #include "ui/gfx/rect_f.h"
15 14
16 namespace cc { 15 namespace cc {
17 16
18 UIResourceLayerImpl::UIResourceLayerImpl(LayerTreeImpl* tree_impl, int id) 17 UIResourceLayerImpl::UIResourceLayerImpl(LayerTreeImpl* tree_impl, int id)
19 : LayerImpl(tree_impl, id), 18 : LayerImpl(tree_impl, id),
20 ui_resource_id_(0), 19 ui_resource_id_(0),
21 uv_top_left_(0.f, 0.f), 20 uv_top_left_(0.f, 0.f),
22 uv_bottom_right_(1.f, 1.f) { 21 uv_bottom_right_(1.f, 1.f) {
23 vertex_opacity_[0] = 1.0f; 22 vertex_opacity_[0] = 1.0f;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return; 112 return;
114 113
115 static const bool flipped = false; 114 static const bool flipped = false;
116 static const bool premultiplied_alpha = true; 115 static const bool premultiplied_alpha = true;
117 116
118 DCHECK(!bounds().IsEmpty()); 117 DCHECK(!bounds().IsEmpty());
119 118
120 bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) || 119 bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) ||
121 contents_opaque(); 120 contents_opaque();
122 121
123 gfx::Rect quad_rect(gfx::ToCeiledSize(bounds())); 122 gfx::Rect quad_rect(bounds());
124 gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect()); 123 gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect());
125 gfx::Rect visible_quad_rect = 124 gfx::Rect visible_quad_rect =
126 occlusion_in_content_space.GetUnoccludedContentRect(quad_rect); 125 occlusion_in_content_space.GetUnoccludedContentRect(quad_rect);
127 if (visible_quad_rect.IsEmpty()) 126 if (visible_quad_rect.IsEmpty())
128 return; 127 return;
129 128
130 TextureDrawQuad* quad = 129 TextureDrawQuad* quad =
131 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); 130 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>();
132 quad->SetNew(shared_quad_state, 131 quad->SetNew(shared_quad_state,
133 quad_rect, 132 quad_rect,
(...skipping 24 matching lines...) Expand all
158 list->AppendDouble(vertex_opacity_[3]); 157 list->AppendDouble(vertex_opacity_[3]);
159 result->Set("VertexOpacity", list); 158 result->Set("VertexOpacity", list);
160 159
161 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release()); 160 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release());
162 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release()); 161 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release());
163 162
164 return result; 163 return result;
165 } 164 }
166 165
167 } // namespace cc 166 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_unittest.cc ('k') | cc/layers/ui_resource_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698