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 #ifndef PDF_PAINT_AGGREGATOR_H_ | 5 #ifndef PDF_PAINT_AGGREGATOR_H_ |
6 #define PDF_PAINT_AGGREGATOR_H_ | 6 #define PDF_PAINT_AGGREGATOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ppapi/cpp/image_data.h" | 10 #include "ppapi/cpp/image_data.h" |
11 #include "ppapi/cpp/rect.h" | 11 #include "ppapi/cpp/rect.h" |
12 #include "ppapi/cpp/rect.h" | |
13 | 12 |
14 // This class is responsible for aggregating multiple invalidation and scroll | 13 // This class is responsible for aggregating multiple invalidation and scroll |
15 // commands to produce a scroll and repaint sequence. You can use this manually | 14 // commands to produce a scroll and repaint sequence. You can use this manually |
16 // to track your updates, but most applications will use the PaintManager to | 15 // to track your updates, but most applications will use the PaintManager to |
17 // additionally handle the necessary callbacks on top of the PaintAggregator | 16 // additionally handle the necessary callbacks on top of the PaintAggregator |
18 // functionality. | 17 // functionality. |
19 // | 18 // |
20 // See http://code.google.com/p/ppapi/wiki/2DPaintingModel | 19 // See http://code.google.com/p/ppapi/wiki/2DPaintingModel |
21 class PaintAggregator { | 20 class PaintAggregator { |
22 public: | 21 public: |
23 // Stores information about a rectangle that has finished painting. The | 22 // Stores information about a rectangle that has finished painting. The |
24 // PaintManager will paint it only when everything else on the screen is also | 23 // PaintManager will paint it only when everything else on the screen is also |
25 // ready. | 24 // ready. |
26 struct ReadyRect { | 25 struct ReadyRect { |
27 pp::Point offset; | 26 pp::Point offset; |
28 pp::Rect rect; | 27 pp::Rect rect; |
29 pp::ImageData image_data; | 28 pp::ImageData image_data; |
30 }; | 29 }; |
31 | 30 |
32 struct PaintUpdate { | 31 struct PaintUpdate { |
33 PaintUpdate(); | 32 PaintUpdate(); |
| 33 PaintUpdate(const PaintUpdate& that); |
34 ~PaintUpdate(); | 34 ~PaintUpdate(); |
35 | 35 |
36 // True if there is a scroll applied. This indicates that the scroll delta | 36 // True if there is a scroll applied. This indicates that the scroll delta |
37 // and scroll_rect are nonzero (just as a convenience). | 37 // and scroll_rect are nonzero (just as a convenience). |
38 bool has_scroll; | 38 bool has_scroll; |
39 | 39 |
40 // The amount to scroll by. Either the X or Y may be nonzero to indicate a | 40 // The amount to scroll by. Either the X or Y may be nonzero to indicate a |
41 // scroll in that direction, but there will never be a scroll in both | 41 // scroll in that direction, but there will never be a scroll in both |
42 // directions at the same time (this will be converted to a paint of the | 42 // directions at the same time (this will be converted to a paint of the |
43 // region instead). | 43 // region instead). |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 // Internal method used by InvalidateRect. If |check_scroll| is true, then the | 122 // Internal method used by InvalidateRect. If |check_scroll| is true, then the |
123 // method checks if there's a pending scroll and if so also invalidates |rect| | 123 // method checks if there's a pending scroll and if so also invalidates |rect| |
124 // in the new scroll position. | 124 // in the new scroll position. |
125 void InvalidateRectInternal(const pp::Rect& rect, bool check_scroll); | 125 void InvalidateRectInternal(const pp::Rect& rect, bool check_scroll); |
126 | 126 |
127 InternalPaintUpdate update_; | 127 InternalPaintUpdate update_; |
128 }; | 128 }; |
129 | 129 |
130 #endif // PDF_PAINT_AGGREGATOR_H_ | 130 #endif // PDF_PAINT_AGGREGATOR_H_ |
OLD | NEW |