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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/test/tiled_layer_test_common.h" | 7 #include "cc/test/tiled_layer_test_common.h" |
8 | 8 |
9 using namespace cc; | 9 using namespace cc; |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 FakeLayerUpdater::~FakeLayerUpdater() | 44 FakeLayerUpdater::~FakeLayerUpdater() |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 void FakeLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::
Size&, float, float, gfx::Rect& resultingOpaqueRect, RenderingStats&) | 48 void FakeLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::
Size&, float, float, gfx::Rect& resultingOpaqueRect, RenderingStats&) |
49 { | 49 { |
50 m_prepareCount++; | 50 m_prepareCount++; |
51 m_lastUpdateRect = contentRect; | 51 m_lastUpdateRect = contentRect; |
52 if (!m_rectToInvalidate.isEmpty()) { | 52 if (!m_rectToInvalidate.IsEmpty()) { |
53 m_layer->invalidateContentRect(m_rectToInvalidate); | 53 m_layer->invalidateContentRect(m_rectToInvalidate); |
54 m_rectToInvalidate = IntRect(); | 54 m_rectToInvalidate = gfx::Rect(); |
55 m_layer = NULL; | 55 m_layer = NULL; |
56 } | 56 } |
57 resultingOpaqueRect = m_opaquePaintRect; | 57 resultingOpaqueRect = m_opaquePaintRect; |
58 } | 58 } |
59 | 59 |
60 void FakeLayerUpdater::setRectToInvalidate(const IntRect& rect, FakeTiledLayer*
layer) | 60 void FakeLayerUpdater::setRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer
* layer) |
61 { | 61 { |
62 m_rectToInvalidate = rect; | 62 m_rectToInvalidate = rect; |
63 m_layer = layer; | 63 m_layer = layer; |
64 } | 64 } |
65 | 65 |
66 scoped_ptr<LayerUpdater::Resource> FakeLayerUpdater::createResource(PrioritizedT
extureManager* manager) | 66 scoped_ptr<LayerUpdater::Resource> FakeLayerUpdater::createResource(PrioritizedT
extureManager* manager) |
67 { | 67 { |
68 return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedText
ure::create(manager))); | 68 return scoped_ptr<LayerUpdater::Resource>(new Resource(this, PrioritizedText
ure::create(manager))); |
69 } | 69 } |
70 | 70 |
(...skipping 23 matching lines...) Expand all Loading... |
94 } | 94 } |
95 | 95 |
96 FakeTiledLayerWithScaledBounds::~FakeTiledLayerWithScaledBounds() | 96 FakeTiledLayerWithScaledBounds::~FakeTiledLayerWithScaledBounds() |
97 { | 97 { |
98 } | 98 } |
99 | 99 |
100 FakeTiledLayer::~FakeTiledLayer() | 100 FakeTiledLayer::~FakeTiledLayer() |
101 { | 101 { |
102 } | 102 } |
103 | 103 |
104 void FakeTiledLayer::setNeedsDisplayRect(const FloatRect& rect) | 104 void FakeTiledLayer::setNeedsDisplayRect(const gfx::RectF& rect) |
105 { | 105 { |
106 m_lastNeedsDisplayRect = rect; | 106 m_lastNeedsDisplayRect = rect; |
107 TiledLayer::setNeedsDisplayRect(rect); | 107 TiledLayer::setNeedsDisplayRect(rect); |
108 } | 108 } |
109 | 109 |
110 void FakeTiledLayer::setTexturePriorities(const PriorityCalculator& calculator) | 110 void FakeTiledLayer::setTexturePriorities(const PriorityCalculator& calculator) |
111 { | 111 { |
112 // Ensure there is always a target render surface available. If none has bee
n | 112 // Ensure there is always a target render surface available. If none has bee
n |
113 // set (the layer is an orphan for the test), then just set a surface on its
elf. | 113 // set (the layer is an orphan for the test), then just set a surface on its
elf. |
114 bool missingTargetRenderSurface = !renderTarget(); | 114 bool missingTargetRenderSurface = !renderTarget(); |
(...skipping 12 matching lines...) Expand all Loading... |
127 cc::PrioritizedTextureManager* FakeTiledLayer::textureManager() const | 127 cc::PrioritizedTextureManager* FakeTiledLayer::textureManager() const |
128 { | 128 { |
129 return m_textureManager; | 129 return m_textureManager; |
130 } | 130 } |
131 | 131 |
132 cc::LayerUpdater* FakeTiledLayer::updater() const | 132 cc::LayerUpdater* FakeTiledLayer::updater() const |
133 { | 133 { |
134 return m_fakeUpdater.get(); | 134 return m_fakeUpdater.get(); |
135 } | 135 } |
136 | 136 |
137 cc::IntSize FakeTiledLayerWithScaledBounds::contentBounds() const | 137 gfx::Size FakeTiledLayerWithScaledBounds::contentBounds() const |
138 { | 138 { |
139 return m_forcedContentBounds; | 139 return m_forcedContentBounds; |
140 } | 140 } |
141 | 141 |
142 float FakeTiledLayerWithScaledBounds::contentsScaleX() const | 142 float FakeTiledLayerWithScaledBounds::contentsScaleX() const |
143 { | 143 { |
144 return static_cast<float>(m_forcedContentBounds.width()) / bounds().width(); | 144 return static_cast<float>(m_forcedContentBounds.width()) / bounds().width(); |
145 } | 145 } |
146 | 146 |
147 float FakeTiledLayerWithScaledBounds::contentsScaleY() const | 147 float FakeTiledLayerWithScaledBounds::contentsScaleY() const |
148 { | 148 { |
149 return static_cast<float>(m_forcedContentBounds.height()) / bounds().height(
); | 149 return static_cast<float>(m_forcedContentBounds.height()) / bounds().height(
); |
150 } | 150 } |
151 | 151 |
152 void FakeTiledLayerWithScaledBounds::setContentsScale(float) | 152 void FakeTiledLayerWithScaledBounds::setContentsScale(float) |
153 { | 153 { |
154 NOTREACHED(); | 154 NOTREACHED(); |
155 } | 155 } |
156 | 156 |
157 } // namespace | 157 } // namespace |
OLD | NEW |