@ -2557,16 +2557,15 @@ void RendererCanvasRenderRD::_record_item_commands(const Item *p_item, RenderTar
|
|||||||
Rect2 src_rect;
|
Rect2 src_rect;
|
||||||
Rect2 dst_rect(np->rect.position.x, np->rect.position.y, np->rect.size.x, np->rect.size.y);
|
Rect2 dst_rect(np->rect.position.x, np->rect.position.y, np->rect.size.x, np->rect.size.y);
|
||||||
|
|
||||||
if (np->texture.is_null()) {
|
if (np->texture.is_valid() && np->source != Rect2()) {
|
||||||
src_rect = Rect2(0, 0, 1, 1);
|
src_rect = Rect2(np->source.position.x * tex_info->texpixel_size.width, np->source.position.y * tex_info->texpixel_size.height, np->source.size.x * tex_info->texpixel_size.width, np->source.size.y * tex_info->texpixel_size.height);
|
||||||
|
instance_data->ninepatch_pixel_size[0] = 1.0 / np->source.size.width;
|
||||||
|
instance_data->ninepatch_pixel_size[1] = 1.0 / np->source.size.height;
|
||||||
} else {
|
} else {
|
||||||
if (np->source != Rect2()) {
|
src_rect = Rect2(0, 0, 1, 1);
|
||||||
src_rect = Rect2(np->source.position.x * tex_info->texpixel_size.width, np->source.position.y * tex_info->texpixel_size.height, np->source.size.x * tex_info->texpixel_size.width, np->source.size.y * tex_info->texpixel_size.height);
|
// Set the default ninepatch pixel size to the full texture size.
|
||||||
instance_data->ninepatch_pixel_size[0] = 1.0 / np->source.size.width;
|
instance_data->ninepatch_pixel_size[0] = tex_info->texpixel_size.width;
|
||||||
instance_data->ninepatch_pixel_size[1] = 1.0 / np->source.size.height;
|
instance_data->ninepatch_pixel_size[1] = tex_info->texpixel_size.height;
|
||||||
} else {
|
|
||||||
src_rect = Rect2(0, 0, 1, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Color modulated = np->color * base_color;
|
Color modulated = np->color * base_color;
|
||||||
|
|||||||
Reference in New Issue
Block a user