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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "TiledLayerChromium.h" | 7 #include "TiledLayerChromium.h" |
8 | 8 |
9 #include "BitmapCanvasLayerTextureUpdater.h" | 9 #include "BitmapCanvasLayerTextureUpdater.h" |
10 #include "CCAnimationTestCommon.h" | 10 #include "CCAnimationTestCommon.h" |
11 #include "CCGeometryTestUtils.h" | 11 #include "CCGeometryTestUtils.h" |
12 #include "CCOverdrawMetrics.h" | 12 #include "CCOverdrawMetrics.h" |
13 #include "CCRenderingStats.h" | 13 #include "CCRenderingStats.h" |
14 #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread | 14 #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread |
15 #include "CCTextureUpdateController.h" | 15 #include "CCTextureUpdateController.h" |
16 #include "CCTiledLayerTestCommon.h" | 16 #include "CCTiledLayerTestCommon.h" |
17 #include "FakeCCGraphicsContext.h" | 17 #include "FakeCCGraphicsContext.h" |
18 #include "FakeCCLayerTreeHostClient.h" | 18 #include "FakeCCLayerTreeHostClient.h" |
19 #include "LayerPainterChromium.h" | 19 #include "LayerPainterChromium.h" |
20 #include "WebCompositorInitializer.h" | 20 #include "WebCompositorInitializer.h" |
21 #include <gtest/gtest.h> | 21 #include <gtest/gtest.h> |
22 #include <public/WebTransformationMatrix.h> | 22 #include <public/WebTransformationMatrix.h> |
23 | 23 |
24 using namespace WebCore; | 24 using namespace cc; |
25 using namespace WebKitTests; | 25 using namespace WebKitTests; |
26 using namespace WTF; | 26 using namespace WTF; |
27 using WebKit::WebTransformationMatrix; | 27 using WebKit::WebTransformationMatrix; |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 class TestCCOcclusionTracker : public CCOcclusionTracker { | 31 class TestCCOcclusionTracker : public CCOcclusionTracker { |
32 public: | 32 public: |
33 TestCCOcclusionTracker() | 33 TestCCOcclusionTracker() |
34 : CCOcclusionTracker(IntRect(0, 0, 1000, 1000), true) | 34 : CCOcclusionTracker(IntRect(0, 0, 1000, 1000), true) |
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 void resetPaintedRect() { m_paintedRect = IntRect(); } | 1464 void resetPaintedRect() { m_paintedRect = IntRect(); } |
1465 | 1465 |
1466 private: | 1466 private: |
1467 TrackingLayerPainter() { } | 1467 TrackingLayerPainter() { } |
1468 | 1468 |
1469 IntRect m_paintedRect; | 1469 IntRect m_paintedRect; |
1470 }; | 1470 }; |
1471 | 1471 |
1472 class UpdateTrackingTiledLayerChromium : public FakeTiledLayerChromium { | 1472 class UpdateTrackingTiledLayerChromium : public FakeTiledLayerChromium { |
1473 public: | 1473 public: |
1474 explicit UpdateTrackingTiledLayerChromium(WebCore::CCPrioritizedTextureManag
er* manager) | 1474 explicit UpdateTrackingTiledLayerChromium(CCPrioritizedTextureManager* manag
er) |
1475 : FakeTiledLayerChromium(manager) | 1475 : FakeTiledLayerChromium(manager) |
1476 { | 1476 { |
1477 OwnPtr<TrackingLayerPainter> trackingLayerPainter(TrackingLayerPainter::
create()); | 1477 OwnPtr<TrackingLayerPainter> trackingLayerPainter(TrackingLayerPainter::
create()); |
1478 m_trackingLayerPainter = trackingLayerPainter.get(); | 1478 m_trackingLayerPainter = trackingLayerPainter.get(); |
1479 m_layerTextureUpdater = BitmapCanvasLayerTextureUpdater::create(tracking
LayerPainter.release()); | 1479 m_layerTextureUpdater = BitmapCanvasLayerTextureUpdater::create(tracking
LayerPainter.release()); |
1480 } | 1480 } |
1481 virtual ~UpdateTrackingTiledLayerChromium() { } | 1481 virtual ~UpdateTrackingTiledLayerChromium() { } |
1482 | 1482 |
1483 TrackingLayerPainter* trackingLayerPainter() const { return m_trackingLayerP
ainter; } | 1483 TrackingLayerPainter* trackingLayerPainter() const { return m_trackingLayerP
ainter; } |
1484 | 1484 |
1485 protected: | 1485 protected: |
1486 virtual WebCore::LayerTextureUpdater* textureUpdater() const OVERRIDE { retu
rn m_layerTextureUpdater.get(); } | 1486 virtual LayerTextureUpdater* textureUpdater() const OVERRIDE { return m_laye
rTextureUpdater.get(); } |
1487 | 1487 |
1488 private: | 1488 private: |
1489 TrackingLayerPainter* m_trackingLayerPainter; | 1489 TrackingLayerPainter* m_trackingLayerPainter; |
1490 RefPtr<BitmapCanvasLayerTextureUpdater> m_layerTextureUpdater; | 1490 RefPtr<BitmapCanvasLayerTextureUpdater> m_layerTextureUpdater; |
1491 }; | 1491 }; |
1492 | 1492 |
1493 TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) | 1493 TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) |
1494 { | 1494 { |
1495 RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTracking
TiledLayerChromium(m_textureManager.get())); | 1495 RefPtr<UpdateTrackingTiledLayerChromium> layer = adoptRef(new UpdateTracking
TiledLayerChromium(m_textureManager.get())); |
1496 | 1496 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 updateTextures(); | 1545 updateTextures(); |
1546 | 1546 |
1547 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. | 1547 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. |
1548 layer->setNeedsDisplayRect(layerRect); | 1548 layer->setNeedsDisplayRect(layerRect); |
1549 layer->update(m_queue, 0, m_stats); | 1549 layer->update(m_queue, 0, m_stats); |
1550 | 1550 |
1551 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); | 1551 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
1552 } | 1552 } |
1553 | 1553 |
1554 } // namespace | 1554 } // namespace |
OLD | NEW |