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 "CCLayerImpl.h" | 9 #include "CCLayerImpl.h" |
10 #include "CCLayerTreeHost.h" | 10 #include "CCLayerTreeHost.h" |
11 #include "CCOverdrawMetrics.h" | 11 #include "CCOverdrawMetrics.h" |
12 #include "CCTextureUpdateQueue.h" | 12 #include "CCTextureUpdateQueue.h" |
13 #include "CCTiledLayerImpl.h" | 13 #include "CCTiledLayerImpl.h" |
14 #include "Region.h" | 14 #include "Region.h" |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 | 16 |
17 using namespace std; | 17 using namespace std; |
18 using WebKit::WebTransformationMatrix; | 18 using WebKit::WebTransformationMatrix; |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 | 21 |
22 class UpdatableTile : public CCLayerTilingData::Tile { | 22 class UpdatableTile : public LayerTilingData::Tile { |
23 public: | 23 public: |
24 static scoped_ptr<UpdatableTile> create(scoped_ptr<LayerTextureUpdater::Text
ure> texture) | 24 static scoped_ptr<UpdatableTile> create(scoped_ptr<LayerTextureUpdater::Text
ure> texture) |
25 { | 25 { |
26 return make_scoped_ptr(new UpdatableTile(texture.Pass())); | 26 return make_scoped_ptr(new UpdatableTile(texture.Pass())); |
27 } | 27 } |
28 | 28 |
29 LayerTextureUpdater::Texture* texture() { return m_texture.get(); } | 29 LayerTextureUpdater::Texture* texture() { return m_texture.get(); } |
30 CCPrioritizedTexture* managedTexture() { return m_texture->texture(); } | 30 PrioritizedTexture* managedTexture() { return m_texture->texture(); } |
31 | 31 |
32 bool isDirty() const { return !dirtyRect.isEmpty(); } | 32 bool isDirty() const { return !dirtyRect.isEmpty(); } |
33 | 33 |
34 // Reset update state for the current frame. This should occur before painti
ng | 34 // Reset update state for the current frame. This should occur before painti
ng |
35 // for all layers. Since painting one layer can invalidate another layer | 35 // for all layers. Since painting one layer can invalidate another layer |
36 // after it has already painted, mark all non-dirty tiles as valid before pa
inting | 36 // after it has already painted, mark all non-dirty tiles as valid before pa
inting |
37 // such that invalidations during painting won't prevent them from being pus
hed. | 37 // such that invalidations during painting won't prevent them from being pus
hed. |
38 void resetUpdateState() | 38 void resetUpdateState() |
39 { | 39 { |
40 updateRect = IntRect(); | 40 updateRect = IntRect(); |
(...skipping 27 matching lines...) Expand all Loading... |
68 , isInUseOnImpl(false) | 68 , isInUseOnImpl(false) |
69 , m_texture(texture.Pass()) | 69 , m_texture(texture.Pass()) |
70 { | 70 { |
71 } | 71 } |
72 | 72 |
73 scoped_ptr<LayerTextureUpdater::Texture> m_texture; | 73 scoped_ptr<LayerTextureUpdater::Texture> m_texture; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(UpdatableTile); | 75 DISALLOW_COPY_AND_ASSIGN(UpdatableTile); |
76 }; | 76 }; |
77 | 77 |
78 TiledLayerChromium::TiledLayerChromium() | 78 TiledLayer::TiledLayer() |
79 : LayerChromium() | 79 : Layer() |
80 , m_textureFormat(GraphicsContext3D::INVALID_ENUM) | 80 , m_textureFormat(GraphicsContext3D::INVALID_ENUM) |
81 , m_skipsDraw(false) | 81 , m_skipsDraw(false) |
82 , m_failedUpdate(false) | 82 , m_failedUpdate(false) |
83 , m_sampledTexelFormat(LayerTextureUpdater::SampledTexelFormatInvalid) | 83 , m_sampledTexelFormat(LayerTextureUpdater::SampledTexelFormatInvalid) |
84 , m_tilingOption(AutoTile) | 84 , m_tilingOption(AutoTile) |
85 { | 85 { |
86 m_tiler = CCLayerTilingData::create(IntSize(), CCLayerTilingData::HasBorderT
exels); | 86 m_tiler = LayerTilingData::create(IntSize(), LayerTilingData::HasBorderTexel
s); |
87 } | 87 } |
88 | 88 |
89 TiledLayerChromium::~TiledLayerChromium() | 89 TiledLayer::~TiledLayer() |
90 { | 90 { |
91 } | 91 } |
92 | 92 |
93 scoped_ptr<CCLayerImpl> TiledLayerChromium::createCCLayerImpl() | 93 scoped_ptr<LayerImpl> TiledLayer::createLayerImpl() |
94 { | 94 { |
95 return CCTiledLayerImpl::create(id()).PassAs<CCLayerImpl>(); | 95 return TiledLayerImpl::create(id()).PassAs<LayerImpl>(); |
96 } | 96 } |
97 | 97 |
98 void TiledLayerChromium::updateTileSizeAndTilingOption() | 98 void TiledLayer::updateTileSizeAndTilingOption() |
99 { | 99 { |
100 ASSERT(layerTreeHost()); | 100 ASSERT(layerTreeHost()); |
101 | 101 |
102 const IntSize& defaultTileSize = layerTreeHost()->settings().defaultTileSize
; | 102 const IntSize& defaultTileSize = layerTreeHost()->settings().defaultTileSize
; |
103 const IntSize& maxUntiledLayerSize = layerTreeHost()->settings().maxUntiledL
ayerSize; | 103 const IntSize& maxUntiledLayerSize = layerTreeHost()->settings().maxUntiledL
ayerSize; |
104 int layerWidth = contentBounds().width(); | 104 int layerWidth = contentBounds().width(); |
105 int layerHeight = contentBounds().height(); | 105 int layerHeight = contentBounds().height(); |
106 | 106 |
107 const IntSize tileSize(min(defaultTileSize.width(), layerWidth), min(default
TileSize.height(), layerHeight)); | 107 const IntSize tileSize(min(defaultTileSize.width(), layerWidth), min(default
TileSize.height(), layerHeight)); |
108 | 108 |
(...skipping 14 matching lines...) Expand all Loading... |
123 isTiled = false; | 123 isTiled = false; |
124 else | 124 else |
125 isTiled = autoTiled; | 125 isTiled = autoTiled; |
126 | 126 |
127 IntSize requestedSize = isTiled ? tileSize : contentBounds(); | 127 IntSize requestedSize = isTiled ? tileSize : contentBounds(); |
128 const int maxSize = layerTreeHost()->rendererCapabilities().maxTextureSize; | 128 const int maxSize = layerTreeHost()->rendererCapabilities().maxTextureSize; |
129 IntSize clampedSize = requestedSize.shrunkTo(IntSize(maxSize, maxSize)); | 129 IntSize clampedSize = requestedSize.shrunkTo(IntSize(maxSize, maxSize)); |
130 setTileSize(clampedSize); | 130 setTileSize(clampedSize); |
131 } | 131 } |
132 | 132 |
133 void TiledLayerChromium::updateBounds() | 133 void TiledLayer::updateBounds() |
134 { | 134 { |
135 IntSize oldBounds = m_tiler->bounds(); | 135 IntSize oldBounds = m_tiler->bounds(); |
136 IntSize newBounds = contentBounds(); | 136 IntSize newBounds = contentBounds(); |
137 if (oldBounds == newBounds) | 137 if (oldBounds == newBounds) |
138 return; | 138 return; |
139 m_tiler->setBounds(newBounds); | 139 m_tiler->setBounds(newBounds); |
140 | 140 |
141 // Invalidate any areas that the new bounds exposes. | 141 // Invalidate any areas that the new bounds exposes. |
142 Region oldRegion(IntRect(IntPoint(), oldBounds)); | 142 Region oldRegion(IntRect(IntPoint(), oldBounds)); |
143 Region newRegion(IntRect(IntPoint(), newBounds)); | 143 Region newRegion(IntRect(IntPoint(), newBounds)); |
144 newRegion.subtract(oldRegion); | 144 newRegion.subtract(oldRegion); |
145 Vector<WebCore::IntRect> rects = newRegion.rects(); | 145 Vector<WebCore::IntRect> rects = newRegion.rects(); |
146 for (size_t i = 0; i < rects.size(); ++i) | 146 for (size_t i = 0; i < rects.size(); ++i) |
147 invalidateContentRect(rects[i]); | 147 invalidateContentRect(rects[i]); |
148 } | 148 } |
149 | 149 |
150 void TiledLayerChromium::setTileSize(const IntSize& size) | 150 void TiledLayer::setTileSize(const IntSize& size) |
151 { | 151 { |
152 m_tiler->setTileSize(size); | 152 m_tiler->setTileSize(size); |
153 } | 153 } |
154 | 154 |
155 void TiledLayerChromium::setBorderTexelOption(CCLayerTilingData::BorderTexelOpti
on borderTexelOption) | 155 void TiledLayer::setBorderTexelOption(LayerTilingData::BorderTexelOption borderT
exelOption) |
156 { | 156 { |
157 m_tiler->setBorderTexelOption(borderTexelOption); | 157 m_tiler->setBorderTexelOption(borderTexelOption); |
158 } | 158 } |
159 | 159 |
160 bool TiledLayerChromium::drawsContent() const | 160 bool TiledLayer::drawsContent() const |
161 { | 161 { |
162 if (!LayerChromium::drawsContent()) | 162 if (!Layer::drawsContent()) |
163 return false; | 163 return false; |
164 | 164 |
165 bool hasMoreThanOneTile = m_tiler->numTilesX() > 1 || m_tiler->numTilesY() >
1; | 165 bool hasMoreThanOneTile = m_tiler->numTilesX() > 1 || m_tiler->numTilesY() >
1; |
166 if (m_tilingOption == NeverTile && hasMoreThanOneTile) | 166 if (m_tilingOption == NeverTile && hasMoreThanOneTile) |
167 return false; | 167 return false; |
168 | 168 |
169 return true; | 169 return true; |
170 } | 170 } |
171 | 171 |
172 bool TiledLayerChromium::needsContentsScale() const | 172 bool TiledLayer::needsContentsScale() const |
173 { | 173 { |
174 return true; | 174 return true; |
175 } | 175 } |
176 | 176 |
177 IntSize TiledLayerChromium::contentBounds() const | 177 IntSize TiledLayer::contentBounds() const |
178 { | 178 { |
179 return IntSize(lroundf(bounds().width() * contentsScale()), lroundf(bounds()
.height() * contentsScale())); | 179 return IntSize(lroundf(bounds().width() * contentsScale()), lroundf(bounds()
.height() * contentsScale())); |
180 } | 180 } |
181 | 181 |
182 void TiledLayerChromium::setTilingOption(TilingOption tilingOption) | 182 void TiledLayer::setTilingOption(TilingOption tilingOption) |
183 { | 183 { |
184 m_tilingOption = tilingOption; | 184 m_tilingOption = tilingOption; |
185 } | 185 } |
186 | 186 |
187 void TiledLayerChromium::setIsMask(bool isMask) | 187 void TiledLayer::setIsMask(bool isMask) |
188 { | 188 { |
189 setTilingOption(isMask ? NeverTile : AutoTile); | 189 setTilingOption(isMask ? NeverTile : AutoTile); |
190 } | 190 } |
191 | 191 |
192 void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) | 192 void TiledLayer::pushPropertiesTo(LayerImpl* layer) |
193 { | 193 { |
194 LayerChromium::pushPropertiesTo(layer); | 194 Layer::pushPropertiesTo(layer); |
195 | 195 |
196 CCTiledLayerImpl* tiledLayer = static_cast<CCTiledLayerImpl*>(layer); | 196 TiledLayerImpl* tiledLayer = static_cast<TiledLayerImpl*>(layer); |
197 | 197 |
198 tiledLayer->setSkipsDraw(m_skipsDraw); | 198 tiledLayer->setSkipsDraw(m_skipsDraw); |
199 tiledLayer->setContentsSwizzled(m_sampledTexelFormat != LayerTextureUpdater:
:SampledTexelFormatRGBA); | 199 tiledLayer->setContentsSwizzled(m_sampledTexelFormat != LayerTextureUpdater:
:SampledTexelFormatRGBA); |
200 tiledLayer->setTilingData(*m_tiler); | 200 tiledLayer->setTilingData(*m_tiler); |
201 Vector<UpdatableTile*> invalidTiles; | 201 Vector<UpdatableTile*> invalidTiles; |
202 | 202 |
203 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != m_tiler->tiles().end(); ++iter) { | 203 for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(
); iter != m_tiler->tiles().end(); ++iter) { |
204 int i = iter->first.first; | 204 int i = iter->first.first; |
205 int j = iter->first.second; | 205 int j = iter->first.second; |
206 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); | 206 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); |
207 // FIXME: This should not ever be null. | 207 // FIXME: This should not ever be null. |
208 if (!tile) | 208 if (!tile) |
209 continue; | 209 continue; |
210 | 210 |
211 tile->isInUseOnImpl = false; | 211 tile->isInUseOnImpl = false; |
212 | 212 |
213 if (!tile->managedTexture()->haveBackingTexture()) { | 213 if (!tile->managedTexture()->haveBackingTexture()) { |
214 // Evicted tiles get deleted from both layers | 214 // Evicted tiles get deleted from both layers |
215 invalidTiles.append(tile); | 215 invalidTiles.append(tile); |
216 continue; | 216 continue; |
217 } | 217 } |
218 | 218 |
219 if (!tile->validForFrame) { | 219 if (!tile->validForFrame) { |
220 // Invalidated tiles are set so they can get different debug colors. | 220 // Invalidated tiles are set so they can get different debug colors. |
221 tiledLayer->pushInvalidTile(i, j); | 221 tiledLayer->pushInvalidTile(i, j); |
222 continue; | 222 continue; |
223 } | 223 } |
224 | 224 |
225 tiledLayer->pushTileProperties(i, j, tile->managedTexture()->resourceId(
), tile->opaqueRect()); | 225 tiledLayer->pushTileProperties(i, j, tile->managedTexture()->resourceId(
), tile->opaqueRect()); |
226 tile->isInUseOnImpl = true; | 226 tile->isInUseOnImpl = true; |
227 } | 227 } |
228 for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); ite
r != invalidTiles.end(); ++iter) | 228 for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); ite
r != invalidTiles.end(); ++iter) |
229 m_tiler->takeTile((*iter)->i(), (*iter)->j()); | 229 m_tiler->takeTile((*iter)->i(), (*iter)->j()); |
230 } | 230 } |
231 | 231 |
232 CCPrioritizedTextureManager* TiledLayerChromium::textureManager() const | 232 PrioritizedTextureManager* TiledLayer::textureManager() const |
233 { | 233 { |
234 if (!layerTreeHost()) | 234 if (!layerTreeHost()) |
235 return 0; | 235 return 0; |
236 return layerTreeHost()->contentsTextureManager(); | 236 return layerTreeHost()->contentsTextureManager(); |
237 } | 237 } |
238 | 238 |
239 void TiledLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) | 239 void TiledLayer::setLayerTreeHost(LayerTreeHost* host) |
240 { | 240 { |
241 if (host && host != layerTreeHost()) { | 241 if (host && host != layerTreeHost()) { |
242 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().
begin(); iter != m_tiler->tiles().end(); ++iter) { | 242 for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().be
gin(); iter != m_tiler->tiles().end(); ++iter) { |
243 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); | 243 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); |
244 // FIXME: This should not ever be null. | 244 // FIXME: This should not ever be null. |
245 if (!tile) | 245 if (!tile) |
246 continue; | 246 continue; |
247 tile->managedTexture()->setTextureManager(host->contentsTextureManag
er()); | 247 tile->managedTexture()->setTextureManager(host->contentsTextureManag
er()); |
248 } | 248 } |
249 } | 249 } |
250 LayerChromium::setLayerTreeHost(host); | 250 Layer::setLayerTreeHost(host); |
251 } | 251 } |
252 | 252 |
253 UpdatableTile* TiledLayerChromium::tileAt(int i, int j) const | 253 UpdatableTile* TiledLayer::tileAt(int i, int j) const |
254 { | 254 { |
255 return static_cast<UpdatableTile*>(m_tiler->tileAt(i, j)); | 255 return static_cast<UpdatableTile*>(m_tiler->tileAt(i, j)); |
256 } | 256 } |
257 | 257 |
258 UpdatableTile* TiledLayerChromium::createTile(int i, int j) | 258 UpdatableTile* TiledLayer::createTile(int i, int j) |
259 { | 259 { |
260 createTextureUpdaterIfNeeded(); | 260 createTextureUpdaterIfNeeded(); |
261 | 261 |
262 scoped_ptr<UpdatableTile> tile(UpdatableTile::create(textureUpdater()->creat
eTexture(textureManager()))); | 262 scoped_ptr<UpdatableTile> tile(UpdatableTile::create(textureUpdater()->creat
eTexture(textureManager()))); |
263 tile->managedTexture()->setDimensions(m_tiler->tileSize(), m_textureFormat); | 263 tile->managedTexture()->setDimensions(m_tiler->tileSize(), m_textureFormat); |
264 | 264 |
265 UpdatableTile* addedTile = tile.get(); | 265 UpdatableTile* addedTile = tile.get(); |
266 m_tiler->addTile(tile.PassAs<CCLayerTilingData::Tile>(), i, j); | 266 m_tiler->addTile(tile.PassAs<LayerTilingData::Tile>(), i, j); |
267 | 267 |
268 addedTile->dirtyRect = m_tiler->tileRect(addedTile); | 268 addedTile->dirtyRect = m_tiler->tileRect(addedTile); |
269 | 269 |
270 // Temporary diagnostic crash. | 270 // Temporary diagnostic crash. |
271 if (!addedTile) | 271 if (!addedTile) |
272 CRASH(); | 272 CRASH(); |
273 if (!tileAt(i, j)) | 273 if (!tileAt(i, j)) |
274 CRASH(); | 274 CRASH(); |
275 | 275 |
276 return addedTile; | 276 return addedTile; |
277 } | 277 } |
278 | 278 |
279 void TiledLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) | 279 void TiledLayer::setNeedsDisplayRect(const FloatRect& dirtyRect) |
280 { | 280 { |
281 float contentsWidthScale = static_cast<float>(contentBounds().width()) / bou
nds().width(); | 281 float contentsWidthScale = static_cast<float>(contentBounds().width()) / bou
nds().width(); |
282 float contentsHeightScale = static_cast<float>(contentBounds().height()) / b
ounds().height(); | 282 float contentsHeightScale = static_cast<float>(contentBounds().height()) / b
ounds().height(); |
283 FloatRect scaledDirtyRect(dirtyRect); | 283 FloatRect scaledDirtyRect(dirtyRect); |
284 scaledDirtyRect.scale(contentsWidthScale, contentsHeightScale); | 284 scaledDirtyRect.scale(contentsWidthScale, contentsHeightScale); |
285 IntRect dirty = enclosingIntRect(scaledDirtyRect); | 285 IntRect dirty = enclosingIntRect(scaledDirtyRect); |
286 invalidateContentRect(dirty); | 286 invalidateContentRect(dirty); |
287 LayerChromium::setNeedsDisplayRect(dirtyRect); | 287 Layer::setNeedsDisplayRect(dirtyRect); |
288 } | 288 } |
289 | 289 |
290 void TiledLayerChromium::setUseLCDText(bool useLCDText) | 290 void TiledLayer::setUseLCDText(bool useLCDText) |
291 { | 291 { |
292 LayerChromium::setUseLCDText(useLCDText); | 292 Layer::setUseLCDText(useLCDText); |
293 | 293 |
294 CCLayerTilingData::BorderTexelOption borderTexelOption; | 294 LayerTilingData::BorderTexelOption borderTexelOption; |
295 #if OS(ANDROID) | 295 #if OS(ANDROID) |
296 // Always want border texels and GL_LINEAR due to pinch zoom. | 296 // Always want border texels and GL_LINEAR due to pinch zoom. |
297 borderTexelOption = CCLayerTilingData::HasBorderTexels; | 297 borderTexelOption = LayerTilingData::HasBorderTexels; |
298 #else | 298 #else |
299 borderTexelOption = useLCDText ? CCLayerTilingData::NoBorderTexels : CCLayer
TilingData::HasBorderTexels; | 299 borderTexelOption = useLCDText ? LayerTilingData::NoBorderTexels : LayerTili
ngData::HasBorderTexels; |
300 #endif | 300 #endif |
301 setBorderTexelOption(borderTexelOption); | 301 setBorderTexelOption(borderTexelOption); |
302 } | 302 } |
303 | 303 |
304 void TiledLayerChromium::invalidateContentRect(const IntRect& contentRect) | 304 void TiledLayer::invalidateContentRect(const IntRect& contentRect) |
305 { | 305 { |
306 updateBounds(); | 306 updateBounds(); |
307 if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw) | 307 if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw) |
308 return; | 308 return; |
309 | 309 |
310 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != m_tiler->tiles().end(); ++iter) { | 310 for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(
); iter != m_tiler->tiles().end(); ++iter) { |
311 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); | 311 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); |
312 ASSERT(tile); | 312 ASSERT(tile); |
313 // FIXME: This should not ever be null. | 313 // FIXME: This should not ever be null. |
314 if (!tile) | 314 if (!tile) |
315 continue; | 315 continue; |
316 IntRect bound = m_tiler->tileRect(tile); | 316 IntRect bound = m_tiler->tileRect(tile); |
317 bound.intersect(contentRect); | 317 bound.intersect(contentRect); |
318 tile->dirtyRect.unite(bound); | 318 tile->dirtyRect.unite(bound); |
319 } | 319 } |
320 } | 320 } |
321 | 321 |
322 // Returns true if tile is dirty and only part of it needs to be updated. | 322 // Returns true if tile is dirty and only part of it needs to be updated. |
323 bool TiledLayerChromium::tileOnlyNeedsPartialUpdate(UpdatableTile* tile) | 323 bool TiledLayer::tileOnlyNeedsPartialUpdate(UpdatableTile* tile) |
324 { | 324 { |
325 return !tile->dirtyRect.contains(m_tiler->tileRect(tile)); | 325 return !tile->dirtyRect.contains(m_tiler->tileRect(tile)); |
326 } | 326 } |
327 | 327 |
328 // Dirty tiles with valid textures needs buffered update to guarantee that | 328 // Dirty tiles with valid textures needs buffered update to guarantee that |
329 // we don't modify textures currently used for drawing by the impl thread. | 329 // we don't modify textures currently used for drawing by the impl thread. |
330 bool TiledLayerChromium::tileNeedsBufferedUpdate(UpdatableTile* tile) | 330 bool TiledLayer::tileNeedsBufferedUpdate(UpdatableTile* tile) |
331 { | 331 { |
332 if (!tile->managedTexture()->haveBackingTexture()) | 332 if (!tile->managedTexture()->haveBackingTexture()) |
333 return false; | 333 return false; |
334 | 334 |
335 if (!tile->isDirty()) | 335 if (!tile->isDirty()) |
336 return false; | 336 return false; |
337 | 337 |
338 if (!tile->isInUseOnImpl) | 338 if (!tile->isInUseOnImpl) |
339 return false; | 339 return false; |
340 | 340 |
341 return true; | 341 return true; |
342 } | 342 } |
343 | 343 |
344 | 344 |
345 bool TiledLayerChromium::updateTiles(int left, int top, int right, int bottom, C
CTextureUpdateQueue& queue, const CCOcclusionTracker* occlusion, CCRenderingStat
s& stats, bool& didPaint) | 345 bool TiledLayer::updateTiles(int left, int top, int right, int bottom, TextureUp
dateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats, bool
& didPaint) |
346 { | 346 { |
347 didPaint = false; | 347 didPaint = false; |
348 createTextureUpdaterIfNeeded(); | 348 createTextureUpdaterIfNeeded(); |
349 | 349 |
350 bool ignoreOcclusions = !occlusion; | 350 bool ignoreOcclusions = !occlusion; |
351 if (!haveTexturesForTiles(left, top, right, bottom, ignoreOcclusions)) { | 351 if (!haveTexturesForTiles(left, top, right, bottom, ignoreOcclusions)) { |
352 m_failedUpdate = true; | 352 m_failedUpdate = true; |
353 return false; | 353 return false; |
354 } | 354 } |
355 | 355 |
356 IntRect paintRect = markTilesForUpdate(left, top, right, bottom, ignoreOcclu
sions); | 356 IntRect paintRect = markTilesForUpdate(left, top, right, bottom, ignoreOcclu
sions); |
357 | 357 |
358 if (occlusion) | 358 if (occlusion) |
359 occlusion->overdrawMetrics().didPaint(paintRect); | 359 occlusion->overdrawMetrics().didPaint(paintRect); |
360 | 360 |
361 if (paintRect.isEmpty()) | 361 if (paintRect.isEmpty()) |
362 return true; | 362 return true; |
363 | 363 |
364 didPaint = true; | 364 didPaint = true; |
365 updateTileTextures(paintRect, left, top, right, bottom, queue, occlusion, st
ats); | 365 updateTileTextures(paintRect, left, top, right, bottom, queue, occlusion, st
ats); |
366 return true; | 366 return true; |
367 } | 367 } |
368 | 368 |
369 void TiledLayerChromium::markOcclusionsAndRequestTextures(int left, int top, int
right, int bottom, const CCOcclusionTracker* occlusion) | 369 void TiledLayer::markOcclusionsAndRequestTextures(int left, int top, int right,
int bottom, const OcclusionTracker* occlusion) |
370 { | 370 { |
371 // There is some difficult dependancies between occlusions, recording occlus
ion metrics | 371 // There is some difficult dependancies between occlusions, recording occlus
ion metrics |
372 // and requesting memory so those are encapsulated in this function: | 372 // and requesting memory so those are encapsulated in this function: |
373 // - We only want to call requestLate on unoccluded textures (to preserve | 373 // - We only want to call requestLate on unoccluded textures (to preserve |
374 // memory for other layers when near OOM). | 374 // memory for other layers when near OOM). |
375 // - We only want to record occlusion metrics if all memory requests succeed
. | 375 // - We only want to record occlusion metrics if all memory requests succeed
. |
376 | 376 |
377 int occludedTileCount = 0; | 377 int occludedTileCount = 0; |
378 bool succeeded = true; | 378 bool succeeded = true; |
379 for (int j = top; j <= bottom; ++j) { | 379 for (int j = top; j <= bottom; ++j) { |
(...skipping 15 matching lines...) Expand all Loading... |
395 } | 395 } |
396 | 396 |
397 if (!succeeded) | 397 if (!succeeded) |
398 return; | 398 return; |
399 | 399 |
400 // FIXME: Remove the loop and just pass the count! | 400 // FIXME: Remove the loop and just pass the count! |
401 for (int i = 0; i < occludedTileCount; i++) | 401 for (int i = 0; i < occludedTileCount; i++) |
402 occlusion->overdrawMetrics().didCullTileForUpload(); | 402 occlusion->overdrawMetrics().didCullTileForUpload(); |
403 } | 403 } |
404 | 404 |
405 bool TiledLayerChromium::haveTexturesForTiles(int left, int top, int right, int
bottom, bool ignoreOcclusions) | 405 bool TiledLayer::haveTexturesForTiles(int left, int top, int right, int bottom,
bool ignoreOcclusions) |
406 { | 406 { |
407 for (int j = top; j <= bottom; ++j) { | 407 for (int j = top; j <= bottom; ++j) { |
408 for (int i = left; i <= right; ++i) { | 408 for (int i = left; i <= right; ++i) { |
409 UpdatableTile* tile = tileAt(i, j); | 409 UpdatableTile* tile = tileAt(i, j); |
410 ASSERT(tile); // Did setTexturePriorites get skipped? | 410 ASSERT(tile); // Did setTexturePriorites get skipped? |
411 // FIXME: This should not ever be null. | 411 // FIXME: This should not ever be null. |
412 if (!tile) | 412 if (!tile) |
413 continue; | 413 continue; |
414 | 414 |
415 // Ensure the entire tile is dirty if we don't have the texture. | 415 // Ensure the entire tile is dirty if we don't have the texture. |
416 if (!tile->managedTexture()->haveBackingTexture()) | 416 if (!tile->managedTexture()->haveBackingTexture()) |
417 tile->dirtyRect = m_tiler->tileRect(tile); | 417 tile->dirtyRect = m_tiler->tileRect(tile); |
418 | 418 |
419 // If using occlusion and the visible region of the tile is occluded
, | 419 // If using occlusion and the visible region of the tile is occluded
, |
420 // don't reserve a texture or update the tile. | 420 // don't reserve a texture or update the tile. |
421 if (tile->occluded && !ignoreOcclusions) | 421 if (tile->occluded && !ignoreOcclusions) |
422 continue; | 422 continue; |
423 | 423 |
424 if (!tile->managedTexture()->canAcquireBackingTexture()) | 424 if (!tile->managedTexture()->canAcquireBackingTexture()) |
425 return false; | 425 return false; |
426 } | 426 } |
427 } | 427 } |
428 return true; | 428 return true; |
429 } | 429 } |
430 | 430 |
431 IntRect TiledLayerChromium::markTilesForUpdate(int left, int top, int right, int
bottom, bool ignoreOcclusions) | 431 IntRect TiledLayer::markTilesForUpdate(int left, int top, int right, int bottom,
bool ignoreOcclusions) |
432 { | 432 { |
433 IntRect paintRect; | 433 IntRect paintRect; |
434 for (int j = top; j <= bottom; ++j) { | 434 for (int j = top; j <= bottom; ++j) { |
435 for (int i = left; i <= right; ++i) { | 435 for (int i = left; i <= right; ++i) { |
436 UpdatableTile* tile = tileAt(i, j); | 436 UpdatableTile* tile = tileAt(i, j); |
437 ASSERT(tile); // Did setTexturePriorites get skipped? | 437 ASSERT(tile); // Did setTexturePriorites get skipped? |
438 // FIXME: This should not ever be null. | 438 // FIXME: This should not ever be null. |
439 if (!tile) | 439 if (!tile) |
440 continue; | 440 continue; |
441 if (tile->occluded && !ignoreOcclusions) | 441 if (tile->occluded && !ignoreOcclusions) |
442 continue; | 442 continue; |
443 paintRect.unite(tile->dirtyRect); | 443 paintRect.unite(tile->dirtyRect); |
444 tile->markForUpdate(); | 444 tile->markForUpdate(); |
445 } | 445 } |
446 } | 446 } |
447 return paintRect; | 447 return paintRect; |
448 } | 448 } |
449 | 449 |
450 void TiledLayerChromium::updateTileTextures(const IntRect& paintRect, int left,
int top, int right, int bottom, CCTextureUpdateQueue& queue, const CCOcclusionTr
acker* occlusion, CCRenderingStats& stats) | 450 void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top,
int right, int bottom, TextureUpdateQueue& queue, const OcclusionTracker* occlu
sion, RenderingStats& stats) |
451 { | 451 { |
452 // The updateRect should be in layer space. So we have to convert the paintR
ect from content space to layer space. | 452 // The updateRect should be in layer space. So we have to convert the paintR
ect from content space to layer space. |
453 m_updateRect = FloatRect(paintRect); | 453 m_updateRect = FloatRect(paintRect); |
454 float widthScale = bounds().width() / static_cast<float>(contentBounds().wid
th()); | 454 float widthScale = bounds().width() / static_cast<float>(contentBounds().wid
th()); |
455 float heightScale = bounds().height() / static_cast<float>(contentBounds().h
eight()); | 455 float heightScale = bounds().height() / static_cast<float>(contentBounds().h
eight()); |
456 m_updateRect.scale(widthScale, heightScale); | 456 m_updateRect.scale(widthScale, heightScale); |
457 | 457 |
458 // Calling prepareToUpdate() calls into WebKit to paint, which may have the
side | 458 // Calling prepareToUpdate() calls into WebKit to paint, which may have the
side |
459 // effect of disabling compositing, which causes our reference to the textur
e updater to be deleted. | 459 // effect of disabling compositing, which causes our reference to the textur
e updater to be deleted. |
460 // However, we can't free the memory backing the SkCanvas until the paint fi
nishes, | 460 // However, we can't free the memory backing the SkCanvas until the paint fi
nishes, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 occlusion->overdrawMetrics().didUpload(WebTransformationMatrix()
, sourceRect, tile->opaqueRect()); | 528 occlusion->overdrawMetrics().didUpload(WebTransformationMatrix()
, sourceRect, tile->opaqueRect()); |
529 | 529 |
530 } | 530 } |
531 } | 531 } |
532 } | 532 } |
533 | 533 |
534 namespace { | 534 namespace { |
535 // This picks a small animated layer to be anything less than one viewport. This | 535 // This picks a small animated layer to be anything less than one viewport. This |
536 // is specifically for page transitions which are viewport-sized layers. The ext
ra | 536 // is specifically for page transitions which are viewport-sized layers. The ext
ra |
537 // 64 pixels is due to these layers being slightly larger than the viewport in s
ome cases. | 537 // 64 pixels is due to these layers being slightly larger than the viewport in s
ome cases. |
538 bool isSmallAnimatedLayer(TiledLayerChromium* layer) | 538 bool isSmallAnimatedLayer(TiledLayer* layer) |
539 { | 539 { |
540 if (!layer->drawTransformIsAnimating() && !layer->screenSpaceTransformIsAnim
ating()) | 540 if (!layer->drawTransformIsAnimating() && !layer->screenSpaceTransformIsAnim
ating()) |
541 return false; | 541 return false; |
542 IntSize viewportSize = layer->layerTreeHost() ? layer->layerTreeHost()->devi
ceViewportSize() : IntSize(); | 542 IntSize viewportSize = layer->layerTreeHost() ? layer->layerTreeHost()->devi
ceViewportSize() : IntSize(); |
543 IntRect contentRect(IntPoint::zero(), layer->contentBounds()); | 543 IntRect contentRect(IntPoint::zero(), layer->contentBounds()); |
544 return contentRect.width() <= viewportSize.width() + 64 | 544 return contentRect.width() <= viewportSize.width() + 64 |
545 && contentRect.height() <= viewportSize.height() + 64; | 545 && contentRect.height() <= viewportSize.height() + 64; |
546 } | 546 } |
547 | 547 |
548 // FIXME: Remove this and make this based on distance once distance can be calcu
lated | 548 // FIXME: Remove this and make this based on distance once distance can be calcu
lated |
549 // for offscreen layers. For now, prioritize all small animated layers after 512 | 549 // for offscreen layers. For now, prioritize all small animated layers after 512 |
550 // pixels of pre-painting. | 550 // pixels of pre-painting. |
551 void setPriorityForTexture(const IntRect& visibleRect, | 551 void setPriorityForTexture(const IntRect& visibleRect, |
552 const IntRect& tileRect, | 552 const IntRect& tileRect, |
553 bool drawsToRoot, | 553 bool drawsToRoot, |
554 bool isSmallAnimatedLayer, | 554 bool isSmallAnimatedLayer, |
555 CCPrioritizedTexture* texture) | 555 PrioritizedTexture* texture) |
556 { | 556 { |
557 int priority = CCPriorityCalculator::lowestPriority(); | 557 int priority = PriorityCalculator::lowestPriority(); |
558 if (!visibleRect.isEmpty()) | 558 if (!visibleRect.isEmpty()) |
559 priority = CCPriorityCalculator::priorityFromDistance(visibleRect, tileR
ect, drawsToRoot); | 559 priority = PriorityCalculator::priorityFromDistance(visibleRect, tileRec
t, drawsToRoot); |
560 if (isSmallAnimatedLayer) | 560 if (isSmallAnimatedLayer) |
561 priority = CCPriorityCalculator::maxPriority(priority, CCPriorityCalcula
tor::smallAnimatedLayerMinPriority()); | 561 priority = PriorityCalculator::maxPriority(priority, PriorityCalculator:
:smallAnimatedLayerMinPriority()); |
562 if (priority != CCPriorityCalculator::lowestPriority()) | 562 if (priority != PriorityCalculator::lowestPriority()) |
563 texture->setRequestPriority(priority); | 563 texture->setRequestPriority(priority); |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priori
tyCalc) | 567 void TiledLayer::setTexturePriorities(const PriorityCalculator& priorityCalc) |
568 { | 568 { |
569 updateBounds(); | 569 updateBounds(); |
570 resetUpdateState(); | 570 resetUpdateState(); |
571 | 571 |
572 if (m_tiler->hasEmptyBounds()) | 572 if (m_tiler->hasEmptyBounds()) |
573 return; | 573 return; |
574 | 574 |
575 bool drawsToRoot = !renderTarget()->parent(); | 575 bool drawsToRoot = !renderTarget()->parent(); |
576 bool smallAnimatedLayer = isSmallAnimatedLayer(this); | 576 bool smallAnimatedLayer = isSmallAnimatedLayer(this); |
577 | 577 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 continue; | 613 continue; |
614 if (tileOnlyNeedsPartialUpdate(tile) && layerTreeHost()->request
PartialTextureUpdate()) { | 614 if (tileOnlyNeedsPartialUpdate(tile) && layerTreeHost()->request
PartialTextureUpdate()) { |
615 tile->partialUpdate = true; | 615 tile->partialUpdate = true; |
616 continue; | 616 continue; |
617 } | 617 } |
618 | 618 |
619 IntRect tileRect = m_tiler->tileRect(tile); | 619 IntRect tileRect = m_tiler->tileRect(tile); |
620 tile->dirtyRect = tileRect; | 620 tile->dirtyRect = tileRect; |
621 LayerTextureUpdater::Texture* backBuffer = tile->texture(); | 621 LayerTextureUpdater::Texture* backBuffer = tile->texture(); |
622 setPriorityForTexture(visibleContentRect(), tile->dirtyRect, dra
wsToRoot, smallAnimatedLayer, backBuffer->texture()); | 622 setPriorityForTexture(visibleContentRect(), tile->dirtyRect, dra
wsToRoot, smallAnimatedLayer, backBuffer->texture()); |
623 scoped_ptr<CCPrioritizedTexture> frontBuffer = CCPrioritizedText
ure::create(backBuffer->texture()->textureManager(), | 623 scoped_ptr<PrioritizedTexture> frontBuffer = PrioritizedTexture:
:create(backBuffer->texture()->textureManager(), |
624
backBuffer->texture()->size(), | 624
backBuffer->texture()->size(), |
625
backBuffer->texture()->format()); | 625
backBuffer->texture()->format()); |
626 // Swap backBuffer into frontBuffer and add it to delete after c
ommit queue. | 626 // Swap backBuffer into frontBuffer and add it to delete after c
ommit queue. |
627 backBuffer->swapTextureWith(frontBuffer); | 627 backBuffer->swapTextureWith(frontBuffer); |
628 layerTreeHost()->deleteTextureAfterCommit(frontBuffer.Pass()); | 628 layerTreeHost()->deleteTextureAfterCommit(frontBuffer.Pass()); |
629 } | 629 } |
630 } | 630 } |
631 } | 631 } |
632 | 632 |
633 // Now update priorities on all tiles we have in the layer, no matter where
they are. | 633 // Now update priorities on all tiles we have in the layer, no matter where
they are. |
634 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != m_tiler->tiles().end(); ++iter) { | 634 for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(
); iter != m_tiler->tiles().end(); ++iter) { |
635 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); | 635 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); |
636 // FIXME: This should not ever be null. | 636 // FIXME: This should not ever be null. |
637 if (!tile) | 637 if (!tile) |
638 continue; | 638 continue; |
639 IntRect tileRect = m_tiler->tileRect(tile); | 639 IntRect tileRect = m_tiler->tileRect(tile); |
640 setPriorityForTexture(visibleContentRect(), tileRect, drawsToRoot, small
AnimatedLayer, tile->managedTexture()); | 640 setPriorityForTexture(visibleContentRect(), tileRect, drawsToRoot, small
AnimatedLayer, tile->managedTexture()); |
641 } | 641 } |
642 } | 642 } |
643 | 643 |
644 Region TiledLayerChromium::visibleContentOpaqueRegion() const | 644 Region TiledLayer::visibleContentOpaqueRegion() const |
645 { | 645 { |
646 if (m_skipsDraw) | 646 if (m_skipsDraw) |
647 return Region(); | 647 return Region(); |
648 if (contentsOpaque()) | 648 if (contentsOpaque()) |
649 return visibleContentRect(); | 649 return visibleContentRect(); |
650 return m_tiler->opaqueRegionInContentRect(visibleContentRect()); | 650 return m_tiler->opaqueRegionInContentRect(visibleContentRect()); |
651 } | 651 } |
652 | 652 |
653 void TiledLayerChromium::resetUpdateState() | 653 void TiledLayer::resetUpdateState() |
654 { | 654 { |
655 m_skipsDraw = false; | 655 m_skipsDraw = false; |
656 m_failedUpdate = false; | 656 m_failedUpdate = false; |
657 | 657 |
658 CCLayerTilingData::TileMap::const_iterator end = m_tiler->tiles().end(); | 658 LayerTilingData::TileMap::const_iterator end = m_tiler->tiles().end(); |
659 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != end; ++iter) { | 659 for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(
); iter != end; ++iter) { |
660 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); | 660 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); |
661 // FIXME: This should not ever be null. | 661 // FIXME: This should not ever be null. |
662 if (!tile) | 662 if (!tile) |
663 continue; | 663 continue; |
664 tile->resetUpdateState(); | 664 tile->resetUpdateState(); |
665 } | 665 } |
666 } | 666 } |
667 | 667 |
668 void TiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTr
acker* occlusion, CCRenderingStats& stats) | 668 void TiledLayer::update(TextureUpdateQueue& queue, const OcclusionTracker* occlu
sion, RenderingStats& stats) |
669 { | 669 { |
670 ASSERT(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped
? | 670 ASSERT(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped
? |
671 updateBounds(); | 671 updateBounds(); |
672 if (m_tiler->hasEmptyBounds() || !drawsContent()) | 672 if (m_tiler->hasEmptyBounds() || !drawsContent()) |
673 return; | 673 return; |
674 | 674 |
675 bool didPaint = false; | 675 bool didPaint = false; |
676 | 676 |
677 // Animation pre-paint. If the layer is small, try to paint it all | 677 // Animation pre-paint. If the layer is small, try to paint it all |
678 // immediately whether or not it is occluded, to avoid paint/upload | 678 // immediately whether or not it is occluded, to avoid paint/upload |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 return; | 731 return; |
732 } | 732 } |
733 if (right < prepaintRight) { | 733 if (right < prepaintRight) { |
734 ++right; | 734 ++right; |
735 if (!updateTiles(right, top, right, bottom, queue, 0, stats, didPain
t) || didPaint) | 735 if (!updateTiles(right, top, right, bottom, queue, 0, stats, didPain
t) || didPaint) |
736 return; | 736 return; |
737 } | 737 } |
738 } | 738 } |
739 } | 739 } |
740 | 740 |
741 bool TiledLayerChromium::needsIdlePaint() | 741 bool TiledLayer::needsIdlePaint() |
742 { | 742 { |
743 // Don't trigger more paints if we failed (as we'll just fail again). | 743 // Don't trigger more paints if we failed (as we'll just fail again). |
744 if (m_failedUpdate || visibleContentRect().isEmpty() || m_tiler->hasEmptyBou
nds() || !drawsContent()) | 744 if (m_failedUpdate || visibleContentRect().isEmpty() || m_tiler->hasEmptyBou
nds() || !drawsContent()) |
745 return false; | 745 return false; |
746 | 746 |
747 IntRect idlePaintContentRect = idlePaintRect(); | 747 IntRect idlePaintContentRect = idlePaintRect(); |
748 if (idlePaintContentRect.isEmpty()) | 748 if (idlePaintContentRect.isEmpty()) |
749 return false; | 749 return false; |
750 | 750 |
751 int left, top, right, bottom; | 751 int left, top, right, bottom; |
752 m_tiler->contentRectToTileIndices(idlePaintContentRect, left, top, right, bo
ttom); | 752 m_tiler->contentRectToTileIndices(idlePaintContentRect, left, top, right, bo
ttom); |
753 | 753 |
754 for (int j = top; j <= bottom; ++j) { | 754 for (int j = top; j <= bottom; ++j) { |
755 for (int i = left; i <= right; ++i) { | 755 for (int i = left; i <= right; ++i) { |
756 UpdatableTile* tile = tileAt(i, j); | 756 UpdatableTile* tile = tileAt(i, j); |
757 ASSERT(tile); // Did setTexturePriorities get skipped? | 757 ASSERT(tile); // Did setTexturePriorities get skipped? |
758 if (!tile) | 758 if (!tile) |
759 continue; | 759 continue; |
760 | 760 |
761 bool updated = !tile->updateRect.isEmpty(); | 761 bool updated = !tile->updateRect.isEmpty(); |
762 bool canAcquire = tile->managedTexture()->canAcquireBackingTexture()
; | 762 bool canAcquire = tile->managedTexture()->canAcquireBackingTexture()
; |
763 bool dirty = tile->isDirty() || !tile->managedTexture()->haveBacking
Texture(); | 763 bool dirty = tile->isDirty() || !tile->managedTexture()->haveBacking
Texture(); |
764 if (!updated && canAcquire && dirty) | 764 if (!updated && canAcquire && dirty) |
765 return true; | 765 return true; |
766 } | 766 } |
767 } | 767 } |
768 return false; | 768 return false; |
769 } | 769 } |
770 | 770 |
771 IntRect TiledLayerChromium::idlePaintRect() | 771 IntRect TiledLayer::idlePaintRect() |
772 { | 772 { |
773 // Don't inflate an empty rect. | 773 // Don't inflate an empty rect. |
774 if (visibleContentRect().isEmpty()) | 774 if (visibleContentRect().isEmpty()) |
775 return IntRect(); | 775 return IntRect(); |
776 | 776 |
777 // FIXME: This can be made a lot larger now! We should increase | 777 // FIXME: This can be made a lot larger now! We should increase |
778 // this slowly while insuring it doesn't cause any perf issues. | 778 // this slowly while insuring it doesn't cause any perf issues. |
779 IntRect prepaintRect = visibleContentRect(); | 779 IntRect prepaintRect = visibleContentRect(); |
780 prepaintRect.inflateX(m_tiler->tileSize().width()); | 780 prepaintRect.inflateX(m_tiler->tileSize().width()); |
781 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); | 781 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); |
782 IntRect contentRect(IntPoint::zero(), contentBounds()); | 782 IntRect contentRect(IntPoint::zero(), contentBounds()); |
783 prepaintRect.intersect(contentRect); | 783 prepaintRect.intersect(contentRect); |
784 | 784 |
785 return prepaintRect; | 785 return prepaintRect; |
786 } | 786 } |
787 | 787 |
788 } | 788 } |
OLD | NEW |