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

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

Issue 2502373003: stop using SkXfermode -- use SkBlendMode instead (Closed)
Patch Set: rebase 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
« no previous file with comments | « cc/quads/texture_draw_quad.h ('k') | cc/surfaces/surfaces_pixeltest.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 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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 824
825 ASSERT_EQ(render_pass_quads[1]->material, DrawQuad::RENDER_PASS); 825 ASSERT_EQ(render_pass_quads[1]->material, DrawQuad::RENDER_PASS);
826 EXPECT_EQ( 826 EXPECT_EQ(
827 actual_pass_ids[1], 827 actual_pass_ids[1],
828 RenderPassDrawQuad::MaterialCast(render_pass_quads[1])->render_pass_id); 828 RenderPassDrawQuad::MaterialCast(render_pass_quads[1])->render_pass_id);
829 factory_.Destroy(child_local_frame_id); 829 factory_.Destroy(child_local_frame_id);
830 } 830 }
831 831
832 void AddSolidColorQuadWithBlendMode(const gfx::Size& size, 832 void AddSolidColorQuadWithBlendMode(const gfx::Size& size,
833 RenderPass* pass, 833 RenderPass* pass,
834 const SkXfermode::Mode blend_mode) { 834 const SkBlendMode blend_mode) {
835 const gfx::Transform layer_to_target_transform; 835 const gfx::Transform layer_to_target_transform;
836 const gfx::Size layer_bounds(size); 836 const gfx::Size layer_bounds(size);
837 const gfx::Rect visible_layer_rect(size); 837 const gfx::Rect visible_layer_rect(size);
838 const gfx::Rect clip_rect(size); 838 const gfx::Rect clip_rect(size);
839 839
840 bool is_clipped = false; 840 bool is_clipped = false;
841 float opacity = 1.f; 841 float opacity = 1.f;
842 842
843 bool force_anti_aliasing_off = false; 843 bool force_anti_aliasing_off = false;
844 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 844 SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
(...skipping 28 matching lines...) Expand all
873 // 873 //
874 // Resulting in the following aggregated pass: 874 // Resulting in the following aggregated pass:
875 // quad_root_0 - blend_mode kClear_Mode 875 // quad_root_0 - blend_mode kClear_Mode
876 // quad_child_one_0 - blend_mode kSrc_Mode 876 // quad_child_one_0 - blend_mode kSrc_Mode
877 // quad_grandchild_0 - blend_mode kDst_Mode 877 // quad_grandchild_0 - blend_mode kDst_Mode
878 // quad_child_one_1 - blend_mode kSrcOver_Mode 878 // quad_child_one_1 - blend_mode kSrcOver_Mode
879 // quad_root_1 - blend_mode kDstOver_Mode 879 // quad_root_1 - blend_mode kDstOver_Mode
880 // quad_child_two_0 - blend_mode kSrcIn_Mode 880 // quad_child_two_0 - blend_mode kSrcIn_Mode
881 // quad_root_2 - blend_mode kDstIn_Mode 881 // quad_root_2 - blend_mode kDstIn_Mode
882 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateSharedQuadStateProperties) { 882 TEST_F(SurfaceAggregatorValidSurfaceTest, AggregateSharedQuadStateProperties) {
883 const SkXfermode::Mode blend_modes[] = {SkXfermode::kClear_Mode, // 0 883 const SkBlendMode blend_modes[] = {
884 SkXfermode::kSrc_Mode, // 1 884 SkBlendMode::kClear, // 0
885 SkXfermode::kDst_Mode, // 2 885 SkBlendMode::kSrc, // 1
886 SkXfermode::kSrcOver_Mode, // 3 886 SkBlendMode::kDst, // 2
887 SkXfermode::kDstOver_Mode, // 4 887 SkBlendMode::kSrcOver, // 3
888 SkXfermode::kSrcIn_Mode, // 5 888 SkBlendMode::kDstOver, // 4
889 SkXfermode::kDstIn_Mode, // 6 889 SkBlendMode::kSrcIn, // 5
890 SkBlendMode::kDstIn, // 6
890 }; 891 };
891 892
892 RenderPassId pass_id(1, 1); 893 RenderPassId pass_id(1, 1);
893 LocalFrameId grandchild_local_frame_id = allocator_.GenerateId(); 894 LocalFrameId grandchild_local_frame_id = allocator_.GenerateId();
894 SurfaceId grandchild_surface_id(factory_.frame_sink_id(), 895 SurfaceId grandchild_surface_id(factory_.frame_sink_id(),
895 grandchild_local_frame_id); 896 grandchild_local_frame_id);
896 factory_.Create(grandchild_local_frame_id); 897 factory_.Create(grandchild_local_frame_id);
897 std::unique_ptr<RenderPass> grandchild_pass = RenderPass::Create(); 898 std::unique_ptr<RenderPass> grandchild_pass = RenderPass::Create();
898 gfx::Rect output_rect(SurfaceSize()); 899 gfx::Rect output_rect(SurfaceSize());
899 gfx::Rect damage_rect(SurfaceSize()); 900 gfx::Rect damage_rect(SurfaceSize());
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 // Output is insecure, so texture should be drawn. 2013 // Output is insecure, so texture should be drawn.
2013 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material); 2014 EXPECT_EQ(DrawQuad::SOLID_COLOR, render_pass->quad_list.back()->material);
2014 2015
2015 factory.Destroy(local_frame1_id); 2016 factory.Destroy(local_frame1_id);
2016 factory.Destroy(local_frame2_id); 2017 factory.Destroy(local_frame2_id);
2017 } 2018 }
2018 2019
2019 } // namespace 2020 } // namespace
2020 } // namespace cc 2021 } // namespace cc
2021 2022
OLDNEW
« no previous file with comments | « cc/quads/texture_draw_quad.h ('k') | cc/surfaces/surfaces_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698