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

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

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: nits Created 3 years, 6 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 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 912
913 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( 913 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList(
914 ContentLayerClient::PaintingControlSetting painting_control) { 914 ContentLayerClient::PaintingControlSetting painting_control) {
915 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); 915 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_);
916 gfx::Rect local_bounds(bounds().size()); 916 gfx::Rect local_bounds(bounds().size());
917 gfx::Rect invalidation( 917 gfx::Rect invalidation(
918 gfx::IntersectRects(paint_region_.bounds(), local_bounds)); 918 gfx::IntersectRects(paint_region_.bounds(), local_bounds));
919 paint_region_.Clear(); 919 paint_region_.Clear();
920 auto display_list = make_scoped_refptr(new cc::DisplayItemList); 920 auto display_list = make_scoped_refptr(new cc::DisplayItemList);
921 if (delegate_) { 921 if (delegate_) {
922 delegate_->OnPaintLayer( 922 display_list->set_pixel_canvas_enabled(ui::IsPixelCanvasRecordingEnabled());
923 PaintContext(display_list.get(), device_scale_factor_, invalidation)); 923 PaintContext context(display_list.get(), device_scale_factor_, invalidation,
924 size());
925 delegate_->OnPaintLayer(context);
924 } 926 }
925 display_list->Finalize(); 927 display_list->Finalize();
926 // TODO(domlaskowski): Move mirror invalidation to Layer::SchedulePaint. 928 // TODO(domlaskowski): Move mirror invalidation to Layer::SchedulePaint.
927 for (const auto& mirror : mirrors_) 929 for (const auto& mirror : mirrors_)
928 mirror->dest()->SchedulePaint(invalidation); 930 mirror->dest()->SchedulePaint(invalidation);
929 return display_list; 931 return display_list;
930 } 932 }
931 933
932 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; } 934 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; }
933 935
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), 1242 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(),
1241 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { 1243 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) {
1242 return mirror_ptr.get() == mirror; 1244 return mirror_ptr.get() == mirror;
1243 }); 1245 });
1244 1246
1245 DCHECK(it != mirrors_.end()); 1247 DCHECK(it != mirrors_.end());
1246 mirrors_.erase(it); 1248 mirrors_.erase(it);
1247 } 1249 }
1248 1250
1249 } // namespace ui 1251 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698