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

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

Issue 1124223010: ui: Eliminate allocating gfx::Canvas on the heap for every view. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/compositor/paint_recorder.h » ('j') | ui/compositor/paint_recorder.cc » ('J')
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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 void Layer::RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) { 740 void Layer::RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) {
741 cc_layer_->RequestCopyOfOutput(request.Pass()); 741 cc_layer_->RequestCopyOfOutput(request.Pass());
742 } 742 }
743 743
744 void Layer::PaintContents( 744 void Layer::PaintContents(
745 SkCanvas* sk_canvas, 745 SkCanvas* sk_canvas,
746 const gfx::Rect& clip, 746 const gfx::Rect& clip,
747 ContentLayerClient::PaintingControlSetting painting_control) { 747 ContentLayerClient::PaintingControlSetting painting_control) {
748 TRACE_EVENT1("ui", "Layer::PaintContents", "name", name_); 748 TRACE_EVENT1("ui", "Layer::PaintContents", "name", name_);
749 ClearDamagedRects(); 749 ClearDamagedRects();
750 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling( 750 if (delegate_) {
751 sk_canvas, device_scale_factor_)); 751 gfx::Canvas canvas(sk_canvas, device_scale_factor_);
752 if (delegate_) 752 delegate_->OnPaintLayer(PaintContext(&canvas, clip));
753 delegate_->OnPaintLayer(PaintContext(canvas.get(), clip)); 753 }
754 } 754 }
755 755
756 void Layer::PaintContentsToDisplayList( 756 void Layer::PaintContentsToDisplayList(
757 cc::DisplayItemList* display_list, 757 cc::DisplayItemList* display_list,
758 const gfx::Rect& clip, 758 const gfx::Rect& clip,
759 ContentLayerClient::PaintingControlSetting painting_control) { 759 ContentLayerClient::PaintingControlSetting painting_control) {
760 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); 760 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_);
761 gfx::Rect local_bounds(bounds().size()); 761 gfx::Rect local_bounds(bounds().size());
762 gfx::Rect invalidation( 762 gfx::Rect invalidation(
763 gfx::IntersectRects(damaged_region_.bounds(), local_bounds)); 763 gfx::IntersectRects(damaged_region_.bounds(), local_bounds));
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 children_.end(), 1093 children_.end(),
1094 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection), 1094 std::bind2nd(std::mem_fun(&Layer::RemoveAnimatorsInTreeFromCollection),
1095 collection)); 1095 collection));
1096 } 1096 }
1097 1097
1098 bool Layer::IsAnimating() const { 1098 bool Layer::IsAnimating() const {
1099 return animator_.get() && animator_->is_animating(); 1099 return animator_.get() && animator_->is_animating();
1100 } 1100 }
1101 1101
1102 } // namespace ui 1102 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/compositor/paint_recorder.h » ('j') | ui/compositor/paint_recorder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698