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

Side by Side Diff: views/widget/root_view.cc

Issue 2825018: Canvas refactoring part 3.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | Annotate | Revision Log
OLDNEW
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 #include "views/widget/root_view.h" 5 #include "views/widget/root_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/drag_drop_types.h" 9 #include "app/drag_drop_types.h"
10 #include "base/keyboard_codes.h" 10 #include "base/keyboard_codes.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "gfx/canvas.h" 13 #include "gfx/canvas_skia.h"
14 #include "views/fill_layout.h" 14 #include "views/fill_layout.h"
15 #include "views/focus/view_storage.h" 15 #include "views/focus/view_storage.h"
16 #include "views/widget/widget.h" 16 #include "views/widget/widget.h"
17 #include "views/window/window.h" 17 #include "views/window/window.h"
18 18
19 #if defined(OS_LINUX) 19 #if defined(OS_LINUX)
20 #include "views/widget/widget_gtk.h" 20 #include "views/widget/widget_gtk.h"
21 #endif // defined(OS_LINUX) 21 #endif // defined(OS_LINUX)
22 22
23 namespace views { 23 namespace views {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 #endif 166 #endif
167 167
168 // Clip the invalid rect to our bounds. If a view is in a scrollview 168 // Clip the invalid rect to our bounds. If a view is in a scrollview
169 // it could be a lot larger 169 // it could be a lot larger
170 invalid_rect_ = GetScheduledPaintRectConstrainedToSize(); 170 invalid_rect_ = GetScheduledPaintRectConstrainedToSize();
171 171
172 if (invalid_rect_.IsEmpty()) 172 if (invalid_rect_.IsEmpty())
173 return; 173 return;
174 174
175 // Clear the background. 175 // Clear the background.
176 canvas->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); 176 canvas->AsCanvasSkia()->drawColor(SK_ColorBLACK, SkXfermode::kClear_Mode);
177 177
178 // Save the current transforms. 178 // Save the current transforms.
179 canvas->save(); 179 canvas->AsCanvasSkia()->save();
180 180
181 // Set the clip rect according to the invalid rect. 181 // Set the clip rect according to the invalid rect.
182 int clip_x = invalid_rect_.x() + x(); 182 int clip_x = invalid_rect_.x() + x();
183 int clip_y = invalid_rect_.y() + y(); 183 int clip_y = invalid_rect_.y() + y();
184 canvas->ClipRectInt(clip_x, clip_y, invalid_rect_.width(), 184 canvas->ClipRectInt(clip_x, clip_y, invalid_rect_.width(),
185 invalid_rect_.height()); 185 invalid_rect_.height());
186 186
187 // Paint the tree 187 // Paint the tree
188 View::ProcessPaint(canvas); 188 View::ProcessPaint(canvas);
189 189
190 // Restore the previous transform 190 // Restore the previous transform
191 canvas->restore(); 191 canvas->AsCanvasSkia()->restore();
192 192
193 ClearPaintRect(); 193 ClearPaintRect();
194 } 194 }
195 195
196 void RootView::PaintNow() { 196 void RootView::PaintNow() {
197 if (pending_paint_task_) { 197 if (pending_paint_task_) {
198 pending_paint_task_->Cancel(); 198 pending_paint_task_->Cancel();
199 pending_paint_task_ = NULL; 199 pending_paint_task_ = NULL;
200 } 200 }
201 if (!paint_task_needed_) 201 if (!paint_task_needed_)
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 MouseEvent exited_near_event(Event::ET_MOUSE_EXITED_NEAR, 0, 0, 0); 780 MouseEvent exited_near_event(Event::ET_MOUSE_EXITED_NEAR, 0, 0, 0);
781 for (std::set<View*>::const_iterator i = near_views_.begin(); 781 for (std::set<View*>::const_iterator i = near_views_.begin();
782 i != near_views_.end(); ++i) { 782 i != near_views_.end(); ++i) {
783 (*i)->OnMouseExitedNear(exited_near_event); 783 (*i)->OnMouseExitedNear(exited_near_event);
784 } 784 }
785 785
786 near_views_.clear(); 786 near_views_.clear();
787 } 787 }
788 788
789 } // namespace views 789 } // namespace views
OLDNEW
« gfx/canvas.h ('K') | « views/view_unittest.cc ('k') | views/widget/root_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698