@@ -73,9 +73,10 @@ sk_sp<DisplayList> DisplayListBuilder::Build() {
7373 nested_bytes_ = nested_op_count_ = 0 ;
7474 storage_.realloc (bytes);
7575 bool compatible = layer_stack_.back ().is_group_opacity_compatible ();
76- return sk_sp<DisplayList>(new DisplayList (std::move (storage_), bytes, count,
77- nested_bytes, nested_count,
78- bounds (), compatible, rtree ()));
76+ bool is_safe = is_ui_thread_safe_;
77+ return sk_sp<DisplayList>(
78+ new DisplayList (std::move (storage_), bytes, count, nested_bytes,
79+ nested_count, bounds (), compatible, is_safe, rtree ()));
7980}
8081
8182DisplayListBuilder::DisplayListBuilder (const SkRect& cull_rect,
@@ -156,6 +157,7 @@ void DisplayListBuilder::onSetColorSource(const DlColorSource* source) {
156157 Push<ClearColorSourceOp>(0 , 0 );
157158 } else {
158159 current_.setColorSource (source->shared ());
160+ is_ui_thread_safe_ = is_ui_thread_safe_ && source->isUIThreadSafe ();
159161 switch (source->type ()) {
160162 case DlColorSourceType::kColor : {
161163 const DlColorColorSource* color_source = source->asColor ();
@@ -923,6 +925,7 @@ void DisplayListBuilder::drawImage(const sk_sp<DlImage> image,
923925 ? Push<DrawImageWithAttrOp>(0 , 1 , image, point, sampling)
924926 : Push<DrawImageOp>(0 , 1 , image, point, sampling);
925927 CheckLayerOpacityCompatibility (render_with_attributes);
928+ is_ui_thread_safe_ = is_ui_thread_safe_ && image->isUIThreadSafe ();
926929 SkRect bounds = SkRect::MakeXYWH (point.fX , point.fY , //
927930 image->width (), image->height ());
928931 DisplayListAttributeFlags flags = render_with_attributes //
@@ -951,6 +954,7 @@ void DisplayListBuilder::drawImageRect(const sk_sp<DlImage> image,
951954 Push<DrawImageRectOp>(0 , 1 , image, src, dst, sampling, render_with_attributes,
952955 constraint);
953956 CheckLayerOpacityCompatibility (render_with_attributes);
957+ is_ui_thread_safe_ = is_ui_thread_safe_ && image->isUIThreadSafe ();
954958 DisplayListAttributeFlags flags = render_with_attributes
955959 ? kDrawImageRectWithPaintFlags
956960 : kDrawImageRectFlags ;
@@ -979,6 +983,7 @@ void DisplayListBuilder::drawImageNine(const sk_sp<DlImage> image,
979983 ? Push<DrawImageNineWithAttrOp>(0 , 1 , image, center, dst, filter)
980984 : Push<DrawImageNineOp>(0 , 1 , image, center, dst, filter);
981985 CheckLayerOpacityCompatibility (render_with_attributes);
986+ is_ui_thread_safe_ = is_ui_thread_safe_ && image->isUIThreadSafe ();
982987 DisplayListAttributeFlags flags = render_with_attributes
983988 ? kDrawImageNineWithPaintFlags
984989 : kDrawImageNineFlags ;
@@ -1034,6 +1039,7 @@ void DisplayListBuilder::drawAtlas(const sk_sp<DlImage> atlas,
10341039 // on it to distribute the opacity without overlap without checking all
10351040 // of the transforms and texture rectangles.
10361041 UpdateLayerOpacityCompatibility (false );
1042+ is_ui_thread_safe_ = is_ui_thread_safe_ && atlas->isUIThreadSafe ();
10371043
10381044 SkPoint quad[4 ];
10391045 RectBoundsAccumulator atlasBounds;
@@ -1075,6 +1081,7 @@ void DisplayListBuilder::DrawDisplayList(const sk_sp<DisplayList> display_list,
10751081 SkScalar opacity) {
10761082 DlPaint current_paint = current_;
10771083 Push<DrawDisplayListOp>(0 , 1 , display_list, opacity);
1084+ is_ui_thread_safe_ = is_ui_thread_safe_ && display_list->isUIThreadSafe ();
10781085 // Not really necessary if the developer is interacting with us via
10791086 // our attribute-state-less DlCanvas methods, but this avoids surprises
10801087 // for those who may have been using the stateful Dispatcher methods.
0 commit comments