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

Unified Diff: views/view.cc

Issue 7056013: Two tweaks for accelerated painting: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: #ifdef Created 9 years, 7 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
« no previous file with comments | « no previous file | 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 392ca08337deb01e025c14d5e9a9ab472fb04af0..cf6a790e9068209cd4491adf80cd0eb2108fe9ae 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -413,8 +413,22 @@ void View::SetTransform(const ui::Transform& transform) {
SchedulePaint();
} else {
transform_.reset(new ui::Transform(transform));
- // TODO: this needs to trigger a paint on the widget. It shouldn't use
- // SchedulePaint as we don't want to mark the views dirty.
+#if defined(COMPOSITOR_2)
+ if (!texture_.get()) {
+ // We don't yet have a texture. SchedulePaint so one is created.
+ SchedulePaint();
+ } else {
+ // We have a texture. When the transform changes and the texture is up to
+ // date we don't want to SchedulePaint as it'll trigger painting to the
+ // texture. Instead we tell the Widget to paint, which makes the
+ // compositor draw using the existing texture.
+ // We schedule paint the complete bounds as compositor generally don't
+ // support partial painting.
+ Widget* widget = GetWidget();
+ if (widget)
+ widget->SchedulePaintInRect(widget->GetRootView()->bounds());
+ }
+#endif
}
}
@@ -1169,9 +1183,19 @@ void View::PaintToTexture(const gfx::Rect& dirty_region) {
return;
if (ShouldPaintToTexture() && texture_needs_updating_) {
- texture_clip_rect_ = dirty_region;
- Paint(NULL);
- texture_clip_rect_.SetRect(0, 0, 0, 0);
+ if (!texture_.get()) {
+ // If we have no texture paint the whole view. We do this to handle two
+ // cases:
+ // . Workaround for WidgetWin/WindowWin. In particular its possible to
+ // create the rootview at the non-client size, even though we'll never
+ // paint at that size.
+ // . In case the texture is recreated and a partial paint was scheduled.
+ Paint(NULL);
+ } else {
+ texture_clip_rect_ = dirty_region;
+ Paint(NULL);
+ texture_clip_rect_.SetRect(0, 0, 0, 0);
+ }
} else {
// Forward to all children as a descendant may be dirty and have a texture.
for (int i = child_count() - 1; i >= 0; --i) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698