Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: ppapi/utility/graphics/paint_manager.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_manager.h" 5 #include "ppapi/utility/graphics/paint_manager.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/cpp/instance.h" 8 #include "ppapi/cpp/instance.h"
9 #include "ppapi/cpp/logging.h" 9 #include "ppapi/cpp/logging.h"
10 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 EnsureCallbackPending(); 71 EnsureCallbackPending();
72 aggregator_.InvalidateRect(Rect(GetEffectiveSize())); 72 aggregator_.InvalidateRect(Rect(GetEffectiveSize()));
73 } 73 }
74 74
75 void PaintManager::InvalidateRect(const Rect& rect) { 75 void PaintManager::InvalidateRect(const Rect& rect) {
76 // You must call SetSize before using. 76 // You must call SetSize before using.
77 PP_DCHECK(!graphics_.is_null() || has_pending_resize_); 77 PP_DCHECK(!graphics_.is_null() || has_pending_resize_);
78 78
79 // Clip the rect to the device area. 79 // Clip the rect to the device area.
80 Rect clipped_rect = rect.Intersect(Rect(GetEffectiveSize())); 80 Rect clipped_rect = rect;
81 clipped_rect.Intersect(Rect(GetEffectiveSize()));
81 if (clipped_rect.IsEmpty()) 82 if (clipped_rect.IsEmpty())
82 return; // Nothing to do. 83 return; // Nothing to do.
83 84
84 EnsureCallbackPending(); 85 EnsureCallbackPending();
85 aggregator_.InvalidateRect(clipped_rect); 86 aggregator_.InvalidateRect(clipped_rect);
86 } 87 }
87 88
88 void PaintManager::ScrollRect(const Rect& clip_rect, const Point& amount) { 89 void PaintManager::ScrollRect(const Rect& clip_rect, const Point& amount) {
89 // You must call SetSize before using. 90 // You must call SetSize before using.
90 PP_DCHECK(!graphics_.is_null() || has_pending_resize_); 91 PP_DCHECK(!graphics_.is_null() || has_pending_resize_);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Just because we have a manual callback doesn't mean there are actually any 201 // Just because we have a manual callback doesn't mean there are actually any
201 // invalid regions. Even though we only schedule this callback when something 202 // invalid regions. Even though we only schedule this callback when something
202 // is pending, a Flush callback could have come in before this callback was 203 // is pending, a Flush callback could have come in before this callback was
203 // executed and that could have cleared the queue. 204 // executed and that could have cleared the queue.
204 if (aggregator_.HasPendingUpdate() && !flush_pending_) 205 if (aggregator_.HasPendingUpdate() && !flush_pending_)
205 DoPaint(); 206 DoPaint();
206 } 207 }
207 208
208 209
209 } // namespace pp 210 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698