OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ppapi/utility/graphics/paint_aggregator.h" | 5 #include "ppapi/utility/graphics/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 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // an invalidation of the scroll. | 200 // an invalidation of the scroll. |
201 if (ShouldInvalidateScrollRect(Rect())) | 201 if (ShouldInvalidateScrollRect(Rect())) |
202 InvalidateScrollRect(); | 202 InvalidateScrollRect(); |
203 } | 203 } |
204 | 204 |
205 Rect PaintAggregator::ScrollPaintRect(const Rect& paint_rect, | 205 Rect PaintAggregator::ScrollPaintRect(const Rect& paint_rect, |
206 const Point& amount) const { | 206 const Point& amount) const { |
207 Rect result = paint_rect; | 207 Rect result = paint_rect; |
208 | 208 |
209 result.Offset(amount); | 209 result.Offset(amount); |
210 result = update_.scroll_rect.Intersect(result); | 210 result.Intersect(update_.scroll_rect); |
211 | 211 |
212 // Subtract out the scroll damage rect to avoid redundant painting. | 212 // Subtract out the scroll damage rect to avoid redundant painting. |
213 return result.Subtract(update_.GetScrollDamage()); | 213 return result.Subtract(update_.GetScrollDamage()); |
214 } | 214 } |
215 | 215 |
216 bool PaintAggregator::ShouldInvalidateScrollRect(const Rect& rect) const { | 216 bool PaintAggregator::ShouldInvalidateScrollRect(const Rect& rect) const { |
217 if (!rect.IsEmpty()) { | 217 if (!rect.IsEmpty()) { |
218 if (!update_.scroll_rect.Intersects(rect)) | 218 if (!update_.scroll_rect.Intersects(rect)) |
219 return false; | 219 return false; |
220 | 220 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 outer = outer.Union(existing_rect); | 270 outer = outer.Union(existing_rect); |
271 } | 271 } |
272 } | 272 } |
273 update_.paint_rects.clear(); | 273 update_.paint_rects.clear(); |
274 update_.paint_rects.push_back(inner); | 274 update_.paint_rects.push_back(inner); |
275 update_.paint_rects.push_back(outer); | 275 update_.paint_rects.push_back(outer); |
276 } | 276 } |
277 } | 277 } |
278 | 278 |
279 } // namespace pp | 279 } // namespace pp |
OLD | NEW |