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

Side by Side Diff: cc/surfaces/surface_aggregator_unittest.cc

Issue 2502373003: stop using SkXfermode -- use SkBlendMode instead (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/surfaces/surface_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 872
873 ASSERT_EQ(render_pass_quads[1]->material, DrawQuad::RENDER_PASS); 873 ASSERT_EQ(render_pass_quads[1]->material, DrawQuad::RENDER_PASS);
874 EXPECT_EQ( 874 EXPECT_EQ(
875 actual_pass_ids[1], 875 actual_pass_ids[1],
876 RenderPassDrawQuad::MaterialCast(render_pass_quads[1])->render_pass_id); 876 RenderPassDrawQuad::MaterialCast(render_pass_quads[1])->render_pass_id);
877 factory_.Destroy(child_local_frame_id); 877 factory_.Destroy(child_local_frame_id);
878 } 878 }
879 879
880 void AddSolidColorQuadWithBlendMode(const gfx::Size& size, 880 void AddSolidColorQuadWithBlendMode(const gfx::Size& size,
881 RenderPass* pass, 881 RenderPass* pass,
882 const SkXfermode::Mode blend_mode) { 882 const SkBlendMode blend_mode) {
883 const gfx::Transform layer_to_target_transform; 883 const gfx::Transform layer_to_target_transform;
884 const gfx::Size layer_bounds(size); 884 const gfx::Size layer_bounds(size);
885 const gfx::Rect visible_layer_rect(size); 885 const gfx::Rect visible_layer_rect(size);
886 const gfx::Rect clip_rect(size); 886 const gfx::Rect clip_rect(size);
887 887
888 bool is_clipped = false; 888 bool is_clipped = false;
889 float opacity = 1.f; 889 float opacity = 1.f;
890 890
891 bool force_anti_aliasing_off = false; 891 bool force_anti_aliasing_off = false;
892 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 892 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
(...skipping 28 matching lines...) Expand all
921 // 921 //
922 // Resulting in the following aggregated pass: 922 // Resulting in the following aggregated pass:
923 // quad_root_0 - blend_mode kClear_Mode 923 // quad_root_0 - blend_mode kClear_Mode
924 // quad_child_one_0 - blend_mode kSrc_Mode 924 // quad_child_one_0 - blend_mode kSrc_Mode
925 // quad_grandchild_0 - blend_mode kDst_Mode 925 // quad_grandchild_0 - blend_mode kDst_Mode
926 // quad_child_one_1 - blend_mode kSrcOver_Mode 926 // quad_child_one_1 - blend_mode kSrcOver_Mode
927 // quad_root_1 - blend_mode kDstOver_Mode 927 // quad_root_1 - blend_mode kDstOver_Mode
928 // quad_child_two_0 - blend_mode kSrcIn_Mode 928 // quad_child_two_0 - blend_mode kSrcIn_Mode
929 // quad_root_2 - blend_mode kDstIn_Mode 929 // quad_root_2 - blend_mode kDstIn_Mode
930 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateSharedQuadStateProperties) { 930 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateSharedQuadStateProperties) {
931 const SkXfermode::Mode blend_modes[] = {SkXfermode::kClear_Mode, // 0 931 const SkBlendMode blend_modes[] = {
932 SkXfermode::kSrc_Mode, // 1 932 SkBlendMode::kClear, // 0
933 SkXfermode::kDst_Mode, // 2 933 SkBlendMode::kSrc, // 1
934 SkXfermode::kSrcOver_Mode, // 3 934 SkBlendMode::kDst, // 2
935 SkXfermode::kDstOver_Mode, // 4 935 SkBlendMode::kSrcOver, // 3
936 SkXfermode::kSrcIn_Mode, // 5 936 SkBlendMode::kDstOver, // 4
937 SkXfermode::kDstIn_Mode, // 6 937 SkBlendMode::kSrcIn, // 5
938 SkBlendMode::kDstIn, // 6
938 }; 939 };
939 940
940 RenderPassId pass_id(1, 1); 941 RenderPassId pass_id(1, 1);
941 LocalFrameId grandchild_local_frame_id = allocator_.GenerateId(); 942 LocalFrameId grandchild_local_frame_id = allocator_.GenerateId();
942 SurfaceId grandchild_surface_id(factory_.frame_sink_id(), 943 SurfaceId grandchild_surface_id(factory_.frame_sink_id(),
943 grandchild_local_frame_id); 944 grandchild_local_frame_id);
944 factory_.Create(grandchild_local_frame_id); 945 factory_.Create(grandchild_local_frame_id);
945 std::unique_ptr<RenderPass> grandchild_pass = RenderPass::Create(); 946 std::unique_ptr<RenderPass> grandchild_pass = RenderPass::Create();
946 gfx::Rect output_rect(SurfaceSize()); 947 gfx::Rect output_rect(SurfaceSize());
947 gfx::Rect damage_rect(SurfaceSize()); 948 gfx::Rect damage_rect(SurfaceSize());
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 // Output is insecure, so texture should be drawn. 2211 // Output is insecure, so texture should be drawn.
2211 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material); 2212 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material);
2212 2213
2213 factory.Destroy(local_frame1_id); 2214 factory.Destroy(local_frame1_id);
2214 factory.Destroy(local_frame2_id); 2215 factory.Destroy(local_frame2_id);
2215 } 2216 }
2216 2217
2217 } // namespace 2218 } // namespace
2218 } // namespace cc 2219 } // namespace cc
2219 2220
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698