| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/texture_layer_impl.h" | 5 #include "cc/layers/texture_layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 gfx::Rect visible_quad_rect = | 162 gfx::Rect visible_quad_rect = |
| 163 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 163 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 164 quad_rect); | 164 quad_rect); |
| 165 if (visible_quad_rect.IsEmpty()) | 165 if (visible_quad_rect.IsEmpty()) |
| 166 return; | 166 return; |
| 167 | 167 |
| 168 if (!vertex_opacity_[0] && !vertex_opacity_[1] && !vertex_opacity_[2] && | 168 if (!vertex_opacity_[0] && !vertex_opacity_[1] && !vertex_opacity_[2] && |
| 169 !vertex_opacity_[3]) | 169 !vertex_opacity_[3]) |
| 170 return; | 170 return; |
| 171 | 171 |
| 172 if (!texture_mailbox_.secure_output_only() || | 172 TextureDrawQuad* quad = |
| 173 (layer_tree_impl()->OutputIsSecure() && !InsideCopyRequest())) { | 173 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 174 TextureDrawQuad* quad = | 174 ResourceId id = |
| 175 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 175 valid_texture_copy_ ? texture_copy_->id() : external_texture_resource_; |
| 176 ResourceId id = | 176 quad->SetNew(shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, id, |
| 177 valid_texture_copy_ ? texture_copy_->id() : external_texture_resource_; | 177 premultiplied_alpha_, uv_top_left_, uv_bottom_right_, bg_color, |
| 178 quad->SetNew(shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, | 178 vertex_opacity_, flipped_, nearest_neighbor_, |
| 179 id, premultiplied_alpha_, uv_top_left_, uv_bottom_right_, | 179 texture_mailbox_.secure_output_only()); |
| 180 bg_color, vertex_opacity_, flipped_, nearest_neighbor_); | 180 if (!valid_texture_copy_) { |
| 181 if (!valid_texture_copy_) { | 181 quad->set_resource_size_in_pixels(texture_mailbox_.size_in_pixels()); |
| 182 quad->set_resource_size_in_pixels(texture_mailbox_.size_in_pixels()); | |
| 183 } | |
| 184 ValidateQuadResources(quad); | |
| 185 } else { | |
| 186 SolidColorDrawQuad* quad = | |
| 187 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | |
| 188 quad->SetNew(shared_quad_state, quad_rect, visible_quad_rect, SK_ColorBLACK, | |
| 189 false); | |
| 190 } | 182 } |
| 183 ValidateQuadResources(quad); |
| 191 } | 184 } |
| 192 | 185 |
| 193 SimpleEnclosedRegion TextureLayerImpl::VisibleOpaqueRegion() const { | 186 SimpleEnclosedRegion TextureLayerImpl::VisibleOpaqueRegion() const { |
| 194 if (contents_opaque()) | 187 if (contents_opaque()) |
| 195 return SimpleEnclosedRegion(visible_layer_rect()); | 188 return SimpleEnclosedRegion(visible_layer_rect()); |
| 196 | 189 |
| 197 if (blend_background_color_ && (SkColorGetA(background_color()) == 0xFF)) | 190 if (blend_background_color_ && (SkColorGetA(background_color()) == 0xFF)) |
| 198 return SimpleEnclosedRegion(visible_layer_rect()); | 191 return SimpleEnclosedRegion(visible_layer_rect()); |
| 199 | 192 |
| 200 return SimpleEnclosedRegion(); | 193 return SimpleEnclosedRegion(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } else if (external_texture_resource_) { | 259 } else if (external_texture_resource_) { |
| 267 DCHECK(!own_mailbox_); | 260 DCHECK(!own_mailbox_); |
| 268 ResourceProvider* resource_provider = | 261 ResourceProvider* resource_provider = |
| 269 layer_tree_impl()->resource_provider(); | 262 layer_tree_impl()->resource_provider(); |
| 270 resource_provider->DeleteResource(external_texture_resource_); | 263 resource_provider->DeleteResource(external_texture_resource_); |
| 271 external_texture_resource_ = 0; | 264 external_texture_resource_ = 0; |
| 272 } | 265 } |
| 273 } | 266 } |
| 274 | 267 |
| 275 } // namespace cc | 268 } // namespace cc |
| OLD | NEW |