| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "ppapi/cpp/paint_aggregator.h" | 5 #include "ppapi/cpp/paint_aggregator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ppapi/cpp/logging.h" | 9 #include "ppapi/cpp/logging.h" |
| 10 | 10 |
| 11 // ---------------------------------------------------------------------------- | 11 // ---------------------------------------------------------------------------- |
| 12 // ALGORITHM NOTES | 12 // ALGORITHM NOTES |
| 13 // | 13 // |
| 14 // We attempt to maintain a scroll rect in the presence of invalidations that | 14 // We attempt to maintain a scroll rect in the presence of invalidations that |
| 15 // are contained within the scroll rect. If an invalidation crosses a scroll | 15 // are contained within the scroll rect. If an invalidation crosses a scroll |
| 16 // rect, then we just treat the scroll rect as an invalidation rect. | 16 // rect, then we just treat the scroll rect as an invalidation rect. |
| 17 // | 17 // |
| 18 // For invalidations performed prior to scrolling and contained within the | 18 // For invalidations performed prior to scrolling and contained within the |
| 19 // scroll rect, we offset the invalidation rects to account for the fact that | 19 // scroll rect, we offset the invalidation rects to account for the fact that |
| 20 // the consumer will perform scrolling before painting. | 20 // the consumer will perform scrolling before painting. |
| 21 // | 21 // |
| 22 // We only support scrolling along one axis at a time. A diagonal scroll will | 22 // We only support scrolling along one axis at a time. A diagonal scroll will |
| 23 // therefore be treated as an invalidation. | 23 // therefore be treated as an invalidation. |
| 24 // ---------------------------------------------------------------------------- | 24 // ---------------------------------------------------------------------------- |
| 25 | 25 |
| 26 namespace pp { | 26 namespace pp { |
| 27 | 27 |
| 28 PaintAggregator::InternalPaintUpdate::InternalPaintUpdate() { | 28 PaintAggregator::PaintUpdate::PaintUpdate() {} |
| 29 } | 29 |
| 30 PaintAggregator::PaintUpdate::~PaintUpdate() {} |
| 31 |
| 32 PaintAggregator::InternalPaintUpdate::InternalPaintUpdate() {} |
| 33 |
| 34 PaintAggregator::InternalPaintUpdate::~InternalPaintUpdate() {} |
| 30 | 35 |
| 31 Rect PaintAggregator::InternalPaintUpdate::GetScrollDamage() const { | 36 Rect PaintAggregator::InternalPaintUpdate::GetScrollDamage() const { |
| 32 // Should only be scrolling in one direction at a time. | 37 // Should only be scrolling in one direction at a time. |
| 33 PP_DCHECK(!(scroll_delta.x() && scroll_delta.y())); | 38 PP_DCHECK(!(scroll_delta.x() && scroll_delta.y())); |
| 34 | 39 |
| 35 Rect damaged_rect; | 40 Rect damaged_rect; |
| 36 | 41 |
| 37 // Compute the region we will expose by scrolling, and paint that into a | 42 // Compute the region we will expose by scrolling, and paint that into a |
| 38 // shared memory section. | 43 // shared memory section. |
| 39 if (scroll_delta.x()) { | 44 if (scroll_delta.x()) { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 outer = outer.Union(existing_rect); | 270 outer = outer.Union(existing_rect); |
| 266 } | 271 } |
| 267 } | 272 } |
| 268 update_.paint_rects.clear(); | 273 update_.paint_rects.clear(); |
| 269 update_.paint_rects.push_back(inner); | 274 update_.paint_rects.push_back(inner); |
| 270 update_.paint_rects.push_back(outer); | 275 update_.paint_rects.push_back(outer); |
| 271 } | 276 } |
| 272 } | 277 } |
| 273 | 278 |
| 274 } // namespace pp | 279 } // namespace pp |
| OLD | NEW |