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

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

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: Update tests Created 3 years, 5 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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 914
915 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( 915 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList(
916 ContentLayerClient::PaintingControlSetting painting_control) { 916 ContentLayerClient::PaintingControlSetting painting_control) {
917 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); 917 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_);
918 gfx::Rect local_bounds(bounds().size()); 918 gfx::Rect local_bounds(bounds().size());
919 gfx::Rect invalidation( 919 gfx::Rect invalidation(
920 gfx::IntersectRects(paint_region_.bounds(), local_bounds)); 920 gfx::IntersectRects(paint_region_.bounds(), local_bounds));
921 paint_region_.Clear(); 921 paint_region_.Clear();
922 auto display_list = make_scoped_refptr(new cc::DisplayItemList); 922 auto display_list = make_scoped_refptr(new cc::DisplayItemList);
923 if (delegate_) { 923 if (delegate_) {
924 delegate_->OnPaintLayer( 924 delegate_->OnPaintLayer(PaintContext(
925 PaintContext(display_list.get(), device_scale_factor_, invalidation)); 925 display_list.get(), device_scale_factor_,
926 gfx::ScaleToRoundedRect(invalidation, IsPixelCanvasRecordingEnabled()
danakj 2017/07/21 17:29:39 Can this read the value off the compositor instead
malaykeshav 2017/07/21 23:30:17 Done
927 ? device_scale_factor_
928 : 1.f)));
926 } 929 }
927 display_list->Finalize(); 930 display_list->Finalize();
928 // TODO(domlaskowski): Move mirror invalidation to Layer::SchedulePaint. 931 // TODO(domlaskowski): Move mirror invalidation to Layer::SchedulePaint.
929 for (const auto& mirror : mirrors_) 932 for (const auto& mirror : mirrors_)
930 mirror->dest()->SchedulePaint(invalidation); 933 mirror->dest()->SchedulePaint(invalidation);
931 return display_list; 934 return display_list;
932 } 935 }
933 936
934 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; } 937 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; }
935 938
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), 1245 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(),
1243 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { 1246 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) {
1244 return mirror_ptr.get() == mirror; 1247 return mirror_ptr.get() == mirror;
1245 }); 1248 });
1246 1249
1247 DCHECK(it != mirrors_.end()); 1250 DCHECK(it != mirrors_.end());
1248 mirrors_.erase(it); 1251 mirrors_.erase(it);
1249 } 1252 }
1250 1253
1251 } // namespace ui 1254 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698