| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_RENDERER_PAINT_AGGREGATOR_H_ |
| 6 #define CHROME_RENDERER_PAINT_AGGREGATOR_H_ |
| 7 |
| 8 #include "base/gfx/rect.h" |
| 9 |
| 10 // This class is responsible for aggregating multiple invalidation and scroll |
| 11 // commands to produce a single scroll and repaint. |
| 12 class PaintAggregator { |
| 13 public: |
| 14 |
| 15 // This structure describes an aggregation of InvalidateRect and ScrollRect |
| 16 // calls. If |scroll_rect| is non-empty, then that rect should be scrolled |
| 17 // by the amount specified by |scroll_delta|. If |paint_rect| is non-empty, |
| 18 // then that rect should be repainted. If |scroll_rect| and |paint_rect| are |
| 19 // non-empty, then scrolling should be performed before repainting. |
| 20 // |scroll_delta| can only specify scrolling in one direction (i.e., the x |
| 21 // and y members cannot both be non-zero). |
| 22 struct PendingUpdate { |
| 23 gfx::Point scroll_delta; |
| 24 gfx::Rect scroll_rect; |
| 25 gfx::Rect paint_rect; |
| 26 |
| 27 // Returns the rect damaged by scrolling within |scroll_rect| by |
| 28 // |scroll_delta|. This rect must be repainted. |
| 29 gfx::Rect GetScrollDamage() const; |
| 30 }; |
| 31 |
| 32 // There is a PendingUpdate if InvalidateRect or ScrollRect were called and |
| 33 // ClearPendingUpdate was not called. |
| 34 bool HasPendingUpdate() const; |
| 35 void ClearPendingUpdate(); |
| 36 |
| 37 const PendingUpdate& GetPendingUpdate() const { return update_; } |
| 38 |
| 39 // The given rect should be repainted. |
| 40 void InvalidateRect(const gfx::Rect& rect); |
| 41 |
| 42 // The given rect should be scrolled by the given amounts. |
| 43 void ScrollRect(int dx, int dy, const gfx::Rect& clip_rect); |
| 44 |
| 45 private: |
| 46 PendingUpdate update_; |
| 47 }; |
| 48 |
| 49 #endif // CHROME_RENDERER_PAINT_AGGREGATOR_H_ |
| OLD | NEW |