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 #ifndef PPAPI_CPP_PAINT_MANAGER_H_ | 5 #ifndef PPAPI_CPP_PAINT_MANAGER_H_ |
6 #define PPAPI_CPP_PAINT_MANAGER_H_ | 6 #define PPAPI_CPP_PAINT_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ppapi/cpp/completion_callback.h" | 10 #include "ppapi/cpp/completion_callback.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 /// This class converts the "instance push" model of painting in PPAPI to a | 25 /// This class converts the "instance push" model of painting in PPAPI to a |
26 /// paint request at a later time. Usage is that you call Invalidate and | 26 /// paint request at a later time. Usage is that you call Invalidate and |
27 /// Scroll, and implement the Client interface. Your OnPaint handler will | 27 /// Scroll, and implement the Client interface. Your OnPaint handler will |
28 /// then get called with coalesced paint events. | 28 /// then get called with coalesced paint events. |
29 /// | 29 /// |
30 /// This class is basically a <code>PaintAggregator</code> that groups updates, | 30 /// This class is basically a <code>PaintAggregator</code> that groups updates, |
31 /// plus management of callbacks for scheduling paints. | 31 /// plus management of callbacks for scheduling paints. |
32 /// | 32 /// |
33 /// <strong>Example:</strong> | 33 /// <strong>Example:</strong> |
34 /// | 34 /// |
35 /// @code | 35 /// <code> |
36 /// | 36 /// |
37 /// class MyClass : public pp::Instance, public PaintManager::Client { | 37 /// class MyClass : public pp::Instance, public PaintManager::Client { |
38 /// public: | 38 /// public: |
39 /// MyClass() { | 39 /// MyClass() { |
40 /// paint_manager_.Initialize(this, this, false); | 40 /// paint_manager_.Initialize(this, this, false); |
41 /// } | 41 /// } |
42 /// | 42 /// |
43 /// void ViewChanged(const pp::Rect& position, const pp::Rect& clip) { | 43 /// void ViewChanged(const pp::Rect& position, const pp::Rect& clip) { |
44 /// paint_manager_.SetSize(position.size()); | 44 /// paint_manager_.SetSize(position.size()); |
45 /// } | 45 /// } |
(...skipping 12 matching lines...) Expand all Loading... |
58 /// // Then we would either repaint the area returned by GetPaintBounds or | 58 /// // Then we would either repaint the area returned by GetPaintBounds or |
59 /// // iterate through all the paint_rects. | 59 /// // iterate through all the paint_rects. |
60 /// | 60 /// |
61 /// // The caller will call Flush() for us, so don't do that here. | 61 /// // The caller will call Flush() for us, so don't do that here. |
62 /// return true; | 62 /// return true; |
63 /// } | 63 /// } |
64 /// | 64 /// |
65 /// private: | 65 /// private: |
66 /// pp::PaintManager paint_manager_; | 66 /// pp::PaintManager paint_manager_; |
67 /// }; | 67 /// }; |
68 /// @endcode | 68 /// </code> |
69 class PaintManager { | 69 class PaintManager { |
70 public: | 70 public: |
71 class Client { | 71 class Client { |
72 public: | 72 public: |
73 /// OnPaint() paints the given invalid area of the instance to the given | 73 /// OnPaint() paints the given invalid area of the instance to the given |
74 /// graphics device. Returns true if anything was painted. | 74 /// graphics device. Returns true if anything was painted. |
75 /// | 75 /// |
76 /// You are given the list of rects to paint in <code>paint_rects</code>, | 76 /// You are given the list of rects to paint in <code>paint_rects</code>, |
77 /// and the union of all of these rects in <code>paint_bounds</code>. You | 77 /// and the union of all of these rects in <code>paint_bounds</code>. You |
78 /// only have to paint the area inside each of the | 78 /// only have to paint the area inside each of the |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // When we get a resize, we don't bind right away (see SetSize). The | 288 // When we get a resize, we don't bind right away (see SetSize). The |
289 // has_pending_resize_ tells us that we need to do a resize for the next | 289 // has_pending_resize_ tells us that we need to do a resize for the next |
290 // paint operation. When true, the new size is in pending_size_. | 290 // paint operation. When true, the new size is in pending_size_. |
291 bool has_pending_resize_; | 291 bool has_pending_resize_; |
292 Size pending_size_; | 292 Size pending_size_; |
293 }; | 293 }; |
294 | 294 |
295 } // namespace pp | 295 } // namespace pp |
296 | 296 |
297 #endif // PPAPI_CPP_PAINT_MANAGER_H_ | 297 #endif // PPAPI_CPP_PAINT_MANAGER_H_ |
OLD | NEW |