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

Unified Diff: cc/trees/layer_tree_host_pixeltest_blending.cc

Issue 2659023003: [cc] Add SkBlendMode::kDstIn support to cc::Layer (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« cc/layers/render_surface_impl.cc ('K') | « cc/test/data/blending_with_root.png ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_pixeltest_blending.cc
diff --git a/cc/trees/layer_tree_host_pixeltest_blending.cc b/cc/trees/layer_tree_host_pixeltest_blending.cc
index d2eb0a7b3ea1890a1ecbb4c0987339758892f792..d1b179ce80dcc5536ab5104c157b6ce67b007a63 100644
--- a/cc/trees/layer_tree_host_pixeltest_blending.cc
+++ b/cc/trees/layer_tree_host_pixeltest_blending.cc
@@ -24,7 +24,8 @@ SkBlendMode const kBlendModes[] = {
SkBlendMode::kSoftLight, SkBlendMode::kDifference,
SkBlendMode::kExclusion, SkBlendMode::kMultiply,
SkBlendMode::kHue, SkBlendMode::kSaturation,
- SkBlendMode::kColor, SkBlendMode::kLuminosity};
+ SkBlendMode::kColor, SkBlendMode::kLuminosity,
+ SkBlendMode::kDstIn};
SkColor kCSSTestColors[] = {
0xffff0000, // red
@@ -180,7 +181,7 @@ class LayerTreeHostBlendingPixelTest : public LayerTreeHostPixelResourceTest {
int lane_height,
scoped_refptr<Layer> background,
RenderPassOptions flags) {
- const int kLanesCount = kBlendModesCount + 4;
+ const int kLanesCount = kBlendModesCount + 6;
const SkColor kMiscOpaqueColor = 0xffc86464;
const SkColor kMiscTransparentColor = 0x80c86464;
const SkBlendMode kCoeffBlendMode = SkBlendMode::kScreen;
@@ -206,6 +207,12 @@ class LayerTreeHostBlendingPixelTest : public LayerTreeHostPixelResourceTest {
} else if (i == kBlendModesCount + 3) {
blend_mode = kShaderBlendMode;
color = kMiscTransparentColor;
+ } else if (i == kBlendModesCount + 4) {
+ blend_mode = SkBlendMode::kDstIn;
+ opacity = 0.5f;
+ } else if (i == kBlendModesCount + 5) {
+ blend_mode = SkBlendMode::kDstIn;
+ color = kMiscTransparentColor;
}
scoped_refptr<SolidColorLayer> lane =
@@ -213,7 +220,8 @@ class LayerTreeHostBlendingPixelTest : public LayerTreeHostPixelResourceTest {
lane->SetBlendMode(blend_mode);
lane->SetOpacity(opacity);
lane->SetForceRenderSurfaceForTesting(true);
- if (flags & kUseMasks)
+ // Layers with kDstIn blend mode with a mask is not supported.
+ if (flags & kUseMasks && blend_mode != SkBlendMode::kDstIn)
SetupMaskLayer(lane);
if (flags & kUseColorMatrix) {
SetupColorMatrix(lane);
@@ -226,19 +234,19 @@ class LayerTreeHostBlendingPixelTest : public LayerTreeHostPixelResourceTest {
const base::FilePath::CharType* expected_path,
RenderPassOptions flags) {
const int kLaneWidth = 8;
- const int kLaneHeight = kLaneWidth * kCSSTestColorsCount;
- const int kRootSize = kLaneHeight;
+ const int kRootWidth = kLaneWidth * (kBlendModesCount + 6);
+ const int kRootHeight = kLaneWidth * kCSSTestColorsCount;
InitializeFromTestCase(type);
- scoped_refptr<SolidColorLayer> root =
- CreateSolidColorLayer(gfx::Rect(kRootSize, kRootSize), SK_ColorWHITE);
+ scoped_refptr<SolidColorLayer> root = CreateSolidColorLayer(
+ gfx::Rect(kRootWidth, kRootHeight), SK_ColorWHITE);
scoped_refptr<Layer> background =
- CreateColorfulBackdropLayer(kRootSize, kRootSize);
+ CreateColorfulBackdropLayer(kRootWidth, kRootHeight);
background->SetIsRootForIsolatedGroup(true);
root->AddChild(background);
- CreateBlendingColorLayers(kLaneWidth, kLaneHeight, background.get(), flags);
+ CreateBlendingColorLayers(kLaneWidth, kRootHeight, background.get(), flags);
this->force_antialiasing_ = (flags & kUseAntialiasing);
this->force_blending_with_shaders_ = (flags & kForceShaders);
« cc/layers/render_surface_impl.cc ('K') | « cc/test/data/blending_with_root.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698