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

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
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 invalidation =
754 gfx::IntersectRects(damaged_region_.bounds(), bounds());
sky 2015/04/23 16:29:00 Isn't bounds() in the parent coordinate space and
danakj 2015/04/23 16:34:09 Ah, yes, thanks. I wish they said so in their name
755 DCHECK(clip.Contains(invalidation));
753 ClearDamagedRects(); 756 ClearDamagedRects();
754 if (!delegate_) 757 if (!delegate_)
755 return; 758 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( 759 delegate_->OnPaintLayer(
762 PaintContext(display_list, device_scale_factor_, clip, invalidation)); 760 PaintContext(display_list, device_scale_factor_, clip, invalidation));
763 } 761 }
764 762
765 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; } 763 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; }
766 764
767 bool Layer::PrepareTextureMailbox( 765 bool Layer::PrepareTextureMailbox(
768 cc::TextureMailbox* mailbox, 766 cc::TextureMailbox* mailbox,
769 scoped_ptr<cc::SingleReleaseCallback>* release_callback, 767 scoped_ptr<cc::SingleReleaseCallback>* release_callback,
770 bool use_shared_memory) { 768 bool use_shared_memory) {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 children_.end(), 1084 children_.end(),
1087 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), 1085 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection),
1088 collection)); 1086 collection));
1089 } 1087 }
1090 1088
1091 bool Layer::IsAnimating() const { 1089 bool Layer::IsAnimating() const {
1092 return animator_.get() && animator_->is_animating(); 1090 return animator_.get() && animator_->is_animating();
1093 } 1091 }
1094 1092
1095 } // namespace ui 1093 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698