Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: cc/layers/render_surface_impl.cc

Issue 2659023003: [cc] Add SkBlendMode::kDstIn support to cc::Layer (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/output/gl_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/output/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698