Chromium Code Reviews| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 } | 396 } |
| 397 | 397 |
| 398 ResourceId mask_resource_id = 0; | 398 ResourceId mask_resource_id = 0; |
| 399 gfx::Size mask_texture_size; | 399 gfx::Size mask_texture_size; |
| 400 gfx::Vector2dF mask_uv_scale; | 400 gfx::Vector2dF mask_uv_scale; |
| 401 gfx::Vector2dF surface_contents_scale = | 401 gfx::Vector2dF surface_contents_scale = |
| 402 OwningEffectNode()->surface_contents_scale; | 402 OwningEffectNode()->surface_contents_scale; |
| 403 LayerImpl* mask_layer = MaskLayer(); | 403 LayerImpl* mask_layer = MaskLayer(); |
| 404 if (mask_layer && mask_layer->DrawsContent() && | 404 if (mask_layer && mask_layer->DrawsContent() && |
| 405 !mask_layer->bounds().IsEmpty()) { | 405 !mask_layer->bounds().IsEmpty()) { |
| 406 // The software renderer applies mask layer and blending in the wrong | |
|
enne (OOO)
2017/01/30 18:56:54
Can you explain this restriction a little bit more
trchen
2017/01/30 23:07:06
Let's make a simple example. Assuming we are drawi
| |
| 407 // order but kDstIn doesn't commute with masking. It is okay to not | |
| 408 // support this configuration because kDstIn was introduced to replace | |
| 409 // mask layers. | |
| 410 DCHECK(BlendMode() != SkBlendMode::kDstIn) | |
| 411 << "kDstIn blend mode with mask layer is unsupported."; | |
| 406 mask_layer->GetContentsResourceId(&mask_resource_id, &mask_texture_size); | 412 mask_layer->GetContentsResourceId(&mask_resource_id, &mask_texture_size); |
| 407 gfx::SizeF unclipped_mask_target_size = gfx::ScaleSize( | 413 gfx::SizeF unclipped_mask_target_size = gfx::ScaleSize( |
| 408 gfx::SizeF(OwningEffectNode()->unscaled_mask_target_size), | 414 gfx::SizeF(OwningEffectNode()->unscaled_mask_target_size), |
| 409 surface_contents_scale.x(), surface_contents_scale.y()); | 415 surface_contents_scale.x(), surface_contents_scale.y()); |
| 410 mask_uv_scale = gfx::Vector2dF(1.0f / unclipped_mask_target_size.width(), | 416 mask_uv_scale = gfx::Vector2dF(1.0f / unclipped_mask_target_size.width(), |
| 411 1.0f / unclipped_mask_target_size.height()); | 417 1.0f / unclipped_mask_target_size.height()); |
| 412 } | 418 } |
| 413 | 419 |
| 414 RenderPassDrawQuad* quad = | 420 RenderPassDrawQuad* quad = |
| 415 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 421 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
| 416 quad->SetNew(shared_quad_state, content_rect(), visible_layer_rect, | 422 quad->SetNew(shared_quad_state, content_rect(), visible_layer_rect, |
| 417 GetRenderPassId(), mask_resource_id, mask_uv_scale, | 423 GetRenderPassId(), mask_resource_id, mask_uv_scale, |
| 418 mask_texture_size, surface_contents_scale, FiltersOrigin()); | 424 mask_texture_size, surface_contents_scale, FiltersOrigin()); |
| 419 } | 425 } |
| 420 | 426 |
| 421 } // namespace cc | 427 } // namespace cc |
| OLD | NEW |