| 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/render_surface_impl.h" | 5 #include "cc/layers/render_surface_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // functions (for example, gfx::ToEnclosedRect) that are called on this rect. | 98 // functions (for example, gfx::ToEnclosedRect) that are called on this rect. |
| 99 if (std::isnan(drawable_content_rect.x()) || | 99 if (std::isnan(drawable_content_rect.x()) || |
| 100 std::isnan(drawable_content_rect.y()) || | 100 std::isnan(drawable_content_rect.y()) || |
| 101 std::isnan(drawable_content_rect.right()) || | 101 std::isnan(drawable_content_rect.right()) || |
| 102 std::isnan(drawable_content_rect.bottom())) | 102 std::isnan(drawable_content_rect.bottom())) |
| 103 return gfx::RectF(); | 103 return gfx::RectF(); |
| 104 | 104 |
| 105 return drawable_content_rect; | 105 return drawable_content_rect; |
| 106 } | 106 } |
| 107 | 107 |
| 108 SkXfermode::Mode RenderSurfaceImpl::BlendMode() const { |
| 109 return OwningEffectNode()->blend_mode; |
| 110 } |
| 111 |
| 112 bool RenderSurfaceImpl::UsesDefaultBlendMode() const { |
| 113 return BlendMode() == SkXfermode::kSrcOver_Mode; |
| 114 } |
| 115 |
| 108 SkColor RenderSurfaceImpl::GetDebugBorderColor() const { | 116 SkColor RenderSurfaceImpl::GetDebugBorderColor() const { |
| 109 return DebugColors::SurfaceBorderColor(); | 117 return DebugColors::SurfaceBorderColor(); |
| 110 } | 118 } |
| 111 | 119 |
| 112 SkColor RenderSurfaceImpl::GetReplicaDebugBorderColor() const { | 120 SkColor RenderSurfaceImpl::GetReplicaDebugBorderColor() const { |
| 113 return DebugColors::SurfaceReplicaBorderColor(); | 121 return DebugColors::SurfaceReplicaBorderColor(); |
| 114 } | 122 } |
| 115 | 123 |
| 116 float RenderSurfaceImpl::GetDebugBorderWidth() const { | 124 float RenderSurfaceImpl::GetDebugBorderWidth() const { |
| 117 return DebugColors::SurfaceBorderWidth(owning_layer_->layer_tree_impl()); | 125 return DebugColors::SurfaceBorderWidth(owning_layer_->layer_tree_impl()); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 LayerImpl* mask_layer, | 363 LayerImpl* mask_layer, |
| 356 AppendQuadsData* append_quads_data, | 364 AppendQuadsData* append_quads_data, |
| 357 RenderPassId render_pass_id) { | 365 RenderPassId render_pass_id) { |
| 358 gfx::Rect visible_layer_rect = | 366 gfx::Rect visible_layer_rect = |
| 359 occlusion_in_content_space.GetUnoccludedContentRect(content_rect()); | 367 occlusion_in_content_space.GetUnoccludedContentRect(content_rect()); |
| 360 if (visible_layer_rect.IsEmpty()) | 368 if (visible_layer_rect.IsEmpty()) |
| 361 return; | 369 return; |
| 362 | 370 |
| 363 SharedQuadState* shared_quad_state = | 371 SharedQuadState* shared_quad_state = |
| 364 render_pass->CreateAndAppendSharedQuadState(); | 372 render_pass->CreateAndAppendSharedQuadState(); |
| 365 shared_quad_state->SetAll( | 373 shared_quad_state->SetAll(draw_transform, content_rect().size(), |
| 366 draw_transform, content_rect().size(), content_rect(), | 374 content_rect(), draw_properties_.clip_rect, |
| 367 draw_properties_.clip_rect, draw_properties_.is_clipped, | 375 draw_properties_.is_clipped, |
| 368 draw_properties_.draw_opacity, owning_layer_->blend_mode(), | 376 draw_properties_.draw_opacity, BlendMode(), |
| 369 owning_layer_->sorting_context_id()); | 377 owning_layer_->sorting_context_id()); |
| 370 | 378 |
| 371 if (owning_layer_->ShowDebugBorders()) { | 379 if (owning_layer_->ShowDebugBorders()) { |
| 372 DebugBorderDrawQuad* debug_border_quad = | 380 DebugBorderDrawQuad* debug_border_quad = |
| 373 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); | 381 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); |
| 374 debug_border_quad->SetNew(shared_quad_state, content_rect(), | 382 debug_border_quad->SetNew(shared_quad_state, content_rect(), |
| 375 visible_layer_rect, debug_border_color, | 383 visible_layer_rect, debug_border_color, |
| 376 debug_border_width); | 384 debug_border_width); |
| 377 } | 385 } |
| 378 | 386 |
| 379 ResourceId mask_resource_id = 0; | 387 ResourceId mask_resource_id = 0; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 399 | 407 |
| 400 RenderPassDrawQuad* quad = | 408 RenderPassDrawQuad* quad = |
| 401 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 409 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
| 402 quad->SetNew(shared_quad_state, content_rect(), visible_layer_rect, | 410 quad->SetNew(shared_quad_state, content_rect(), visible_layer_rect, |
| 403 render_pass_id, mask_resource_id, mask_uv_scale, | 411 render_pass_id, mask_resource_id, mask_uv_scale, |
| 404 mask_texture_size, Filters(), owning_layer_to_target_scale, | 412 mask_texture_size, Filters(), owning_layer_to_target_scale, |
| 405 BackgroundFilters()); | 413 BackgroundFilters()); |
| 406 } | 414 } |
| 407 | 415 |
| 408 } // namespace cc | 416 } // namespace cc |
| OLD | NEW |