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

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

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: Update unittests for RasterSource 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(
923 PaintContext(display_list.get(), device_scale_factor_, invalidation)); 923 base::CommandLine::ForCurrentProcess()->HasSwitch(
924 switches::kEnablePixelCanvasRecording));
oshima 2017/06/15 22:59:12 can you initialize once instead of querying everyt
malaykeshav 2017/06/16 20:41:57 Done
925 PaintContext context(display_list.get(), device_scale_factor_, invalidation,
926 size());
927 delegate_->OnPaintLayer(context);
924 } 928 }
925 display_list->Finalize(); 929 display_list->Finalize();
926 // TODO(domlaskowski): Move mirror invalidation to Layer::SchedulePaint. 930 // TODO(domlaskowski): Move mirror invalidation to Layer::SchedulePaint.
927 for (const auto& mirror : mirrors_) 931 for (const auto& mirror : mirrors_)
928 mirror->dest()->SchedulePaint(invalidation); 932 mirror->dest()->SchedulePaint(invalidation);
929 return display_list; 933 return display_list;
930 } 934 }
931 935
932 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; } 936 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; }
933 937
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), 1244 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(),
1241 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { 1245 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) {
1242 return mirror_ptr.get() == mirror; 1246 return mirror_ptr.get() == mirror;
1243 }); 1247 });
1244 1248
1245 DCHECK(it != mirrors_.end()); 1249 DCHECK(it != mirrors_.end());
1246 mirrors_.erase(it); 1250 mirrors_.erase(it);
1247 } 1251 }
1248 1252
1249 } // namespace ui 1253 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698