moved blitting over to blitbuffer API

the framebuffer "object" now has a "member" that exposes the blitbuffer
API for the framebuffer pixmap. This allows to reuse blitting & Co for
blitbuffer-to-blitbuffer operations
This commit is contained in:
HW
2011-12-02 01:31:13 +01:00
parent dfbdad5cbf
commit f739baff5f
8 changed files with 341 additions and 250 deletions

View File

@@ -43,7 +43,7 @@ function clearglyphcache()
glyphcache = {}
end
function renderUtf8Text(x, y, face, facehash, text, kerning)
function renderUtf8Text(buffer, x, y, face, facehash, text, kerning)
-- may still need more adaptive pen placement when kerning,
-- see: http://freetype.org/freetype2/docs/glyphs/glyphs-4.html
local pen_x = 0
@@ -54,9 +54,9 @@ function renderUtf8Text(x, y, face, facehash, text, kerning)
if kerning and prevcharcode then
local kern = face:getKerning(prevcharcode, charcode)
pen_x = pen_x + kern
fb:addblitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
buffer:addblitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
else
fb:blitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
buffer:blitFrom(glyph.bb, x + pen_x + glyph.l, y - glyph.t, 0, 0, glyph.bb:getWidth(), glyph.bb:getHeight())
end
pen_x = pen_x + glyph.ax
prevcharcode = charcode