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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // The software renderer applies mask layer and blending in the wrong | 407 // The software renderer applies mask layer and blending in the wrong |
408 // order but kDstIn doesn't commute with masking. It is okay to not | 408 // order but kDstIn doesn't commute with masking. It is okay to not |
409 // support this configuration because kDstIn was introduced to replace | 409 // support this configuration because kDstIn was introduced to replace |
410 // mask layers. | 410 // mask layers. |
411 DCHECK(BlendMode() != SkBlendMode::kDstIn) | 411 DCHECK(BlendMode() != SkBlendMode::kDstIn) |
412 << "kDstIn blend mode with mask layer is unsupported."; | 412 << "kDstIn blend mode with mask layer is unsupported."; |
413 if (mask_layer->mask_type() == Layer::LayerMaskType::MULTI_TEXTURE_MASK) { | 413 if (mask_layer->mask_type() == Layer::LayerMaskType::MULTI_TEXTURE_MASK) { |
414 TileMaskLayer(render_pass, shared_quad_state, visible_layer_rect); | 414 TileMaskLayer(render_pass, shared_quad_state, visible_layer_rect); |
415 return; | 415 return; |
416 } | 416 } |
417 mask_layer->GetContentsResourceId(&mask_resource_id, &mask_texture_size); | 417 gfx::SizeF mask_uv_size; |
| 418 mask_layer->GetContentsResourceId(&mask_resource_id, &mask_texture_size, |
| 419 &mask_uv_size); |
418 gfx::SizeF unclipped_mask_target_size = gfx::ScaleSize( | 420 gfx::SizeF unclipped_mask_target_size = gfx::ScaleSize( |
419 gfx::SizeF(OwningEffectNode()->unscaled_mask_target_size), | 421 gfx::SizeF(OwningEffectNode()->unscaled_mask_target_size), |
420 surface_contents_scale.x(), surface_contents_scale.y()); | 422 surface_contents_scale.x(), surface_contents_scale.y()); |
421 // Convert content_rect from target space to normalized space. | 423 // Convert content_rect from target space to normalized mask UV space. |
422 // Where unclipped_mask_target_size maps to gfx::Size(1, 1). | 424 // Where |unclipped_mask_target_size| maps to |mask_uv_size|. |
423 mask_uv_rect = gfx::ScaleRect(gfx::RectF(content_rect()), | 425 mask_uv_rect = gfx::ScaleRect( |
424 1.0f / unclipped_mask_target_size.width(), | 426 gfx::RectF(content_rect()), |
425 1.0f / unclipped_mask_target_size.height()); | 427 mask_uv_size.width() / unclipped_mask_target_size.width(), |
| 428 mask_uv_size.height() / unclipped_mask_target_size.height()); |
426 } | 429 } |
427 | 430 |
428 gfx::RectF tex_coord_rect(gfx::Rect(content_rect().size())); | 431 gfx::RectF tex_coord_rect(gfx::Rect(content_rect().size())); |
429 RenderPassDrawQuad* quad = | 432 RenderPassDrawQuad* quad = |
430 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 433 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
431 quad->SetNew(shared_quad_state, content_rect(), visible_layer_rect, | 434 quad->SetNew(shared_quad_state, content_rect(), visible_layer_rect, |
432 GetRenderPassId(), mask_resource_id, mask_uv_rect, | 435 GetRenderPassId(), mask_resource_id, mask_uv_rect, |
433 mask_texture_size, surface_contents_scale, FiltersOrigin(), | 436 mask_texture_size, surface_contents_scale, FiltersOrigin(), |
434 tex_coord_rect); | 437 tex_coord_rect); |
435 } | 438 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 NOTIMPLEMENTED(); | 542 NOTIMPLEMENTED(); |
540 break; | 543 break; |
541 default: | 544 default: |
542 NOTREACHED(); | 545 NOTREACHED(); |
543 break; | 546 break; |
544 } | 547 } |
545 } | 548 } |
546 } | 549 } |
547 | 550 |
548 } // namespace cc | 551 } // namespace cc |
OLD | NEW |