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/tiled_layer.h" | 5 #include "cc/tiled_layer.h" |
6 | 6 |
7 #include "cc/bitmap_content_layer_updater.h" | 7 #include "cc/bitmap_content_layer_updater.h" |
8 #include "cc/layer_painter.h" | 8 #include "cc/layer_painter.h" |
9 #include "cc/overdraw_metrics.h" | 9 #include "cc/overdraw_metrics.h" |
10 #include "cc/prioritized_resource_manager.h" | 10 #include "cc/prioritized_resource_manager.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ui/gfx/rect_conversions.h" | 22 #include "ui/gfx/rect_conversions.h" |
23 #include "ui/gfx/transform.h" | 23 #include "ui/gfx/transform.h" |
24 | 24 |
25 namespace cc { | 25 namespace cc { |
26 namespace { | 26 namespace { |
27 | 27 |
28 class TestOcclusionTracker : public OcclusionTracker { | 28 class TestOcclusionTracker : public OcclusionTracker { |
29 public: | 29 public: |
30 TestOcclusionTracker() | 30 TestOcclusionTracker() |
31 : OcclusionTracker(gfx::Rect(0, 0, 1000, 1000), true) | 31 : OcclusionTracker(gfx::Rect(0, 0, 1000, 1000), true) |
32 , m_layerClipRectInTarget(gfx::Rect(0, 0, 1000, 1000)) | |
33 { | 32 { |
34 m_stack.push_back(StackObject()); | 33 m_stack.push_back(StackObject()); |
35 } | 34 } |
36 | 35 |
37 void setRenderTarget(Layer* renderTarget) | 36 void setRenderTarget(Layer* renderTarget) |
38 { | 37 { |
39 m_stack.back().target = renderTarget; | 38 m_stack.back().target = renderTarget; |
40 } | 39 } |
41 | 40 |
42 void setOcclusion(const Region& occlusion) { m_stack.back().occlusionFromIns
ideTarget = occlusion; } | 41 void setOcclusion(const Region& occlusion) |
43 | 42 { |
44 protected: | 43 m_stack.back().occlusionFromInsideTarget = occlusion; |
45 virtual gfx::Rect layerClipRectInTarget(const Layer* layer) const OVERRIDE {
return m_layerClipRectInTarget; } | 44 } |
46 | |
47 private: | |
48 gfx::Rect m_layerClipRectInTarget; | |
49 }; | 45 }; |
50 | 46 |
51 class TiledLayerTest : public testing::Test { | 47 class TiledLayerTest : public testing::Test { |
52 public: | 48 public: |
53 TiledLayerTest() | 49 TiledLayerTest() |
54 : m_proxy(NULL) | 50 : m_proxy(NULL) |
55 , m_outputSurface(createFakeOutputSurface()) | 51 , m_outputSurface(createFakeOutputSurface()) |
56 , m_queue(make_scoped_ptr(new ResourceUpdateQueue)) | 52 , m_queue(make_scoped_ptr(new ResourceUpdateQueue)) |
57 , m_occlusion(0) | 53 , m_occlusion(0) |
58 { | 54 { |
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 | 1670 |
1675 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. | 1671 // Invalidate the entire layer in layer space. When painting, the rect given
to webkit should match the layer's bounds. |
1676 layer->setNeedsDisplayRect(layerRect); | 1672 layer->setNeedsDisplayRect(layerRect); |
1677 layer->update(*m_queue.get(), 0, m_stats); | 1673 layer->update(*m_queue.get(), 0, m_stats); |
1678 | 1674 |
1679 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); | 1675 EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); |
1680 } | 1676 } |
1681 | 1677 |
1682 } // namespace | 1678 } // namespace |
1683 } // namespace cc | 1679 } // namespace cc |
OLD | NEW |