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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 316 |
317 bool ignoreOcclusions = !occlusion; | 317 bool ignoreOcclusions = !occlusion; |
318 if (!haveTexturesForTiles(left, top, right, bottom, ignoreOcclusions)) { | 318 if (!haveTexturesForTiles(left, top, right, bottom, ignoreOcclusions)) { |
319 m_failedUpdate = true; | 319 m_failedUpdate = true; |
320 return false; | 320 return false; |
321 } | 321 } |
322 | 322 |
323 gfx::Rect paintRect = markTilesForUpdate(left, top, right, bottom, ignoreOcc
lusions); | 323 gfx::Rect paintRect = markTilesForUpdate(left, top, right, bottom, ignoreOcc
lusions); |
324 | 324 |
325 if (occlusion) | 325 if (occlusion) |
326 occlusion->OverdrawMetrics().didPaint(paintRect); | 326 occlusion->OverdrawMetrics().DidPaint(paintRect); |
327 | 327 |
328 if (paintRect.IsEmpty()) | 328 if (paintRect.IsEmpty()) |
329 return true; | 329 return true; |
330 | 330 |
331 didPaint = true; | 331 didPaint = true; |
332 updateTileTextures(paintRect, left, top, right, bottom, queue, occlusion, st
ats); | 332 updateTileTextures(paintRect, left, top, right, bottom, queue, occlusion, st
ats); |
333 return true; | 333 return true; |
334 } | 334 } |
335 | 335 |
336 void TiledLayer::markOcclusionsAndRequestTextures(int left, int top, int right,
int bottom, const OcclusionTracker* occlusion) | 336 void TiledLayer::markOcclusionsAndRequestTextures(int left, int top, int right,
int bottom, const OcclusionTracker* occlusion) |
(...skipping 20 matching lines...) Expand all Loading... |
357 occludedTileCount++; | 357 occludedTileCount++; |
358 } else { | 358 } else { |
359 succeeded &= tile->managedResource()->requestLate(); | 359 succeeded &= tile->managedResource()->requestLate(); |
360 } | 360 } |
361 } | 361 } |
362 } | 362 } |
363 | 363 |
364 if (!succeeded) | 364 if (!succeeded) |
365 return; | 365 return; |
366 if (occlusion) | 366 if (occlusion) |
367 occlusion->OverdrawMetrics().didCullTilesForUpload(occludedTileCount); | 367 occlusion->OverdrawMetrics().DidCullTilesForUpload(occludedTileCount); |
368 } | 368 } |
369 | 369 |
370 bool TiledLayer::haveTexturesForTiles(int left, int top, int right, int bottom,
bool ignoreOcclusions) | 370 bool TiledLayer::haveTexturesForTiles(int left, int top, int right, int bottom,
bool ignoreOcclusions) |
371 { | 371 { |
372 for (int j = top; j <= bottom; ++j) { | 372 for (int j = top; j <= bottom; ++j) { |
373 for (int i = left; i <= right; ++i) { | 373 for (int i = left; i <= right; ++i) { |
374 UpdatableTile* tile = tileAt(i, j); | 374 UpdatableTile* tile = tileAt(i, j); |
375 DCHECK(tile); // Did setTexturePriorites get skipped? | 375 DCHECK(tile); // Did setTexturePriorites get skipped? |
376 // FIXME: This should not ever be null. | 376 // FIXME: This should not ever be null. |
377 if (!tile) | 377 if (!tile) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 // Offset from paint rectangle to this tile's dirty rectangle. | 492 // Offset from paint rectangle to this tile's dirty rectangle. |
493 gfx::Vector2d paintOffset = sourceRect.origin() - paintRect.origin()
; | 493 gfx::Vector2d paintOffset = sourceRect.origin() - paintRect.origin()
; |
494 CHECK(paintOffset.x() >= 0); | 494 CHECK(paintOffset.x() >= 0); |
495 CHECK(paintOffset.y() >= 0); | 495 CHECK(paintOffset.y() >= 0); |
496 CHECK(paintOffset.x() + sourceRect.width() <= paintRect.width()); | 496 CHECK(paintOffset.x() + sourceRect.width() <= paintRect.width()); |
497 CHECK(paintOffset.y() + sourceRect.height() <= paintRect.height()); | 497 CHECK(paintOffset.y() + sourceRect.height() <= paintRect.height()); |
498 | 498 |
499 tile->updaterResource()->update(queue, sourceRect, destOffset, tile-
>partialUpdate, stats); | 499 tile->updaterResource()->update(queue, sourceRect, destOffset, tile-
>partialUpdate, stats); |
500 if (occlusion) | 500 if (occlusion) |
501 occlusion->OverdrawMetrics().didUpload(gfx::Transform(), sourceR
ect, tile->opaqueRect()); | 501 occlusion->OverdrawMetrics().DidUpload(gfx::Transform(), sourceR
ect, tile->opaqueRect()); |
502 | 502 |
503 } | 503 } |
504 } | 504 } |
505 } | 505 } |
506 | 506 |
507 // This picks a small animated layer to be anything less than one viewport. This | 507 // This picks a small animated layer to be anything less than one viewport. This |
508 // is specifically for page transitions which are viewport-sized layers. The ext
ra | 508 // is specifically for page transitions which are viewport-sized layers. The ext
ra |
509 // tile of padding is due to these layers being slightly larger than the viewpor
t | 509 // tile of padding is due to these layers being slightly larger than the viewpor
t |
510 // in some cases. | 510 // in some cases. |
511 bool TiledLayer::isSmallAnimatedLayer() const | 511 bool TiledLayer::isSmallAnimatedLayer() const |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 gfx::Rect prepaintRect = visibleContentRect(); | 774 gfx::Rect prepaintRect = visibleContentRect(); |
775 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns, | 775 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns, |
776 -m_tiler->tileSize().height() * prepaintRows); | 776 -m_tiler->tileSize().height() * prepaintRows); |
777 gfx::Rect contentRect(gfx::Point(), contentBounds()); | 777 gfx::Rect contentRect(gfx::Point(), contentBounds()); |
778 prepaintRect.Intersect(contentRect); | 778 prepaintRect.Intersect(contentRect); |
779 | 779 |
780 return prepaintRect; | 780 return prepaintRect; |
781 } | 781 } |
782 | 782 |
783 } // namespace cc | 783 } // namespace cc |
OLD | NEW |