| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host_impl.h" | 5 #include "cc/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 m_quadsAppended = true; | 1718 m_quadsAppended = true; |
| 1719 | 1719 |
| 1720 gfx::Rect opaqueRect; | 1720 gfx::Rect opaqueRect; |
| 1721 if (contentsOpaque()) | 1721 if (contentsOpaque()) |
| 1722 opaqueRect = m_quadRect; | 1722 opaqueRect = m_quadRect; |
| 1723 else | 1723 else |
| 1724 opaqueRect = m_opaqueContentRect; | 1724 opaqueRect = m_opaqueContentRect; |
| 1725 | 1725 |
| 1726 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSha
redQuadState()); | 1726 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSha
redQuadState()); |
| 1727 scoped_ptr<TileDrawQuad> testBlendingDrawQuad = TileDrawQuad::Create(); | 1727 scoped_ptr<TileDrawQuad> testBlendingDrawQuad = TileDrawQuad::Create(); |
| 1728 testBlendingDrawQuad->SetNew(sharedQuadState, m_quadRect, opaqueRect, m_
resourceId, gfx::RectF(0, 0, 1, 1), gfx::Size(1, 1), false, false, false, false,
false); | 1728 testBlendingDrawQuad->SetNew(sharedQuadState, m_quadRect, opaqueRect, Dr
awQuad::AntiAliasing(), m_resourceId, gfx::RectF(0, 0, 1, 1), gfx::Size(1, 1), f
alse); |
| 1729 testBlendingDrawQuad->visible_rect = m_quadVisibleRect; | 1729 testBlendingDrawQuad->visible_rect = m_quadVisibleRect; |
| 1730 EXPECT_EQ(m_blend, testBlendingDrawQuad->ShouldDrawWithBlending()); | 1730 EXPECT_EQ(m_blend, testBlendingDrawQuad->ShouldDrawWithBlending()); |
| 1731 EXPECT_EQ(m_hasRenderSurface, !!renderSurface()); | 1731 EXPECT_EQ(m_hasRenderSurface, !!renderSurface()); |
| 1732 quadSink.append(testBlendingDrawQuad.PassAs<DrawQuad>(), appendQuadsData
); | 1732 quadSink.append(testBlendingDrawQuad.PassAs<DrawQuad>(), appendQuadsData
); |
| 1733 } | 1733 } |
| 1734 | 1734 |
| 1735 void setExpectation(bool blend, bool hasRenderSurface) | 1735 void setExpectation(bool blend, bool hasRenderSurface) |
| 1736 { | 1736 { |
| 1737 m_blend = blend; | 1737 m_blend = blend; |
| 1738 m_hasRenderSurface = hasRenderSurface; | 1738 m_hasRenderSurface = hasRenderSurface; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2219 public: | 2219 public: |
| 2220 static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id) { retur
n scoped_ptr<LayerImpl>(new FakeLayerWithQuads(treeImpl, id)); } | 2220 static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id) { retur
n scoped_ptr<LayerImpl>(new FakeLayerWithQuads(treeImpl, id)); } |
| 2221 | 2221 |
| 2222 virtual void appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsDat
a) OVERRIDE | 2222 virtual void appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsDat
a) OVERRIDE |
| 2223 { | 2223 { |
| 2224 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSha
redQuadState()); | 2224 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSha
redQuadState()); |
| 2225 | 2225 |
| 2226 SkColor gray = SkColorSetRGB(100, 100, 100); | 2226 SkColor gray = SkColorSetRGB(100, 100, 100); |
| 2227 gfx::Rect quadRect(gfx::Point(0, 0), contentBounds()); | 2227 gfx::Rect quadRect(gfx::Point(0, 0), contentBounds()); |
| 2228 scoped_ptr<SolidColorDrawQuad> myQuad = SolidColorDrawQuad::Create(); | 2228 scoped_ptr<SolidColorDrawQuad> myQuad = SolidColorDrawQuad::Create(); |
| 2229 myQuad->SetNew(sharedQuadState, quadRect, gray); | 2229 myQuad->SetNew(sharedQuadState, quadRect, DrawQuad::AntiAliasing(), gray
); |
| 2230 quadSink.append(myQuad.PassAs<DrawQuad>(), appendQuadsData); | 2230 quadSink.append(myQuad.PassAs<DrawQuad>(), appendQuadsData); |
| 2231 } | 2231 } |
| 2232 | 2232 |
| 2233 private: | 2233 private: |
| 2234 FakeLayerWithQuads(LayerTreeImpl* treeImpl, int id) | 2234 FakeLayerWithQuads(LayerTreeImpl* treeImpl, int id) |
| 2235 : LayerImpl(treeImpl, id) | 2235 : LayerImpl(treeImpl, id) |
| 2236 { | 2236 { |
| 2237 } | 2237 } |
| 2238 }; | 2238 }; |
| 2239 | 2239 |
| (...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3740 if (!testData.renderPassCache.contains(renderPassId)) | 3740 if (!testData.renderPassCache.contains(renderPassId)) |
| 3741 isReplica = true; | 3741 isReplica = true; |
| 3742 | 3742 |
| 3743 scoped_ptr<TestRenderPass> renderPass = testData.renderPassCache.take(re
nderPassId); | 3743 scoped_ptr<TestRenderPass> renderPass = testData.renderPassCache.take(re
nderPassId); |
| 3744 | 3744 |
| 3745 // Cycle through quad data and create all quads | 3745 // Cycle through quad data and create all quads |
| 3746 while (*currentChar && *currentChar != '\n') { | 3746 while (*currentChar && *currentChar != '\n') { |
| 3747 if (*currentChar == 's') { | 3747 if (*currentChar == 's') { |
| 3748 // Solid color draw quad | 3748 // Solid color draw quad |
| 3749 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create
(); | 3749 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create
(); |
| 3750 quad->SetNew(testData.sharedQuadState.get(), gfx::Rect(0, 0, 10,
10), SK_ColorWHITE); | 3750 quad->SetNew(testData.sharedQuadState.get(), gfx::Rect(0, 0, 10,
10), DrawQuad::AntiAliasing(), SK_ColorWHITE); |
| 3751 | 3751 |
| 3752 renderPass->AppendQuad(quad.PassAs<DrawQuad>()); | 3752 renderPass->AppendQuad(quad.PassAs<DrawQuad>()); |
| 3753 currentChar++; | 3753 currentChar++; |
| 3754 } else if ((*currentChar >= 'A') && (*currentChar <= 'Z')) { | 3754 } else if ((*currentChar >= 'A') && (*currentChar <= 'Z')) { |
| 3755 // RenderPass draw quad | 3755 // RenderPass draw quad |
| 3756 int layerId = *currentChar; | 3756 int layerId = *currentChar; |
| 3757 currentChar++; | 3757 currentChar++; |
| 3758 ASSERT_TRUE(currentChar); | 3758 ASSERT_TRUE(currentChar); |
| 3759 int index = *currentChar; | 3759 int index = *currentChar; |
| 3760 currentChar++; | 3760 currentChar++; |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4412 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); | 4412 gfx::Rect noDamage = gfx::Rect(m_hostImpl->deviceViewportSize()); |
| 4413 drawFrameAndTestDamage(noDamage); | 4413 drawFrameAndTestDamage(noDamage); |
| 4414 } | 4414 } |
| 4415 | 4415 |
| 4416 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4416 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
| 4417 LayerTreeHostImplTest, | 4417 LayerTreeHostImplTest, |
| 4418 ::testing::Values(false, true)); | 4418 ::testing::Values(false, true)); |
| 4419 | 4419 |
| 4420 } // namespace | 4420 } // namespace |
| 4421 } // namespace cc | 4421 } // namespace cc |
| OLD | NEW |