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

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

Issue 203463015: cc: Apply occlusion before creating quads in UIResourceLayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | 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/layers/quad_sink.h" 10 #include "cc/layers/quad_sink.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 static const bool flipped = false; 109 static const bool flipped = false;
110 static const bool premultiplied_alpha = true; 110 static const bool premultiplied_alpha = true;
111 111
112 DCHECK(!bounds().IsEmpty()); 112 DCHECK(!bounds().IsEmpty());
113 113
114 bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) || 114 bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) ||
115 contents_opaque(); 115 contents_opaque();
116 116
117 gfx::Rect quad_rect(bounds()); 117 gfx::Rect quad_rect(bounds());
118 gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect()); 118 gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect());
119 gfx::Rect visible_quad_rect(quad_rect); 119 gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect(
120 quad_rect, draw_properties().target_space_transform);
121 if (visible_quad_rect.IsEmpty())
122 return;
123
120 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); 124 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create();
121 quad->SetNew(shared_quad_state, 125 quad->SetNew(shared_quad_state,
122 quad_rect, 126 quad_rect,
123 opaque_rect, 127 opaque_rect,
124 visible_quad_rect, 128 visible_quad_rect,
125 resource, 129 resource,
126 premultiplied_alpha, 130 premultiplied_alpha,
127 uv_top_left_, 131 uv_top_left_,
128 uv_bottom_right_, 132 uv_bottom_right_,
129 SK_ColorTRANSPARENT, 133 SK_ColorTRANSPARENT,
130 vertex_opacity_, 134 vertex_opacity_,
131 flipped); 135 flipped);
132 quad_sink->MaybeAppend(quad.PassAs<DrawQuad>()); 136 quad_sink->Append(quad.PassAs<DrawQuad>());
133 } 137 }
134 138
135 const char* UIResourceLayerImpl::LayerTypeAsString() const { 139 const char* UIResourceLayerImpl::LayerTypeAsString() const {
136 return "cc::UIResourceLayerImpl"; 140 return "cc::UIResourceLayerImpl";
137 } 141 }
138 142
139 base::DictionaryValue* UIResourceLayerImpl::LayerTreeAsJson() const { 143 base::DictionaryValue* UIResourceLayerImpl::LayerTreeAsJson() const {
140 base::DictionaryValue* result = LayerImpl::LayerTreeAsJson(); 144 base::DictionaryValue* result = LayerImpl::LayerTreeAsJson();
141 145
142 result->Set("ImageBounds", MathUtil::AsValue(image_bounds_).release()); 146 result->Set("ImageBounds", MathUtil::AsValue(image_bounds_).release());
143 147
144 base::ListValue* list = new base::ListValue; 148 base::ListValue* list = new base::ListValue;
145 list->AppendDouble(vertex_opacity_[0]); 149 list->AppendDouble(vertex_opacity_[0]);
146 list->AppendDouble(vertex_opacity_[1]); 150 list->AppendDouble(vertex_opacity_[1]);
147 list->AppendDouble(vertex_opacity_[2]); 151 list->AppendDouble(vertex_opacity_[2]);
148 list->AppendDouble(vertex_opacity_[3]); 152 list->AppendDouble(vertex_opacity_[3]);
149 result->Set("VertexOpacity", list); 153 result->Set("VertexOpacity", list);
150 154
151 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release()); 155 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release());
152 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release()); 156 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release());
153 157
154 return result; 158 return result;
155 } 159 }
156 160
157 } // namespace cc 161 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/ui_resource_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698