Skip to content

Commit

Permalink
Merge pull request #1999 from Raltyro/patch-1
Browse files Browse the repository at this point in the history
Fix deprecated love.graphics.stencil function resetting stencilMode
  • Loading branch information
slime73 authored Dec 24, 2023
2 parents cb4cb80 + 1f8e355 commit 8423b82
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/modules/graphics/wrap_Graphics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,16 @@ function graphics.stencil(func, action, value, keepvalues)

if value == nil then value = 1 end

graphics.setStencilMode(action, "always", value)

local action2, mode2, value2, readmask2, writemask2 = graphics.getStencilMode()
local mr, mg, mb, ma = graphics.getColorMask()

graphics.setStencilMode(action, "always", value)
graphics.setColorMask(false)

local success, err = pcall(func)

graphics.setStencilMode(action2, mode2, value2, readmask2, writemask2)
graphics.setColorMask(mr, mg, mb, ma)
graphics.setStencilMode()

if not success then
error(err, 2)
Expand Down

0 comments on commit 8423b82

Please sign in to comment.