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

Side by Side Diff: views/view.cc

Issue 8383028: ui/gfx: Convert Canvas::ClipRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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) 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 #include "views/view.h" 5 #include "views/view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 670
671 ScopedCanvas scoped_canvas(canvas); 671 ScopedCanvas scoped_canvas(canvas);
672 672
673 // Paint this View and its children, setting the clip rect to the bounds 673 // Paint this View and its children, setting the clip rect to the bounds
674 // of this View and translating the origin to the local bounds' top left 674 // of this View and translating the origin to the local bounds' top left
675 // point. 675 // point.
676 // 676 //
677 // Note that the X (or left) position we pass to ClipRectInt takes into 677 // Note that the X (or left) position we pass to ClipRectInt takes into
678 // consideration whether or not the view uses a right-to-left layout so that 678 // consideration whether or not the view uses a right-to-left layout so that
679 // we paint our view in its mirrored position if need be. 679 // we paint our view in its mirrored position if need be.
680 if (!canvas->ClipRectInt(GetMirroredX(), y(), 680 if (!canvas->ClipRectInt(gfx::Rect(GetMirroredX(), y(),
681 width() - static_cast<int>(clip_x_), 681 width() - static_cast<int>(clip_x_),
682 height() - static_cast<int>(clip_y_))) { 682 height() - static_cast<int>(clip_y_)))) {
683 return; 683 return;
684 } 684 }
685 // Non-empty clip, translate the graphics such that 0,0 corresponds to 685 // Non-empty clip, translate the graphics such that 0,0 corresponds to
686 // where this view is located (related to its parent). 686 // where this view is located (related to its parent).
687 canvas->TranslateInt(GetMirroredX(), y()); 687 canvas->TranslateInt(GetMirroredX(), y());
688 688
689 canvas->Transform(GetTransform()); 689 canvas->Transform(GetTransform());
690 690
691 PaintCommon(canvas); 691 PaintCommon(canvas);
692 } 692 }
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 2075
2076 OSExchangeData data; 2076 OSExchangeData data;
2077 WriteDragData(press_pt, &data); 2077 WriteDragData(press_pt, &data);
2078 2078
2079 // Message the RootView to do the drag and drop. That way if we're removed 2079 // Message the RootView to do the drag and drop. That way if we're removed
2080 // the RootView can detect it and avoid calling us back. 2080 // the RootView can detect it and avoid calling us back.
2081 GetWidget()->RunShellDrag(this, data, drag_operations); 2081 GetWidget()->RunShellDrag(this, data, drag_operations);
2082 } 2082 }
2083 2083
2084 } // namespace views 2084 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698