| 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/render_pass.h" | 5 #include "cc/render_pass.h" |
| 6 | 6 |
| 7 #include "cc/checkerboard_draw_quad.h" | 7 #include "cc/checkerboard_draw_quad.h" |
| 8 #include "cc/math_util.h" | 8 #include "cc/math_util.h" |
| 9 #include "cc/test/geometry_test_utils.h" | 9 #include "cc/test/geometry_test_utils.h" |
| 10 #include "cc/test/render_pass_test_common.h" | 10 #include "cc/test/render_pass_test_common.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
| 13 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 13 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| 14 #include "ui/gfx/transform.h" | 14 #include "ui/gfx/transform.h" |
| 15 #include "ui/gfx/transform_util.h" |
| 15 | 16 |
| 16 using cc::TestRenderPass; | 17 using cc::TestRenderPass; |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 struct RenderPassSize { | 22 struct RenderPassSize { |
| 22 // If you add a new field to this class, make sure to add it to the copy() t
ests. | 23 // If you add a new field to this class, make sure to add it to the copy() t
ests. |
| 23 RenderPass::Id m_id; | 24 RenderPass::Id m_id; |
| 24 QuadList m_quadList; | 25 QuadList m_quadList; |
| 25 SharedQuadStateList m_sharedQuadStateList; | 26 SharedQuadStateList m_sharedQuadStateList; |
| 26 gfx::Transform m_transformToRootTarget; | 27 gfx::Transform m_transformToRootTarget; |
| 27 gfx::Rect m_outputRect; | 28 gfx::Rect m_outputRect; |
| 28 gfx::RectF m_damageRect; | 29 gfx::RectF m_damageRect; |
| 29 bool m_hasTransparentBackground; | 30 bool m_hasTransparentBackground; |
| 30 bool m_hasOcclusionFromOutsideTargetSurface; | 31 bool m_hasOcclusionFromOutsideTargetSurface; |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 TEST(RenderPassTest, copyShouldBeIdenticalExceptIdAndQuads) | 34 TEST(RenderPassTest, copyShouldBeIdenticalExceptIdAndQuads) |
| 34 { | 35 { |
| 35 RenderPass::Id id(3, 2); | 36 RenderPass::Id id(3, 2); |
| 36 gfx::Rect outputRect(45, 22, 120, 13); | 37 gfx::Rect outputRect(45, 22, 120, 13); |
| 37 gfx::Transform transformToRoot = MathUtil::createGfxTransform(1, 0.5, 0.5, -
0.5, -1, 0); | 38 gfx::Transform transformToRoot = gfx::CreateGfxTransform(1, 0.5, 0.5, -0.5,
-1, 0); |
| 38 gfx::Rect damageRect(56, 123, 19, 43); | 39 gfx::Rect damageRect(56, 123, 19, 43); |
| 39 bool hasTransparentBackground = true; | 40 bool hasTransparentBackground = true; |
| 40 bool hasOcclusionFromOutsideTargetSurface = true; | 41 bool hasOcclusionFromOutsideTargetSurface = true; |
| 41 | 42 |
| 42 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); | 43 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); |
| 43 pass->SetAll(id, | 44 pass->SetAll(id, |
| 44 outputRect, | 45 outputRect, |
| 45 damageRect, | 46 damageRect, |
| 46 transformToRoot, | 47 transformToRoot, |
| 47 hasTransparentBackground, | 48 hasTransparentBackground, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 EXPECT_RECT_EQ(pass->damage_rect, copy->damage_rect); | 66 EXPECT_RECT_EQ(pass->damage_rect, copy->damage_rect); |
| 66 EXPECT_EQ(pass->has_transparent_background, copy->has_transparent_background
); | 67 EXPECT_EQ(pass->has_transparent_background, copy->has_transparent_background
); |
| 67 EXPECT_EQ(pass->has_occlusion_from_outside_target_surface, copy->has_occlusi
on_from_outside_target_surface); | 68 EXPECT_EQ(pass->has_occlusion_from_outside_target_surface, copy->has_occlusi
on_from_outside_target_surface); |
| 68 EXPECT_EQ(0u, copy->quad_list.size()); | 69 EXPECT_EQ(0u, copy->quad_list.size()); |
| 69 | 70 |
| 70 EXPECT_EQ(sizeof(RenderPassSize), sizeof(RenderPass)); | 71 EXPECT_EQ(sizeof(RenderPassSize), sizeof(RenderPass)); |
| 71 } | 72 } |
| 72 | 73 |
| 73 } // namespace | 74 } // namespace |
| 74 } // namespace cc | 75 } // namespace cc |
| OLD | NEW |