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

Side by Side Diff: ui/compositor/layer.cc

Issue 1101783002: ui: Cache the output of View::OnPaint when the View isn't invalid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cache: . Created 5 years, 8 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
« no previous file with comments | « ui/compositor/compositor.gyp ('k') | ui/compositor/paint_cache.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 sk_canvas, device_scale_factor_)); 743 sk_canvas, device_scale_factor_));
744 if (delegate_) 744 if (delegate_)
745 delegate_->OnPaintLayer(PaintContext(canvas.get(), clip)); 745 delegate_->OnPaintLayer(PaintContext(canvas.get(), clip));
746 } 746 }
747 747
748 void Layer::PaintContentsToDisplayList( 748 void Layer::PaintContentsToDisplayList(
749 cc::DisplayItemList* display_list, 749 cc::DisplayItemList* display_list,
750 const gfx::Rect& clip, 750 const gfx::Rect& clip,
751 ContentLayerClient::PaintingControlSetting painting_control) { 751 ContentLayerClient::PaintingControlSetting painting_control) {
752 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); 752 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_);
753 gfx::Rect local_bounds(bounds().size());
754 gfx::Rect invalidation(
755 gfx::IntersectRects(damaged_region_.bounds(), local_bounds));
756 DCHECK(clip.Contains(invalidation));
753 ClearDamagedRects(); 757 ClearDamagedRects();
754 if (!delegate_) 758 if (!delegate_)
755 return; 759 return;
756 // TODO(danakj): Save the invalidation on the layer and pass that down
757 // instead of the |clip| here. That will break everything until View
758 // early-outs emit cached display items instead of nothing.
759 gfx::Rect invalidation = clip;
760 DCHECK(clip.Contains(invalidation));
761 delegate_->OnPaintLayer( 760 delegate_->OnPaintLayer(
762 PaintContext(display_list, device_scale_factor_, clip, invalidation)); 761 PaintContext(display_list, device_scale_factor_, clip, invalidation));
763 } 762 }
764 763
765 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; } 764 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; }
766 765
767 bool Layer::PrepareTextureMailbox( 766 bool Layer::PrepareTextureMailbox(
768 cc::TextureMailbox* mailbox, 767 cc::TextureMailbox* mailbox,
769 scoped_ptr<cc::SingleReleaseCallback>* release_callback, 768 scoped_ptr<cc::SingleReleaseCallback>* release_callback,
770 bool use_shared_memory) { 769 bool use_shared_memory) {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 children_.end(), 1085 children_.end(),
1087 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), 1086 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection),
1088 collection)); 1087 collection));
1089 } 1088 }
1090 1089
1091 bool Layer::IsAnimating() const { 1090 bool Layer::IsAnimating() const {
1092 return animator_.get() && animator_->is_animating(); 1091 return animator_.get() && animator_->is_animating();
1093 } 1092 }
1094 1093
1095 } // namespace ui 1094 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.gyp ('k') | ui/compositor/paint_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698