mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-08 03:19:49 +00:00
revert an optimization (croping indices image before display)
This commit is contained in:
parent
f052902268
commit
cb1c390fdf
|
@ -164,7 +164,8 @@ func set_pixelv_custom(point: Vector2i, color: Color, index_image_only := false)
|
||||||
if dist < smaller_distance:
|
if dist < smaller_distance:
|
||||||
smaller_distance = dist
|
smaller_distance = dist
|
||||||
color_index = i
|
color_index = i
|
||||||
indices_image.set_pixelv(point, Color((color_index + 1) / 255.0, 0, 0, 0))
|
if not indices_image.get_pixelv(point).r8 == color_index + 1:
|
||||||
|
indices_image.set_pixelv(point, Color((color_index + 1) / 255.0, 0, 0, 0))
|
||||||
color_to_fill = palette[color_index]
|
color_to_fill = palette[color_index]
|
||||||
new_color = color_to_fill
|
new_color = color_to_fill
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -23,23 +23,18 @@ func _draw() -> void:
|
||||||
if zoom_percentage < Global.pixel_grid_show_at_zoom:
|
if zoom_percentage < Global.pixel_grid_show_at_zoom:
|
||||||
return
|
return
|
||||||
var project = ExtensionsApi.project.current_project
|
var project = ExtensionsApi.project.current_project
|
||||||
|
var size: Vector2i = project.size
|
||||||
var cel: BaseCel = project.frames[project.current_frame].cels[project.current_layer]
|
var cel: BaseCel = project.frames[project.current_frame].cels[project.current_layer]
|
||||||
if not cel is PixelCel:
|
if not cel is PixelCel:
|
||||||
return
|
return
|
||||||
var index_image: Image = cel.image.indices_image
|
var index_image: Image = cel.image.indices_image
|
||||||
if index_image.get_size() != project.size or not cel.image.is_indexed:
|
if index_image.get_size() != size or not cel.image.is_indexed:
|
||||||
return
|
return
|
||||||
|
|
||||||
var used_rect: Rect2i = cel.image.get_used_rect()
|
|
||||||
if used_rect.size != Vector2i.ZERO:
|
|
||||||
# use smaller image for optimization
|
|
||||||
index_image = index_image.get_region(used_rect)
|
|
||||||
|
|
||||||
var font: Font = ExtensionsApi.theme.get_theme().default_font
|
var font: Font = ExtensionsApi.theme.get_theme().default_font
|
||||||
var offset = position + Vector2(used_rect.position)
|
draw_set_transform(position, rotation, Vector2(0.05, 0.05))
|
||||||
draw_set_transform(offset, rotation, Vector2(0.05, 0.05))
|
for x in range(size.x):
|
||||||
for x in range(index_image.get_size().x):
|
for y in range(size.y):
|
||||||
for y in range(index_image.get_size().y):
|
|
||||||
var index := index_image.get_pixel(x, y).r8
|
var index := index_image.get_pixel(x, y).r8
|
||||||
if index == 0:
|
if index == 0:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue