@@ -1262,20 +1262,24 @@ pub const Element = struct {
12621262 dest .y += dest .height ;
12631263 dest .height = 0 - dest .height ;
12641264 }
1265- var corner : f32 = element .background .corner_radius ;
1266- if (corner * 2 > dest .height ) corner = dest .height / 2 ;
12671265 element .apply_background_tint (display , texture .texture );
1268- _ = sdl .SDL_RenderTexture9Grid (
1269- display .renderer ,
1270- texture .texture ,
1271- null ,
1272- element .background .image_corner_radius ,
1273- element .background .image_corner_radius ,
1274- element .background .image_corner_radius ,
1275- element .background .image_corner_radius ,
1276- corner / element .background .image_corner_radius ,
1277- @ptrCast (& dest ),
1278- );
1266+ if (element .background .image_corner_radius == 0 ) {
1267+ _ = sdl .SDL_RenderTexture (display .renderer , texture .texture , null , @ptrCast (& dest ));
1268+ } else {
1269+ var corner : f32 = element .background .corner_radius ;
1270+ if (corner * 2 > dest .height ) corner = dest .height / 2 ;
1271+ _ = sdl .SDL_RenderTexture9Grid (
1272+ display .renderer ,
1273+ texture .texture ,
1274+ null ,
1275+ element .background .image_corner_radius ,
1276+ element .background .image_corner_radius ,
1277+ element .background .image_corner_radius ,
1278+ element .background .image_corner_radius ,
1279+ corner / element .background .image_corner_radius ,
1280+ @ptrCast (& dest ),
1281+ );
1282+ }
12791283 }
12801284 } else if (element .background .colour .a > 0 and element .type != .rectangle and element .type != .sprite ) {
12811285 // If there is no background image, but there is a background
@@ -1602,24 +1606,11 @@ pub const Element = struct {
16021606 _ = sdl .SDL_SetTextureColorMod (texture .texture , tint .r , tint .g , tint .b );
16031607 var corner : f32 = element .background .corner_radius ;
16041608 if (corner * 2 > dest .height ) corner = dest .height / 2 ;
1605- _ = sdl .SDL_RenderTexture9Grid (
1606- display .renderer ,
1607- texture .texture ,
1608- null ,
1609- element .background .image_corner_radius ,
1610- element .background .image_corner_radius ,
1611- element .background .image_corner_radius ,
1612- element .background .image_corner_radius ,
1613- corner / element .background .image_corner_radius ,
1614- @ptrCast (& dest ),
1615- );
16161609
1617- if (element .type .progress_bar .progress > 0.01 ) {
1618- // Progress bar foreground
1619- dest .width *= element .type .progress_bar .progress ;
1620- tint = display .theme .placeholder_text_colour ;
1621- //tint = display.theme.placeholder_text_colour;
1622- _ = sdl .SDL_SetTextureColorMod (texture .texture , tint .r , tint .g , tint .b );
1610+ // Progress bar background
1611+ if (element .background .image_corner_radius == 0 ) {
1612+ _ = sdl .SDL_RenderTexture (display .renderer , texture .texture , null , @ptrCast (& dest ));
1613+ } else {
16231614 _ = sdl .SDL_RenderTexture9Grid (
16241615 display .renderer ,
16251616 texture .texture ,
@@ -1632,6 +1623,28 @@ pub const Element = struct {
16321623 @ptrCast (& dest ),
16331624 );
16341625 }
1626+
1627+ // Progress bar foreground
1628+ if (element .type .progress_bar .progress > 0.01 ) {
1629+ dest .width *= element .type .progress_bar .progress ;
1630+ tint = display .theme .placeholder_text_colour ;
1631+ _ = sdl .SDL_SetTextureColorMod (texture .texture , tint .r , tint .g , tint .b );
1632+ if (element .background .image_corner_radius == 0 ) {
1633+ _ = sdl .SDL_RenderTexture (display .renderer , texture .texture , null , @ptrCast (& dest ));
1634+ } else {
1635+ _ = sdl .SDL_RenderTexture9Grid (
1636+ display .renderer ,
1637+ texture .texture ,
1638+ null ,
1639+ element .background .image_corner_radius ,
1640+ element .background .image_corner_radius ,
1641+ element .background .image_corner_radius ,
1642+ element .background .image_corner_radius ,
1643+ corner / element .background .image_corner_radius ,
1644+ @ptrCast (& dest ),
1645+ );
1646+ }
1647+ }
16351648 } else {
16361649 err ("progress bar image missing." , .{});
16371650 }
@@ -1654,21 +1667,24 @@ pub const Element = struct {
16541667 dest .y += dest .height ;
16551668 dest .height = 0 - dest .height ;
16561669 }
1657- var corner : f32 = element .background .corner_radius ;
1658- if (corner * 2 > dest .height ) corner = dest .height / 2 ;
1659- element .apply_background_tint (display , background_image );
1660- _ = sdl .SDL_RenderTexture9Grid (
1661- display .renderer ,
1662- background_image ,
1663- null ,
1664- element .background .image_corner_radius ,
1665- element .background .image_corner_radius ,
1666- element .background .image_corner_radius ,
1667- element .background .image_corner_radius ,
1668- corner / element .background .image_corner_radius ,
1669- @ptrCast (& dest ),
1670- );
1671- _ = sdl .SDL_RenderTexture (display .renderer , background_image , null , @ptrCast (& dest ));
1670+ if (element .background .image_corner_radius == 0 ) {
1671+ _ = sdl .SDL_RenderTexture (display .renderer , background_image , null , @ptrCast (& dest ));
1672+ } else {
1673+ var corner : f32 = element .background .corner_radius ;
1674+ if (corner * 2 > dest .height ) corner = dest .height / 2 ;
1675+ element .apply_background_tint (display , background_image );
1676+ _ = sdl .SDL_RenderTexture9Grid (
1677+ display .renderer ,
1678+ background_image ,
1679+ null ,
1680+ element .background .image_corner_radius ,
1681+ element .background .image_corner_radius ,
1682+ element .background .image_corner_radius ,
1683+ element .background .image_corner_radius ,
1684+ corner / element .background .image_corner_radius ,
1685+ @ptrCast (& dest ),
1686+ );
1687+ }
16721688 }
16731689
16741690 // The inner content can contain a button and/or text texture.
0 commit comments