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

Unified Diff: views/view.cc

Issue 7273073: Animated Rotation (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Use new minimal sensor API Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« views/view.h ('K') | « views/view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/view.cc
diff --git a/views/view.cc b/views/view.cc
index eae96663c9abd51f2db3eaedd6d4cea5448a5251..81b5c893102a9d3445f22b5ffc8345759b0d39b7 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
@@ -115,6 +116,7 @@ View::View()
previous_focusable_view_(NULL),
focusable_(false),
accessibility_focusable_(false),
+ painting_enabled_(true),
context_menu_controller_(NULL),
drag_controller_(NULL) {
}
@@ -420,6 +422,14 @@ void View::OnEnabledChanged() {
SchedulePaint();
}
+void View::SetPaintingEnabled(bool enabled) {
+ painting_enabled_ = enabled;
+}
+
+bool View::IsPaintingEnabled() const {
+ return painting_enabled_;
+}
+
// Transformations -------------------------------------------------------------
const ui::Transform& View::GetTransform() const {
@@ -440,11 +450,6 @@ void View::SetTransform(const ui::Transform& transform) {
SchedulePaint();
} else {
- // Make sure if the view didn't have its own texture and was painting onto
- // something else, that gets refreshed too.
- if (!ShouldPaintToLayer())
- MarkLayerDirty();
-
if (!layer_helper_.get())
layer_helper_.reset(new internal::LayerHelper());
layer_helper_->SetTransform(transform);
@@ -453,15 +458,7 @@ void View::SetTransform(const ui::Transform& transform) {
SchedulePaint();
} else {
layer_helper_->property_setter()->SetTransform(layer(), transform);
- // We have a layer. When the transform changes and the layer is up to
- // date we don't want to SchedulePaint as it'll trigger painting to the
- // layer. Instead we tell the Widget to paint, which makes the
- // compositor draw using the existing layer.
- // We schedule paint the complete bounds as compositor generally don't
- // support partial painting.
- Widget* widget = GetWidget();
- if (widget)
- widget->SchedulePaintInRect(widget->GetRootView()->bounds());
+ ScheduleComposite();
}
}
}
@@ -527,6 +524,7 @@ int View::GetMirroredXWithWidthInView(int x, int w) const {
// Layout ----------------------------------------------------------------------
void View::Layout() {
+ TRACE_EVENT0("View", "Layout");
needs_layout_ = false;
// If we have a layout manager, let it handle the layout for us.
@@ -695,8 +693,20 @@ void View::SchedulePaintInRect(const gfx::Rect& rect) {
SchedulePaintInternal(rect);
}
+void View::ScheduleComposite() {
+ ScheduleCompositeInRect(GetLocalBounds());
+}
+
+void View::ScheduleCompositeInRect(const gfx::Rect& rect) {
+ if (!IsVisible())
+ return;
+
+ SchedulePaintInternal(rect);
+}
+
void View::Paint(gfx::Canvas* canvas) {
- if (!IsVisible())
+ TRACE_EVENT0("View", "Paint");
+ if (!IsVisible() || !IsPaintingEnabled())
return;
ScopedCanvas scoped_canvas(NULL);
@@ -1171,6 +1181,7 @@ void View::OnPaintFocusBorder(gfx::Canvas* canvas) {
// Accelerated Painting --------------------------------------------------------
void View::PaintComposite() {
+ TRACE_EVENT0("View", "PaintComposite");
if (!IsVisible())
return;
« views/view.h ('K') | « views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698