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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "cc/output/gl_renderer.h" | 10 #include "cc/output/gl_renderer.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 142 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
143 const gfx::PointF uv_top_left(0.0f, 0.0f); | 143 const gfx::PointF uv_top_left(0.0f, 0.0f); |
144 const gfx::PointF uv_bottom_right(1.0f, 1.0f); | 144 const gfx::PointF uv_bottom_right(1.0f, 1.0f); |
145 const bool flipped = false; | 145 const bool flipped = false; |
146 const bool nearest_neighbor = false; | 146 const bool nearest_neighbor = false; |
147 TextureDrawQuad* quad = | 147 TextureDrawQuad* quad = |
148 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 148 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
149 quad->SetNew(shared_state, rect, gfx::Rect(), rect, resource, | 149 quad->SetNew(shared_state, rect, gfx::Rect(), rect, resource, |
150 premultiplied_alpha, uv_top_left, uv_bottom_right, | 150 premultiplied_alpha, uv_top_left, uv_bottom_right, |
151 background_color, vertex_opacity, flipped, nearest_neighbor); | 151 background_color, vertex_opacity, flipped, nearest_neighbor, |
| 152 false); |
152 } | 153 } |
153 | 154 |
154 void CreateTestTextureDrawQuad(const gfx::Rect& rect, | 155 void CreateTestTextureDrawQuad(const gfx::Rect& rect, |
155 SkColor texel_color, | 156 SkColor texel_color, |
156 SkColor background_color, | 157 SkColor background_color, |
157 bool premultiplied_alpha, | 158 bool premultiplied_alpha, |
158 const SharedQuadState* shared_state, | 159 const SharedQuadState* shared_state, |
159 ResourceProvider* resource_provider, | 160 ResourceProvider* resource_provider, |
160 RenderPass* render_pass) { | 161 RenderPass* render_pass) { |
161 SkPMColor pixel_color = premultiplied_alpha ? | 162 SkPMColor pixel_color = premultiplied_alpha ? |
(...skipping 13 matching lines...) Expand all Loading... |
175 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 176 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
176 | 177 |
177 const gfx::PointF uv_top_left(0.0f, 0.0f); | 178 const gfx::PointF uv_top_left(0.0f, 0.0f); |
178 const gfx::PointF uv_bottom_right(1.0f, 1.0f); | 179 const gfx::PointF uv_bottom_right(1.0f, 1.0f); |
179 const bool flipped = false; | 180 const bool flipped = false; |
180 const bool nearest_neighbor = false; | 181 const bool nearest_neighbor = false; |
181 TextureDrawQuad* quad = | 182 TextureDrawQuad* quad = |
182 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 183 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
183 quad->SetNew(shared_state, rect, gfx::Rect(), rect, resource, | 184 quad->SetNew(shared_state, rect, gfx::Rect(), rect, resource, |
184 premultiplied_alpha, uv_top_left, uv_bottom_right, | 185 premultiplied_alpha, uv_top_left, uv_bottom_right, |
185 background_color, vertex_opacity, flipped, nearest_neighbor); | 186 background_color, vertex_opacity, flipped, nearest_neighbor, |
| 187 false); |
186 } | 188 } |
187 | 189 |
188 void CreateTestYUVVideoDrawQuad_FromVideoFrame( | 190 void CreateTestYUVVideoDrawQuad_FromVideoFrame( |
189 const SharedQuadState* shared_state, | 191 const SharedQuadState* shared_state, |
190 scoped_refptr<media::VideoFrame> video_frame, | 192 scoped_refptr<media::VideoFrame> video_frame, |
191 uint8_t alpha_value, | 193 uint8_t alpha_value, |
192 const gfx::RectF& tex_coord_rect, | 194 const gfx::RectF& tex_coord_rect, |
193 RenderPass* render_pass, | 195 RenderPass* render_pass, |
194 VideoResourceUpdater* video_resource_updater, | 196 VideoResourceUpdater* video_resource_updater, |
195 const gfx::Rect& rect, | 197 const gfx::Rect& rect, |
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2728 CreateTestRenderPass(id, viewport, transform_to_root); | 2730 CreateTestRenderPass(id, viewport, transform_to_root); |
2729 | 2731 |
2730 gfx::Transform quad_to_target_transform; | 2732 gfx::Transform quad_to_target_transform; |
2731 SharedQuadState* shared_state = | 2733 SharedQuadState* shared_state = |
2732 CreateTestSharedQuadState(quad_to_target_transform, viewport, pass.get()); | 2734 CreateTestSharedQuadState(quad_to_target_transform, viewport, pass.get()); |
2733 | 2735 |
2734 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 2736 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
2735 TextureDrawQuad* quad = pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 2737 TextureDrawQuad* quad = pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
2736 quad->SetNew(shared_state, viewport, gfx::Rect(), viewport, resource, false, | 2738 quad->SetNew(shared_state, viewport, gfx::Rect(), viewport, resource, false, |
2737 gfx::PointF(0, 0), gfx::PointF(1, 1), SK_ColorBLACK, | 2739 gfx::PointF(0, 0), gfx::PointF(1, 1), SK_ColorBLACK, |
2738 vertex_opacity, false, nearest_neighbor); | 2740 vertex_opacity, false, nearest_neighbor, false); |
2739 | 2741 |
2740 RenderPassList pass_list; | 2742 RenderPassList pass_list; |
2741 pass_list.push_back(std::move(pass)); | 2743 pass_list.push_back(std::move(pass)); |
2742 | 2744 |
2743 EXPECT_TRUE(this->RunPixelTest( | 2745 EXPECT_TRUE(this->RunPixelTest( |
2744 &pass_list, | 2746 &pass_list, |
2745 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 2747 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
2746 FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f))); | 2748 FuzzyPixelComparator(false, 2.f, 0.f, 256.f, 256, 0.f))); |
2747 } | 2749 } |
2748 | 2750 |
(...skipping 30 matching lines...) Expand all Loading... |
2779 CreateTestRenderPass(id, viewport, transform_to_root); | 2781 CreateTestRenderPass(id, viewport, transform_to_root); |
2780 | 2782 |
2781 gfx::Transform quad_to_target_transform; | 2783 gfx::Transform quad_to_target_transform; |
2782 SharedQuadState* shared_state = | 2784 SharedQuadState* shared_state = |
2783 CreateTestSharedQuadState(quad_to_target_transform, viewport, pass.get()); | 2785 CreateTestSharedQuadState(quad_to_target_transform, viewport, pass.get()); |
2784 | 2786 |
2785 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 2787 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
2786 TextureDrawQuad* quad = pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 2788 TextureDrawQuad* quad = pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
2787 quad->SetNew(shared_state, viewport, gfx::Rect(), viewport, resource, false, | 2789 quad->SetNew(shared_state, viewport, gfx::Rect(), viewport, resource, false, |
2788 gfx::PointF(0, 0), gfx::PointF(1, 1), SK_ColorBLACK, | 2790 gfx::PointF(0, 0), gfx::PointF(1, 1), SK_ColorBLACK, |
2789 vertex_opacity, false, nearest_neighbor); | 2791 vertex_opacity, false, nearest_neighbor, false); |
2790 | 2792 |
2791 RenderPassList pass_list; | 2793 RenderPassList pass_list; |
2792 pass_list.push_back(std::move(pass)); | 2794 pass_list.push_back(std::move(pass)); |
2793 | 2795 |
2794 // Allow for a small amount of error as the blending alogrithm used by Skia is | 2796 // Allow for a small amount of error as the blending alogrithm used by Skia is |
2795 // affected by the offset in the expanded rect. | 2797 // affected by the offset in the expanded rect. |
2796 EXPECT_TRUE(this->RunPixelTest( | 2798 EXPECT_TRUE(this->RunPixelTest( |
2797 &pass_list, | 2799 &pass_list, |
2798 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers_linear.png")), | 2800 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers_linear.png")), |
2799 FuzzyPixelComparator(false, 100.f, 0.f, 16.f, 16.f, 0.f))); | 2801 FuzzyPixelComparator(false, 100.f, 0.f, 16.f, 16.f, 0.f))); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3158 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 3160 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
3159 gfx::Rect layer_rect(x_start, y_start, x_end - x_start, y_end - y_start); | 3161 gfx::Rect layer_rect(x_start, y_start, x_end - x_start, y_end - y_start); |
3160 gfx::RectF uv_rect = gfx::ScaleRect( | 3162 gfx::RectF uv_rect = gfx::ScaleRect( |
3161 gfx::RectF(layer_rect), 1.f / rect.width(), 1.f / rect.height()); | 3163 gfx::RectF(layer_rect), 1.f / rect.width(), 1.f / rect.height()); |
3162 | 3164 |
3163 TextureDrawQuad* texture_quad = | 3165 TextureDrawQuad* texture_quad = |
3164 pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 3166 pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
3165 texture_quad->SetNew(shared_state, layer_rect, layer_rect, layer_rect, | 3167 texture_quad->SetNew(shared_state, layer_rect, layer_rect, layer_rect, |
3166 resource, true, uv_rect.origin(), | 3168 resource, true, uv_rect.origin(), |
3167 uv_rect.bottom_right(), SK_ColorWHITE, | 3169 uv_rect.bottom_right(), SK_ColorWHITE, |
3168 vertex_opacity, false, false); | 3170 vertex_opacity, false, false, false); |
3169 } | 3171 } |
3170 } | 3172 } |
3171 | 3173 |
3172 RenderPassList pass_list; | 3174 RenderPassList pass_list; |
3173 pass_list.push_back(std::move(pass)); | 3175 pass_list.push_back(std::move(pass)); |
3174 | 3176 |
3175 EXPECT_TRUE(this->RunPixelTest( | 3177 EXPECT_TRUE(this->RunPixelTest( |
3176 &pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")), | 3178 &pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")), |
3177 FuzzyPixelOffByOneComparator(true))); | 3179 FuzzyPixelOffByOneComparator(true))); |
3178 } | 3180 } |
3179 | 3181 |
3180 #endif // !defined(OS_ANDROID) | 3182 #endif // !defined(OS_ANDROID) |
3181 | 3183 |
3182 } // namespace | 3184 } // namespace |
3183 } // namespace cc | 3185 } // namespace cc |
OLD | NEW |