OLD | NEW |
---|---|
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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 float opacity = 0.25f; | 39 float opacity = 0.25f; |
40 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; | 40 SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; |
41 | 41 |
42 scoped_ptr<SharedQuadState> state(new SharedQuadState); | 42 scoped_ptr<SharedQuadState> state(new SharedQuadState); |
43 state->SetAll(quad_transform, | 43 state->SetAll(quad_transform, |
44 content_bounds, | 44 content_bounds, |
45 visible_content_rect, | 45 visible_content_rect, |
46 clip_rect, | 46 clip_rect, |
47 is_clipped, | 47 is_clipped, |
48 opacity, | 48 opacity, |
49 blend_mode); | 49 blend_mode, |
50 0); | |
danakj
2014/06/15 18:15:36
please give this a name with a temp var here and b
troyhildebrandt
2014/06/17 00:29:43
Done.
| |
50 | 51 |
51 scoped_ptr<SharedQuadState> copy(new SharedQuadState); | 52 scoped_ptr<SharedQuadState> copy(new SharedQuadState); |
52 copy->CopyFrom(state.get()); | 53 copy->CopyFrom(state.get()); |
53 EXPECT_EQ(quad_transform, copy->content_to_target_transform); | 54 EXPECT_EQ(quad_transform, copy->content_to_target_transform); |
54 EXPECT_RECT_EQ(visible_content_rect, copy->visible_content_rect); | 55 EXPECT_RECT_EQ(visible_content_rect, copy->visible_content_rect); |
55 EXPECT_EQ(opacity, copy->opacity); | 56 EXPECT_EQ(opacity, copy->opacity); |
56 EXPECT_RECT_EQ(clip_rect, copy->clip_rect); | 57 EXPECT_RECT_EQ(clip_rect, copy->clip_rect); |
57 EXPECT_EQ(is_clipped, copy->is_clipped); | 58 EXPECT_EQ(is_clipped, copy->is_clipped); |
58 EXPECT_EQ(blend_mode, copy->blend_mode); | 59 EXPECT_EQ(blend_mode, copy->blend_mode); |
59 } | 60 } |
60 | 61 |
61 scoped_ptr<SharedQuadState> CreateSharedQuadState() { | 62 scoped_ptr<SharedQuadState> CreateSharedQuadState() { |
62 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); | 63 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); |
63 gfx::Size content_bounds(26, 28); | 64 gfx::Size content_bounds(26, 28); |
64 gfx::Rect visible_content_rect(10, 12, 14, 16); | 65 gfx::Rect visible_content_rect(10, 12, 14, 16); |
65 gfx::Rect clip_rect(19, 21, 23, 25); | 66 gfx::Rect clip_rect(19, 21, 23, 25); |
66 bool is_clipped = false; | 67 bool is_clipped = false; |
67 float opacity = 1.f; | 68 float opacity = 1.f; |
68 SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; | 69 SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; |
69 | 70 |
70 scoped_ptr<SharedQuadState> state(new SharedQuadState); | 71 scoped_ptr<SharedQuadState> state(new SharedQuadState); |
71 state->SetAll(quad_transform, | 72 state->SetAll(quad_transform, |
72 content_bounds, | 73 content_bounds, |
73 visible_content_rect, | 74 visible_content_rect, |
74 clip_rect, | 75 clip_rect, |
75 is_clipped, | 76 is_clipped, |
76 opacity, | 77 opacity, |
77 blend_mode); | 78 blend_mode, |
79 0); | |
78 return state.Pass(); | 80 return state.Pass(); |
79 } | 81 } |
80 | 82 |
81 void CompareDrawQuad(DrawQuad* quad, | 83 void CompareDrawQuad(DrawQuad* quad, |
82 DrawQuad* copy, | 84 DrawQuad* copy, |
83 SharedQuadState* copy_shared_state) { | 85 SharedQuadState* copy_shared_state) { |
84 EXPECT_EQ(quad->material, copy->material); | 86 EXPECT_EQ(quad->material, copy->material); |
85 EXPECT_RECT_EQ(quad->rect, copy->rect); | 87 EXPECT_RECT_EQ(quad->rect, copy->rect); |
86 EXPECT_RECT_EQ(quad->visible_rect, copy->visible_rect); | 88 EXPECT_RECT_EQ(quad->visible_rect, copy->visible_rect); |
87 EXPECT_RECT_EQ(quad->opaque_rect, copy->opaque_rect); | 89 EXPECT_RECT_EQ(quad->opaque_rect, copy->opaque_rect); |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
904 texture_size, | 906 texture_size, |
905 texture_format, | 907 texture_format, |
906 content_rect, | 908 content_rect, |
907 contents_scale, | 909 contents_scale, |
908 picture_pile); | 910 picture_pile); |
909 EXPECT_EQ(0, IterateAndCount(quad_new.get())); | 911 EXPECT_EQ(0, IterateAndCount(quad_new.get())); |
910 } | 912 } |
911 | 913 |
912 } // namespace | 914 } // namespace |
913 } // namespace cc | 915 } // namespace cc |
OLD | NEW |