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