| 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 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "TiledLayerChromium.h" | 10 #include "TiledLayerChromium.h" |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 sourceRect.intersect(dirtyRect); | 514 sourceRect.intersect(dirtyRect); |
| 515 // Paint rect not guaranteed to line up on tile boundaries, so | 515 // Paint rect not guaranteed to line up on tile boundaries, so |
| 516 // make sure that sourceRect doesn't extend outside of it. | 516 // make sure that sourceRect doesn't extend outside of it. |
| 517 sourceRect.intersect(paintRect); | 517 sourceRect.intersect(paintRect); |
| 518 | 518 |
| 519 tile->updateRect = sourceRect; | 519 tile->updateRect = sourceRect; |
| 520 | 520 |
| 521 if (sourceRect.isEmpty()) | 521 if (sourceRect.isEmpty()) |
| 522 continue; | 522 continue; |
| 523 | 523 |
| 524 tile->texture()->prepareRect(sourceRect, stats); | |
| 525 if (occlusion) | |
| 526 occlusion->overdrawMetrics().didUpload(WebTransformationMatrix()
, sourceRect, tile->opaqueRect()); | |
| 527 | |
| 528 const IntPoint anchor = m_tiler->tileRect(tile).location(); | 524 const IntPoint anchor = m_tiler->tileRect(tile).location(); |
| 529 | 525 |
| 530 // Calculate tile-space rectangle to upload into. | 526 // Calculate tile-space rectangle to upload into. |
| 531 IntSize destOffset(sourceRect.x() - anchor.x(), sourceRect.y() - anc
hor.y()); | 527 IntSize destOffset(sourceRect.x() - anchor.x(), sourceRect.y() - anc
hor.y()); |
| 532 if (destOffset.width() < 0) | 528 if (destOffset.width() < 0) |
| 533 CRASH(); | 529 CRASH(); |
| 534 if (destOffset.height() < 0) | 530 if (destOffset.height() < 0) |
| 535 CRASH(); | 531 CRASH(); |
| 536 | 532 |
| 537 // Offset from paint rectangle to this tile's dirty rectangle. | 533 // Offset from paint rectangle to this tile's dirty rectangle. |
| 538 IntPoint paintOffset(sourceRect.x() - paintRect.x(), sourceRect.y()
- paintRect.y()); | 534 IntPoint paintOffset(sourceRect.x() - paintRect.x(), sourceRect.y()
- paintRect.y()); |
| 539 if (paintOffset.x() < 0) | 535 if (paintOffset.x() < 0) |
| 540 CRASH(); | 536 CRASH(); |
| 541 if (paintOffset.y() < 0) | 537 if (paintOffset.y() < 0) |
| 542 CRASH(); | 538 CRASH(); |
| 543 if (paintOffset.x() + sourceRect.width() > paintRect.width()) | 539 if (paintOffset.x() + sourceRect.width() > paintRect.width()) |
| 544 CRASH(); | 540 CRASH(); |
| 545 if (paintOffset.y() + sourceRect.height() > paintRect.height()) | 541 if (paintOffset.y() + sourceRect.height() > paintRect.height()) |
| 546 CRASH(); | 542 CRASH(); |
| 547 | 543 |
| 548 TextureUploader::Parameters upload = { tile->texture(), sourceRect,
destOffset }; | 544 tile->texture()->update(queue, sourceRect, destOffset, tile->partial
Update, stats); |
| 549 if (tile->partialUpdate) | 545 if (occlusion) |
| 550 queue.appendPartialUpload(upload); | 546 occlusion->overdrawMetrics().didUpload(WebTransformationMatrix()
, sourceRect, tile->opaqueRect()); |
| 551 else | 547 |
| 552 queue.appendFullUpload(upload); | |
| 553 } | 548 } |
| 554 } | 549 } |
| 555 } | 550 } |
| 556 | 551 |
| 557 namespace { | 552 namespace { |
| 558 // This picks a small animated layer to be anything less than one viewport. This | 553 // This picks a small animated layer to be anything less than one viewport. This |
| 559 // is specifically for page transitions which are viewport-sized layers. The ext
ra | 554 // is specifically for page transitions which are viewport-sized layers. The ext
ra |
| 560 // 64 pixels is due to these layers being slightly larger than the viewport in s
ome cases. | 555 // 64 pixels is due to these layers being slightly larger than the viewport in s
ome cases. |
| 561 bool isSmallAnimatedLayer(TiledLayerChromium* layer) | 556 bool isSmallAnimatedLayer(TiledLayerChromium* layer) |
| 562 { | 557 { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 prepaintRect.inflateX(m_tiler->tileSize().width()); | 806 prepaintRect.inflateX(m_tiler->tileSize().width()); |
| 812 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); | 807 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); |
| 813 IntRect contentRect(IntPoint::zero(), contentBounds()); | 808 IntRect contentRect(IntPoint::zero(), contentBounds()); |
| 814 prepaintRect.intersect(contentRect); | 809 prepaintRect.intersect(contentRect); |
| 815 | 810 |
| 816 return prepaintRect; | 811 return prepaintRect; |
| 817 } | 812 } |
| 818 | 813 |
| 819 } | 814 } |
| 820 #endif // USE(ACCELERATED_COMPOSITING) | 815 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |