Skip to content

[lua] Fix Image:drawSprite() call when we're in the middle of a ToolLoop (part of #3916)#5546

Merged
dacap merged 1 commit into
aseprite:betafrom
dacap:fix-image-drawsprite
Nov 19, 2025
Merged

[lua] Fix Image:drawSprite() call when we're in the middle of a ToolLoop (part of #3916)#5546
dacap merged 1 commit into
aseprite:betafrom
dacap:fix-image-drawsprite

Conversation

@dacap

@dacap dacap commented Nov 19, 2025

Copy link
Copy Markdown
Member

Fix part of #3916, allowing using Image:drawSprite() correctly if we are in the middle of a ToolLoop.

Script to test:

local dlg
local timer = Timer{ interval=0.25, ontick=function() dlg:repaint() end }
dlg = Dialog { title="Paint every 1/4 sec", onclose=function() timer:stop() end }

local function paintCanvas(ev)
  local spr = app.sprite
  if not spr then return end
  local gc = ev.context
  local img = Image(spr.width, spr.height)
  img:drawSprite(spr, app.frame, 0, 0)
  gc:drawImage(img, img.bounds, Rectangle(0, 0, gc.width, gc.height))
end

dlg:canvas { id="canvas", width=128, height=128, onpaint=paintCanvas }
dlg:show { wait=false }
timer:start()

@aseprite-bot aseprite-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread src/app/ui/editor/scoped_tool_loop_fix.h Outdated
Comment thread src/app/util/expand_cel_canvas.cpp Outdated
@dacap dacap force-pushed the fix-image-drawsprite branch from 9bee3e8 to 01e1fe0 Compare November 19, 2025 15:35
…oop (part of aseprite#3916)

This doesn't fix the cel.position property, but it fixes the
Image:drawSprite() call when we're in the middle of a
DrawingState/ToolLoop.
@dacap dacap force-pushed the fix-image-drawsprite branch from 01e1fe0 to 05f2a1e Compare November 19, 2025 15:35
@aseprite-bot

Copy link
Copy Markdown
Collaborator

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
@aseprite-bot

Copy link
Copy Markdown
Collaborator

clang-tidy review says "All clean, LGTM! 👍"

@dacap dacap added this to the v1.3.17-beta1 milestone Nov 19, 2025
@dacap dacap merged commit 05f2a1e into aseprite:beta Nov 19, 2025
12 checks passed
@dacap dacap deleted the fix-image-drawsprite branch November 19, 2025 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants