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/basictypes.h" | 8 #include "base/basictypes.h" |
8 #include "build/build_config.h" | 9 #include "build/build_config.h" |
9 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
10 #include "cc/layer_tree_host.h" | 11 #include "cc/layer_tree_host.h" |
11 #include "cc/overdraw_metrics.h" | 12 #include "cc/overdraw_metrics.h" |
12 #include "cc/tiled_layer_impl.h" | 13 #include "cc/tiled_layer_impl.h" |
13 #include "third_party/khronos/GLES2/gl2.h" | 14 #include "third_party/khronos/GLES2/gl2.h" |
14 #include "ui/gfx/rect_conversions.h" | 15 #include "ui/gfx/rect_conversions.h" |
15 | 16 |
16 using namespace std; | 17 using namespace std; |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 m_predictedVisibleRect.Intersect(bound); | 628 m_predictedVisibleRect.Intersect(bound); |
628 } | 629 } |
629 m_previousContentBounds = contentBounds(); | 630 m_previousContentBounds = contentBounds(); |
630 m_previousVisibleRect = visibleContentRect(); | 631 m_previousVisibleRect = visibleContentRect(); |
631 } | 632 } |
632 | 633 |
633 void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
usion, RenderingStats& stats) | 634 void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
usion, RenderingStats& stats) |
634 { | 635 { |
635 DCHECK(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped
? | 636 DCHECK(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped
? |
636 | 637 |
637 ContentsScalingLayer::update(queue, occlusion, stats); | 638 { |
| 639 base::AutoReset<bool> ignoreSetNeedsCommit(&m_ignoreSetNeedsCommit, true
); |
638 | 640 |
639 updateBounds(); | 641 ContentsScalingLayer::update(queue, occlusion, stats); |
| 642 updateBounds(); |
| 643 } |
| 644 |
640 if (m_tiler->hasEmptyBounds() || !drawsContent()) | 645 if (m_tiler->hasEmptyBounds() || !drawsContent()) |
641 return; | 646 return; |
642 | 647 |
643 bool didPaint = false; | 648 bool didPaint = false; |
644 | 649 |
645 // Animation pre-paint. If the layer is small, try to paint it all | 650 // Animation pre-paint. If the layer is small, try to paint it all |
646 // immediately whether or not it is occluded, to avoid paint/upload | 651 // immediately whether or not it is occluded, to avoid paint/upload |
647 // hiccups while it is animating. | 652 // hiccups while it is animating. |
648 if (isSmallAnimatedLayer()) { | 653 if (isSmallAnimatedLayer()) { |
649 int left, top, right, bottom; | 654 int left, top, right, bottom; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 gfx::Rect prepaintRect = visibleContentRect(); | 765 gfx::Rect prepaintRect = visibleContentRect(); |
761 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns, | 766 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns, |
762 -m_tiler->tileSize().height() * prepaintRows); | 767 -m_tiler->tileSize().height() * prepaintRows); |
763 gfx::Rect contentRect(gfx::Point(), contentBounds()); | 768 gfx::Rect contentRect(gfx::Point(), contentBounds()); |
764 prepaintRect.Intersect(contentRect); | 769 prepaintRect.Intersect(contentRect); |
765 | 770 |
766 return prepaintRect; | 771 return prepaintRect; |
767 } | 772 } |
768 | 773 |
769 } // namespace cc | 774 } // namespace cc |
OLD | NEW |