summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-20 20:28:41 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-20 20:28:41 +0000
commited495fc6183037582e4aa339459eee0a12ddd453 (patch)
tree019bbe9a5a045d59e9d5afd7f858cb63ae1d3a21 /views
parent06d83ded08609dc5552ddfbccda7ff839f3d97bf (diff)
downloadchromium_src-ed495fc6183037582e4aa339459eee0a12ddd453.zip
chromium_src-ed495fc6183037582e4aa339459eee0a12ddd453.tar.gz
chromium_src-ed495fc6183037582e4aa339459eee0a12ddd453.tar.bz2
Two tweaks for accelerated painting:
. Make sure if there is no texture and we're told to paint, we paint to the whole texture (see comment for details on why we need to do this). . When the transform changes only schedule paint on the widget. By doing this we won't trigger updating the texture, only having the compositor redraw everything. This currently doesn't matter, but will once James lands his changes to SchedulePaint to keep a dirty bit. BUG=none TEST=none R=ben@chromium.org,wjmaclean@chromium.org Review URL: http://codereview.chromium.org/7056013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/view.cc34
1 files changed, 29 insertions, 5 deletions
diff --git a/views/view.cc b/views/view.cc
index 392ca08..cf6a790 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) {