| 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/test/fake_picture_pile_impl.h" | 11 #include "cc/test/fake_picture_pile_impl.h" |
| 12 #include "cc/test/pixel_test.h" | 12 #include "cc/test/pixel_test.h" |
| 13 #include "gpu/GLES2/gl2extchromium.h" | 13 #include "gpu/GLES2/gl2extchromium.h" |
| 14 #include "gpu/command_buffer/client/gles2_interface.h" | 14 #include "gpu/command_buffer/client/gles2_interface.h" |
| 15 #include "third_party/skia/include/core/SkImageFilter.h" | 15 #include "third_party/skia/include/core/SkImageFilter.h" |
| 16 #include "third_party/skia/include/core/SkMatrix.h" | 16 #include "third_party/skia/include/core/SkMatrix.h" |
| 17 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h" | 17 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h" |
| 18 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" | 18 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" |
| 19 #include "ui/gfx/rect_conversions.h" | 19 #include "ui/gfx/rect_conversions.h" |
| 20 | 20 |
| 21 using gpu::gles2::GLES2Interface; | 21 using gpu::gles2::GLES2Interface; |
| 22 | 22 |
| 23 namespace cc { | 23 namespace cc { |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 #if !defined(OS_ANDROID) | 26 #if !defined(OS_ANDROID) |
| 27 scoped_ptr<RenderPass> CreateTestRootRenderPass(RenderPass::Id id, | 27 scoped_ptr<RenderPass> CreateTestRootRenderPass(RenderPass::Id id, |
| 28 gfx::Rect rect) { | 28 const gfx::Rect& rect) { |
| 29 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 29 scoped_ptr<RenderPass> pass = RenderPass::Create(); |
| 30 const gfx::Rect output_rect = rect; | 30 const gfx::Rect output_rect = rect; |
| 31 const gfx::RectF damage_rect = rect; | 31 const gfx::RectF damage_rect = rect; |
| 32 const gfx::Transform transform_to_root_target; | 32 const gfx::Transform transform_to_root_target; |
| 33 pass->SetNew(id, output_rect, damage_rect, transform_to_root_target); | 33 pass->SetNew(id, output_rect, damage_rect, transform_to_root_target); |
| 34 return pass.Pass(); | 34 return pass.Pass(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 scoped_ptr<RenderPass> CreateTestRenderPass( | 37 scoped_ptr<RenderPass> CreateTestRenderPass( |
| 38 RenderPass::Id id, | 38 RenderPass::Id id, |
| 39 gfx::Rect rect, | 39 const gfx::Rect& rect, |
| 40 const gfx::Transform& transform_to_root_target) { | 40 const gfx::Transform& transform_to_root_target) { |
| 41 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 41 scoped_ptr<RenderPass> pass = RenderPass::Create(); |
| 42 const gfx::Rect output_rect = rect; | 42 const gfx::Rect output_rect = rect; |
| 43 const gfx::RectF damage_rect = rect; | 43 const gfx::RectF damage_rect = rect; |
| 44 pass->SetNew(id, output_rect, damage_rect, transform_to_root_target); | 44 pass->SetNew(id, output_rect, damage_rect, transform_to_root_target); |
| 45 return pass.Pass(); | 45 return pass.Pass(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 scoped_ptr<SharedQuadState> CreateTestSharedQuadState( | 48 scoped_ptr<SharedQuadState> CreateTestSharedQuadState( |
| 49 gfx::Transform content_to_target_transform, gfx::Rect rect) { | 49 gfx::Transform content_to_target_transform, const gfx::Rect& rect) { |
| 50 const gfx::Size content_bounds = rect.size(); | 50 const gfx::Size content_bounds = rect.size(); |
| 51 const gfx::Rect visible_content_rect = rect; | 51 const gfx::Rect visible_content_rect = rect; |
| 52 const gfx::Rect clip_rect = rect; | 52 const gfx::Rect clip_rect = rect; |
| 53 const bool is_clipped = false; | 53 const bool is_clipped = false; |
| 54 const float opacity = 1.0f; | 54 const float opacity = 1.0f; |
| 55 const SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; | 55 const SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; |
| 56 scoped_ptr<SharedQuadState> shared_state = SharedQuadState::Create(); | 56 scoped_ptr<SharedQuadState> shared_state = SharedQuadState::Create(); |
| 57 shared_state->SetAll(content_to_target_transform, | 57 shared_state->SetAll(content_to_target_transform, |
| 58 content_bounds, | 58 content_bounds, |
| 59 visible_content_rect, | 59 visible_content_rect, |
| 60 clip_rect, | 60 clip_rect, |
| 61 is_clipped, | 61 is_clipped, |
| 62 opacity, | 62 opacity, |
| 63 blend_mode); | 63 blend_mode); |
| 64 return shared_state.Pass(); | 64 return shared_state.Pass(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 scoped_ptr<SharedQuadState> CreateTestSharedQuadStateClipped( | 67 scoped_ptr<SharedQuadState> CreateTestSharedQuadStateClipped( |
| 68 gfx::Transform content_to_target_transform, | 68 gfx::Transform content_to_target_transform, |
| 69 gfx::Rect rect, | 69 const gfx::Rect& rect, |
| 70 gfx::Rect clip_rect) { | 70 const gfx::Rect& clip_rect) { |
| 71 const gfx::Size content_bounds = rect.size(); | 71 const gfx::Size content_bounds = rect.size(); |
| 72 const gfx::Rect visible_content_rect = clip_rect; | 72 const gfx::Rect visible_content_rect = clip_rect; |
| 73 const bool is_clipped = true; | 73 const bool is_clipped = true; |
| 74 const float opacity = 1.0f; | 74 const float opacity = 1.0f; |
| 75 const SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; | 75 const SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; |
| 76 scoped_ptr<SharedQuadState> shared_state = SharedQuadState::Create(); | 76 scoped_ptr<SharedQuadState> shared_state = SharedQuadState::Create(); |
| 77 shared_state->SetAll(content_to_target_transform, | 77 shared_state->SetAll(content_to_target_transform, |
| 78 content_bounds, | 78 content_bounds, |
| 79 visible_content_rect, | 79 visible_content_rect, |
| 80 clip_rect, | 80 clip_rect, |
| 81 is_clipped, | 81 is_clipped, |
| 82 opacity, | 82 opacity, |
| 83 blend_mode); | 83 blend_mode); |
| 84 return shared_state.Pass(); | 84 return shared_state.Pass(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 scoped_ptr<DrawQuad> CreateTestRenderPassDrawQuad( | 87 scoped_ptr<DrawQuad> CreateTestRenderPassDrawQuad( |
| 88 SharedQuadState* shared_state, gfx::Rect rect, RenderPass::Id pass_id) { | 88 SharedQuadState* shared_state, |
| 89 const gfx::Rect& rect, |
| 90 RenderPass::Id pass_id) { |
| 89 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); | 91 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); |
| 90 quad->SetNew(shared_state, | 92 quad->SetNew(shared_state, |
| 91 rect, | 93 rect, |
| 92 pass_id, | 94 pass_id, |
| 93 false, // is_replica | 95 false, // is_replica |
| 94 0, // mask_resource_id | 96 0, // mask_resource_id |
| 95 rect, // contents_changed_since_last_frame | 97 rect, // contents_changed_since_last_frame |
| 96 gfx::RectF(1.f, 1.f), // mask_uv_rect | 98 gfx::RectF(1.f, 1.f), // mask_uv_rect |
| 97 FilterOperations(), // foreground filters | 99 FilterOperations(), // foreground filters |
| 98 FilterOperations()); // background filters | 100 FilterOperations()); // background filters |
| 99 | 101 |
| 100 return quad.PassAs<DrawQuad>(); | 102 return quad.PassAs<DrawQuad>(); |
| 101 } | 103 } |
| 102 | 104 |
| 103 scoped_ptr<TextureDrawQuad> CreateTestTextureDrawQuad( | 105 scoped_ptr<TextureDrawQuad> CreateTestTextureDrawQuad( |
| 104 gfx::Rect rect, | 106 const gfx::Rect& rect, |
| 105 SkColor texel_color, | 107 SkColor texel_color, |
| 106 SkColor background_color, | 108 SkColor background_color, |
| 107 bool premultiplied_alpha, | 109 bool premultiplied_alpha, |
| 108 SharedQuadState* shared_state, | 110 SharedQuadState* shared_state, |
| 109 ResourceProvider* resource_provider) { | 111 ResourceProvider* resource_provider) { |
| 110 SkPMColor pixel_color = premultiplied_alpha ? | 112 SkPMColor pixel_color = premultiplied_alpha ? |
| 111 SkPreMultiplyColor(texel_color) : | 113 SkPreMultiplyColor(texel_color) : |
| 112 SkPackARGB32NoCheck(SkColorGetA(texel_color), | 114 SkPackARGB32NoCheck(SkColorGetA(texel_color), |
| 113 SkColorGetR(texel_color), | 115 SkColorGetR(texel_color), |
| 114 SkColorGetG(texel_color), | 116 SkColorGetG(texel_color), |
| (...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2051 &pass_list, | 2053 &pass_list, |
| 2052 PixelTest::NoOffscreenContext, | 2054 PixelTest::NoOffscreenContext, |
| 2053 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), | 2055 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), |
| 2054 FuzzyPixelOffByOneComparator(true))); | 2056 FuzzyPixelOffByOneComparator(true))); |
| 2055 } | 2057 } |
| 2056 | 2058 |
| 2057 #endif // !defined(OS_ANDROID) | 2059 #endif // !defined(OS_ANDROID) |
| 2058 | 2060 |
| 2059 } // namespace | 2061 } // namespace |
| 2060 } // namespace cc | 2062 } // namespace cc |
| OLD | NEW |