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 "cc/tiled_layer.h" | 7 #include "cc/tiled_layer.h" |
8 | 8 |
9 #include "cc/bitmap_content_layer_updater.h" | 9 #include "cc/bitmap_content_layer_updater.h" |
10 #include "cc/layer_painter.h" | 10 #include "cc/layer_painter.h" |
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 layerTreeHost->commitComplete(); | 1522 layerTreeHost->commitComplete(); |
1523 | 1523 |
1524 textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_reso
urceProvider.get()); | 1524 textureManagerClearAllMemory(layerTreeHost->contentsTextureManager(), m_reso
urceProvider.get()); |
1525 layerTreeHost->setRootLayer(0); | 1525 layerTreeHost->setRootLayer(0); |
1526 } | 1526 } |
1527 | 1527 |
1528 class TrackingLayerPainter : public LayerPainter { | 1528 class TrackingLayerPainter : public LayerPainter { |
1529 public: | 1529 public: |
1530 static scoped_ptr<TrackingLayerPainter> create() { return make_scoped_ptr(ne
w TrackingLayerPainter()); } | 1530 static scoped_ptr<TrackingLayerPainter> create() { return make_scoped_ptr(ne
w TrackingLayerPainter()); } |
1531 | 1531 |
1532 virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect&) OVERRI
DE | 1532 virtual void paint(SkCanvas*, const gfx::Rect& contentRect, gfx::RectF&) OVE
RRIDE |
1533 { | 1533 { |
1534 m_paintedRect = contentRect; | 1534 m_paintedRect = contentRect; |
1535 } | 1535 } |
1536 | 1536 |
1537 const IntRect& paintedRect() const { return m_paintedRect; } | 1537 const gfx::Rect& paintedRect() const { return m_paintedRect; } |
1538 void resetPaintedRect() { m_paintedRect = IntRect(); } | 1538 void resetPaintedRect() { m_paintedRect = gfx::Rect(); } |
1539 | 1539 |
1540 private: | 1540 private: |
1541 TrackingLayerPainter() { } | 1541 TrackingLayerPainter() { } |
1542 | 1542 |
1543 IntRect m_paintedRect; | 1543 gfx::Rect m_paintedRect; |
1544 }; | 1544 }; |
1545 | 1545 |
1546 class UpdateTrackingTiledLayer : public FakeTiledLayer { | 1546 class UpdateTrackingTiledLayer : public FakeTiledLayer { |
1547 public: | 1547 public: |
1548 explicit UpdateTrackingTiledLayer(PrioritizedTextureManager* manager) | 1548 explicit UpdateTrackingTiledLayer(PrioritizedTextureManager* manager) |
1549 : FakeTiledLayer(manager) | 1549 : FakeTiledLayer(manager) |
1550 { | 1550 { |
1551 scoped_ptr<TrackingLayerPainter> trackingLayerPainter(TrackingLayerPaint
er::create()); | 1551 scoped_ptr<TrackingLayerPainter> trackingLayerPainter(TrackingLayerPaint
er::create()); |
1552 m_trackingLayerPainter = trackingLayerPainter.get(); | 1552 m_trackingLayerPainter = trackingLayerPainter.get(); |
1553 m_layerUpdater = BitmapContentLayerUpdater::create(trackingLayerPainter.
PassAs<LayerPainter>()); | 1553 m_layerUpdater = BitmapContentLayerUpdater::create(trackingLayerPainter.
PassAs<LayerPainter>()); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 updateTextures(); | 1620 updateTextures(); |
1621 | 1621 |
1622 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. | 1622 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. |
1623 layer->setNeedsDisplayRect(layerRect); | 1623 layer->setNeedsDisplayRect(layerRect); |
1624 layer->update(*m_queue.get(), 0, m_stats); | 1624 layer->update(*m_queue.get(), 0, m_stats); |
1625 | 1625 |
1626 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); | 1626 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
1627 } | 1627 } |
1628 | 1628 |
1629 } // namespace | 1629 } // namespace |
OLD | NEW |