OLD | NEW |
---|---|
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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
927 | 927 |
928 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( | 928 scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList( |
929 ContentLayerClient::PaintingControlSetting painting_control) { | 929 ContentLayerClient::PaintingControlSetting painting_control) { |
930 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); | 930 TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_); |
931 gfx::Rect local_bounds(bounds().size()); | 931 gfx::Rect local_bounds(bounds().size()); |
932 gfx::Rect invalidation( | 932 gfx::Rect invalidation( |
933 gfx::IntersectRects(paint_region_.bounds(), local_bounds)); | 933 gfx::IntersectRects(paint_region_.bounds(), local_bounds)); |
934 paint_region_.Clear(); | 934 paint_region_.Clear(); |
935 auto display_list = make_scoped_refptr(new cc::DisplayItemList); | 935 auto display_list = make_scoped_refptr(new cc::DisplayItemList); |
936 if (delegate_) { | 936 if (delegate_) { |
937 delegate_->OnPaintLayer( | 937 bool is_pixel_canvas = GetCompositor() ? GetCompositor()->is_pixel_canvas() |
danakj
2017/07/25 17:58:56
A layer can't paint without being part of a compos
malaykeshav
2017/07/25 22:57:57
yes, but it does not work for layers set as mask.
| |
938 PaintContext(display_list.get(), device_scale_factor_, invalidation)); | 938 : IsPixelCanvasRecordingEnabled(); |
939 delegate_->OnPaintLayer(PaintContext(display_list.get(), | |
940 device_scale_factor_, invalidation, | |
941 is_pixel_canvas)); | |
939 } | 942 } |
940 display_list->Finalize(); | 943 display_list->Finalize(); |
941 // TODO(domlaskowski): Move mirror invalidation to Layer::SchedulePaint. | 944 // TODO(domlaskowski): Move mirror invalidation to Layer::SchedulePaint. |
942 for (const auto& mirror : mirrors_) | 945 for (const auto& mirror : mirrors_) |
943 mirror->dest()->SchedulePaint(invalidation); | 946 mirror->dest()->SchedulePaint(invalidation); |
944 return display_list; | 947 return display_list; |
945 } | 948 } |
946 | 949 |
947 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; } | 950 bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; } |
948 | 951 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1255 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), | 1258 const auto it = std::find_if(mirrors_.begin(), mirrors_.end(), |
1256 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { | 1259 [mirror](const std::unique_ptr<LayerMirror>& mirror_ptr) { |
1257 return mirror_ptr.get() == mirror; | 1260 return mirror_ptr.get() == mirror; |
1258 }); | 1261 }); |
1259 | 1262 |
1260 DCHECK(it != mirrors_.end()); | 1263 DCHECK(it != mirrors_.end()); |
1261 mirrors_.erase(it); | 1264 mirrors_.erase(it); |
1262 } | 1265 } |
1263 | 1266 |
1264 } // namespace ui | 1267 } // namespace ui |
OLD | NEW |