mirror of
https://github.com/airstruck/luigi.git
synced 2025-12-18 18:06:44 +00:00
Text widget: intersect scissor.
Fixes a visual bug where text would display outside widget boundary. Mved intersectScissor to Backend.
This commit is contained in:
@@ -11,23 +11,6 @@ local Painter = Base:extend()
|
||||
local imageCache = {}
|
||||
-- local sliceCache = {}
|
||||
|
||||
local function intersectScissor (x, y, w, h)
|
||||
local sx, sy, sw, sh = Backend.getScissor()
|
||||
if not sx then
|
||||
return Backend.setScissor(x, y, w, h)
|
||||
end
|
||||
local x1 = math.max(sx, x)
|
||||
local y1 = math.max(sy, y)
|
||||
local x2 = math.min(sx + sw, x + w)
|
||||
local y2 = math.min(sy + sh, y + h)
|
||||
if x2 > x1 and y2 > y1 then
|
||||
Backend.setScissor(x1, y1, x2 - x1, y2 - y1)
|
||||
else
|
||||
-- HACK
|
||||
Backend.setScissor(-100, -100, 1, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function Painter:constructor (widget)
|
||||
self.widget = widget
|
||||
end
|
||||
@@ -198,7 +181,7 @@ function Painter:paintIconAndText ()
|
||||
|
||||
Backend.push()
|
||||
|
||||
intersectScissor(x, y, w, h)
|
||||
Backend.intersectScissor(x, y, w, h)
|
||||
|
||||
-- draw the icon
|
||||
if icon then
|
||||
@@ -237,7 +220,7 @@ function Painter:paint ()
|
||||
Backend.push()
|
||||
|
||||
if widget.parent then
|
||||
intersectScissor(x, y, w, h)
|
||||
Backend.intersectScissor(x, y, w, h)
|
||||
else
|
||||
Backend.setScissor()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user