Avoid drawing hidden text in DocView:draw_line_text (#1298)
* Stop drawing text past the `DocView` edge in `DocView:draw_line_text` * Don't add draw commands if they fall outside the latest clip The check was previously done with the window rect, so this will reduce a bit more the number of commands sent.
This commit is contained in:
@@ -422,6 +422,7 @@ function DocView:draw_line_text(line, x, y)
|
||||
-- do not render newline, fixes issue #1164
|
||||
if tidx == last_token then text = text:sub(1, -2) end
|
||||
tx = renderer.draw_text(font, text, tx, ty, color)
|
||||
if tx > self.position.x + self.size.x then break end
|
||||
end
|
||||
return self:get_line_height()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user