+ // Only change it if it's a color visual
+ map[ Toolkit::DevelColorVisual::Property::RENDER_IF_TRANSPARENT ] = renderIfTransparent;
+ controlImpl.SetBackground( map );
+ }
+}
+
+/**
+ * @brief Creates a clipping renderer if required.
+ * (EG. If no renders exist and clipping is enabled).
+ * @param[in] controlImpl The control implementation.
+ */
+void CreateClippingRenderer( Control& controlImpl )
+{
+ // We want to add a transparent background if we do not have one for clipping.
+ Actor self( controlImpl.Self() );
+ int clippingMode = ClippingMode::DISABLED;
+ if( self.GetProperty( Actor::Property::CLIPPING_MODE ).Get( clippingMode ) )
+ {
+ switch( clippingMode )
+ {
+ case ClippingMode::CLIP_CHILDREN:
+ {
+ if( self.GetRendererCount() == 0u )
+ {
+ Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlImpl );
+ if( controlDataImpl.mVisuals.Empty() )
+ {
+ controlImpl.SetBackgroundColor( Color::TRANSPARENT );
+ }
+ else
+ {
+ // We have visuals, check if we've set the background and re-create it to
+ // render even if transparent (only if it's a color visual)
+ ChangeBackgroundColorVisual( controlImpl, true );
+ }
+ }
+ break;
+ }
+
+ case ClippingMode::DISABLED:
+ case ClippingMode::CLIP_TO_BOUNDING_BOX:
+ {
+ // If we have a background visual, check if it's a color visual and remove the render if transparent flag
+ ChangeBackgroundColorVisual( controlImpl, false );
+ break;
+ }
+ }
+ }
+}
+
+} // unnamed namespace