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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "cc/layers/append_quads_data.h" | 6 #include "cc/layers/append_quads_data.h" |
7 #include "cc/output/gl_renderer.h" | 7 #include "cc/output/gl_renderer.h" |
8 #include "cc/quads/draw_quad.h" | 8 #include "cc/quads/draw_quad.h" |
9 #include "cc/quads/picture_draw_quad.h" | 9 #include "cc/quads/picture_draw_quad.h" |
10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
11 #include "cc/resources/platform_color.h" | 11 #include "cc/resources/platform_color.h" |
12 #include "cc/resources/sync_point_helper.h" | 12 #include "cc/resources/sync_point_helper.h" |
13 #include "cc/test/fake_picture_pile_impl.h" | 13 #include "cc/test/fake_picture_pile_impl.h" |
14 #include "cc/test/pixel_test.h" | 14 #include "cc/test/pixel_test.h" |
15 #include "gpu/GLES2/gl2extchromium.h" | 15 #include "gpu/GLES2/gl2extchromium.h" |
| 16 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
16 #include "third_party/skia/include/core/SkImageFilter.h" | 17 #include "third_party/skia/include/core/SkImageFilter.h" |
17 #include "third_party/skia/include/core/SkMatrix.h" | 18 #include "third_party/skia/include/core/SkMatrix.h" |
18 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h" | 19 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h" |
19 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" | 20 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" |
20 #include "ui/gfx/rect_conversions.h" | 21 #include "ui/gfx/rect_conversions.h" |
21 | 22 |
22 namespace cc { | 23 namespace cc { |
23 namespace { | 24 namespace { |
24 | 25 |
25 scoped_ptr<RenderPass> CreateTestRootRenderPass(RenderPass::Id id, | 26 scoped_ptr<RenderPass> CreateTestRootRenderPass(RenderPass::Id id, |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 this->SetUpRenderPassList(); | 997 this->SetUpRenderPassList(); |
997 EXPECT_TRUE(this->RunPixelTest( | 998 EXPECT_TRUE(this->RunPixelTest( |
998 &this->pass_list_, | 999 &this->pass_list_, |
999 base::FilePath(FILE_PATH_LITERAL("background_filter.png")), | 1000 base::FilePath(FILE_PATH_LITERAL("background_filter.png")), |
1000 ExactPixelComparator(true))); | 1001 ExactPixelComparator(true))); |
1001 } | 1002 } |
1002 | 1003 |
1003 class ExternalStencilPixelTest : public GLRendererPixelTest { | 1004 class ExternalStencilPixelTest : public GLRendererPixelTest { |
1004 protected: | 1005 protected: |
1005 void ClearBackgroundToGreen() { | 1006 void ClearBackgroundToGreen() { |
1006 WebKit::WebGraphicsContext3D* context3d = output_surface_->context3d(); | 1007 WebKit::WebGraphicsContext3D* context3d = |
| 1008 output_surface_->context_provider()->Context3d(); |
1007 output_surface_->EnsureBackbuffer(); | 1009 output_surface_->EnsureBackbuffer(); |
1008 output_surface_->Reshape(device_viewport_size_, 1); | 1010 output_surface_->Reshape(device_viewport_size_, 1); |
1009 context3d->clearColor(0.f, 1.f, 0.f, 1.f); | 1011 context3d->clearColor(0.f, 1.f, 0.f, 1.f); |
1010 context3d->clear(GL_COLOR_BUFFER_BIT); | 1012 context3d->clear(GL_COLOR_BUFFER_BIT); |
1011 } | 1013 } |
1012 | 1014 |
1013 void PopulateStencilBuffer() { | 1015 void PopulateStencilBuffer() { |
1014 // Set two quadrants of the stencil buffer to 1. | 1016 // Set two quadrants of the stencil buffer to 1. |
1015 WebKit::WebGraphicsContext3D* context3d = output_surface_->context3d(); | 1017 WebKit::WebGraphicsContext3D* context3d = |
| 1018 output_surface_->context_provider()->Context3d(); |
1016 ASSERT_TRUE(context3d->getContextAttributes().stencil); | 1019 ASSERT_TRUE(context3d->getContextAttributes().stencil); |
1017 output_surface_->EnsureBackbuffer(); | 1020 output_surface_->EnsureBackbuffer(); |
1018 output_surface_->Reshape(device_viewport_size_, 1); | 1021 output_surface_->Reshape(device_viewport_size_, 1); |
1019 context3d->clearStencil(0); | 1022 context3d->clearStencil(0); |
1020 context3d->clear(GL_STENCIL_BUFFER_BIT); | 1023 context3d->clear(GL_STENCIL_BUFFER_BIT); |
1021 context3d->enable(GL_SCISSOR_TEST); | 1024 context3d->enable(GL_SCISSOR_TEST); |
1022 context3d->clearStencil(1); | 1025 context3d->clearStencil(1); |
1023 context3d->scissor(0, | 1026 context3d->scissor(0, |
1024 0, | 1027 0, |
1025 device_viewport_size_.width() / 2, | 1028 device_viewport_size_.width() / 2, |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 | 1542 |
1540 EXPECT_TRUE(this->RunPixelTest( | 1543 EXPECT_TRUE(this->RunPixelTest( |
1541 &pass_list, | 1544 &pass_list, |
1542 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 1545 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
1543 ExactPixelComparator(true))); | 1546 ExactPixelComparator(true))); |
1544 } | 1547 } |
1545 #endif // !defined(OS_ANDROID) | 1548 #endif // !defined(OS_ANDROID) |
1546 | 1549 |
1547 } // namespace | 1550 } // namespace |
1548 } // namespace cc | 1551 } // namespace cc |
OLD | NEW |