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

Side by Side Diff: cc/quads/draw_quad_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/quads/draw_quad.h" 5 #include "cc/quads/draw_quad.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 23 matching lines...) Expand all
34 34
35 static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); 35 static constexpr FrameSinkId kArbitraryFrameSinkId(1, 1);
36 36
37 TEST(DrawQuadTest, CopySharedQuadState) { 37 TEST(DrawQuadTest, CopySharedQuadState) {
38 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); 38 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
39 gfx::Size layer_bounds(26, 28); 39 gfx::Size layer_bounds(26, 28);
40 gfx::Rect visible_layer_rect(10, 12, 14, 16); 40 gfx::Rect visible_layer_rect(10, 12, 14, 16);
41 gfx::Rect clip_rect(19, 21, 23, 25); 41 gfx::Rect clip_rect(19, 21, 23, 25);
42 bool is_clipped = true; 42 bool is_clipped = true;
43 float opacity = 0.25f; 43 float opacity = 0.25f;
44 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; 44 SkBlendMode blend_mode = SkBlendMode::kMultiply;
45 int sorting_context_id = 65536; 45 int sorting_context_id = 65536;
46 46
47 std::unique_ptr<SharedQuadState> state(new SharedQuadState); 47 std::unique_ptr<SharedQuadState> state(new SharedQuadState);
48 state->SetAll(quad_transform, layer_bounds, visible_layer_rect, clip_rect, 48 state->SetAll(quad_transform, layer_bounds, visible_layer_rect, clip_rect,
49 is_clipped, opacity, blend_mode, sorting_context_id); 49 is_clipped, opacity, blend_mode, sorting_context_id);
50 50
51 std::unique_ptr<SharedQuadState> copy(new SharedQuadState(*state)); 51 std::unique_ptr<SharedQuadState> copy(new SharedQuadState(*state));
52 EXPECT_EQ(quad_transform, copy->quad_to_target_transform); 52 EXPECT_EQ(quad_transform, copy->quad_to_target_transform);
53 EXPECT_EQ(visible_layer_rect, copy->visible_quad_layer_rect); 53 EXPECT_EQ(visible_layer_rect, copy->visible_quad_layer_rect);
54 EXPECT_EQ(opacity, copy->opacity); 54 EXPECT_EQ(opacity, copy->opacity);
55 EXPECT_EQ(clip_rect, copy->clip_rect); 55 EXPECT_EQ(clip_rect, copy->clip_rect);
56 EXPECT_EQ(is_clipped, copy->is_clipped); 56 EXPECT_EQ(is_clipped, copy->is_clipped);
57 EXPECT_EQ(blend_mode, copy->blend_mode); 57 EXPECT_EQ(blend_mode, copy->blend_mode);
58 } 58 }
59 59
60 SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) { 60 SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) {
61 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); 61 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0);
62 gfx::Size layer_bounds(26, 28); 62 gfx::Size layer_bounds(26, 28);
63 gfx::Rect visible_layer_rect(10, 12, 14, 16); 63 gfx::Rect visible_layer_rect(10, 12, 14, 16);
64 gfx::Rect clip_rect(19, 21, 23, 25); 64 gfx::Rect clip_rect(19, 21, 23, 25);
65 bool is_clipped = false; 65 bool is_clipped = false;
66 float opacity = 1.f; 66 float opacity = 1.f;
67 int sorting_context_id = 65536; 67 int sorting_context_id = 65536;
68 SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; 68 SkBlendMode blend_mode = SkBlendMode::kSrcOver;
69 69
70 SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState(); 70 SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState();
71 state->SetAll(quad_transform, layer_bounds, visible_layer_rect, clip_rect, 71 state->SetAll(quad_transform, layer_bounds, visible_layer_rect, clip_rect,
72 is_clipped, opacity, blend_mode, sorting_context_id); 72 is_clipped, opacity, blend_mode, sorting_context_id);
73 return state; 73 return state;
74 } 74 }
75 75
76 void CompareDrawQuad(DrawQuad* quad, 76 void CompareDrawQuad(DrawQuad* quad,
77 DrawQuad* copy, 77 DrawQuad* copy,
78 SharedQuadState* copy_shared_state) { 78 SharedQuadState* copy_shared_state) {
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad); 994 LOG(ERROR) << "YUVVideoDrawQuad " << sizeof(YUVVideoDrawQuad);
995 break; 995 break;
996 case DrawQuad::INVALID: 996 case DrawQuad::INVALID:
997 break; 997 break;
998 } 998 }
999 } 999 }
1000 } 1000 }
1001 1001
1002 } // namespace 1002 } // namespace
1003 } // namespace cc 1003 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698