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

Side by Side Diff: views/view.cc

Issue 7273073: Animated Rotation (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Address reviewer comments Created 9 years, 3 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
« no previous file with comments | « views/view.h ('k') | views/views.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/logging.h" 10 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h" 12 #include "base/message_loop.h"
12 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
13 #include "third_party/skia/include/core/SkRect.h" 14 #include "third_party/skia/include/core/SkRect.h"
14 #include "ui/base/accessibility/accessibility_types.h" 15 #include "ui/base/accessibility/accessibility_types.h"
15 #include "ui/base/dragdrop/drag_drop_types.h" 16 #include "ui/base/dragdrop/drag_drop_types.h"
16 #include "ui/gfx/canvas_skia.h" 17 #include "ui/gfx/canvas_skia.h"
17 #include "ui/gfx/compositor/compositor.h" 18 #include "ui/gfx/compositor/compositor.h"
18 #include "ui/gfx/compositor/layer.h" 19 #include "ui/gfx/compositor/layer.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 98
98 // Creation and lifetime ------------------------------------------------------- 99 // Creation and lifetime -------------------------------------------------------
99 100
100 View::View() 101 View::View()
101 : parent_owned_(true), 102 : parent_owned_(true),
102 id_(0), 103 id_(0),
103 group_(-1), 104 group_(-1),
104 parent_(NULL), 105 parent_(NULL),
105 visible_(true), 106 visible_(true),
106 enabled_(true), 107 enabled_(true),
108 painting_enabled_(true),
107 registered_for_visible_bounds_notification_(false), 109 registered_for_visible_bounds_notification_(false),
108 clip_x_(0.0), 110 clip_x_(0.0),
109 clip_y_(0.0), 111 clip_y_(0.0),
110 needs_layout_(true), 112 needs_layout_(true),
111 flip_canvas_on_paint_for_rtl_ui_(false), 113 flip_canvas_on_paint_for_rtl_ui_(false),
112 accelerator_registration_delayed_(false), 114 accelerator_registration_delayed_(false),
113 accelerator_focus_manager_(NULL), 115 accelerator_focus_manager_(NULL),
114 registered_accelerator_count_(0), 116 registered_accelerator_count_(0),
115 next_focusable_view_(NULL), 117 next_focusable_view_(NULL),
116 previous_focusable_view_(NULL), 118 previous_focusable_view_(NULL),
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 return x_rect; 675 return x_rect;
674 } 676 }
675 677
676 // Painting -------------------------------------------------------------------- 678 // Painting --------------------------------------------------------------------
677 679
678 void View::SchedulePaint() { 680 void View::SchedulePaint() {
679 SchedulePaintInRect(GetLocalBounds()); 681 SchedulePaintInRect(GetLocalBounds());
680 } 682 }
681 683
682 void View::SchedulePaintInRect(const gfx::Rect& rect) { 684 void View::SchedulePaintInRect(const gfx::Rect& rect) {
683 if (!IsVisible()) 685 if (!IsVisible() || !painting_enabled_)
684 return; 686 return;
685 687
686 MarkLayerDirty(); 688 MarkLayerDirty();
687 SchedulePaintInternal(rect); 689 SchedulePaintInternal(rect);
688 } 690 }
689 691
690 void View::Paint(gfx::Canvas* canvas) { 692 void View::Paint(gfx::Canvas* canvas) {
691 if (!IsVisible()) 693 TRACE_EVENT0("View", "Paint");
694 if (!IsVisible() || !painting_enabled_)
692 return; 695 return;
693 696
694 ScopedCanvas scoped_canvas(NULL); 697 ScopedCanvas scoped_canvas(NULL);
695 scoped_ptr<gfx::Canvas> layer_canvas; 698 scoped_ptr<gfx::Canvas> layer_canvas;
696 gfx::Rect layer_rect; 699 gfx::Rect layer_rect;
697 700
698 if (layer()) { 701 if (layer()) {
699 gfx::Rect dirty_rect; 702 gfx::Rect dirty_rect;
700 if (!layer_helper_->clip_rect().IsEmpty()) { 703 if (!layer_helper_->clip_rect().IsEmpty()) {
701 dirty_rect = layer_helper_->clip_rect(); 704 dirty_rect = layer_helper_->clip_rect();
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 if (layer()) { 1164 if (layer()) {
1162 OnWillCompositeLayer(); 1165 OnWillCompositeLayer();
1163 layer()->Draw(); 1166 layer()->Draw();
1164 } 1167 }
1165 1168
1166 for (int i = 0, count = child_count(); i < count; ++i) 1169 for (int i = 0, count = child_count(); i < count; ++i)
1167 child_at(i)->PaintComposite(); 1170 child_at(i)->PaintComposite();
1168 } 1171 }
1169 1172
1170 void View::SchedulePaintInternal(const gfx::Rect& rect) { 1173 void View::SchedulePaintInternal(const gfx::Rect& rect) {
1171 if (parent_ && parent_->IsVisible()) { 1174 if (parent_ && parent_->IsVisible() && painting_enabled_) {
1172 // Translate the requested paint rect to the parent's coordinate system 1175 // Translate the requested paint rect to the parent's coordinate system
1173 // then pass this notification up to the parent. 1176 // then pass this notification up to the parent.
1174 parent_->SchedulePaintInternal(ConvertRectToParent(rect)); 1177 parent_->SchedulePaintInternal(ConvertRectToParent(rect));
1175 } 1178 }
1176 } 1179 }
1177 1180
1178 void View::PaintToLayer(const gfx::Rect& dirty_region) { 1181 void View::PaintToLayer(const gfx::Rect& dirty_region) {
1179 if (!IsVisible()) 1182 if (!IsVisible())
1180 return; 1183 return;
1181 1184
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 result.append(child_at(i)->PrintViewGraph(false)); 2066 result.append(child_at(i)->PrintViewGraph(false));
2064 2067
2065 if (first) 2068 if (first)
2066 result.append("}\n"); 2069 result.append("}\n");
2067 2070
2068 return result; 2071 return result;
2069 } 2072 }
2070 #endif 2073 #endif
2071 2074
2072 } // namespace views 2075 } // namespace views
OLDNEW
« no previous file with comments | « views/view.h ('k') | views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698