Slava Pestov 2008-05-29 03:17:36 -05:00
parent 41c845cf73
commit 21fcc8a542
1 changed files with 6 additions and 7 deletions

View File

@ -134,24 +134,23 @@ M: freetype-renderer string-height ( open-font string -- h )
FT_RENDER_MODE_NORMAL FT_Render_Glyph freetype-error ; FT_RENDER_MODE_NORMAL FT_Render_Glyph freetype-error ;
:: copy-pixel ( i j bitmap texture -- i j ) :: copy-pixel ( i j bitmap texture -- i j )
255 tex j set-alien-unsigned-1 255 j texture set-char-nth
i bitmap alien-unsigned-1 j 1 + texture set-alien-unsigned-1 i bitmap char-nth j 1 + texture set-char-nth
i 1 + j 2 + ; inline i 1 + j 2 + ; inline
: (copy-row) ( i j bitmap texture end -- ) :: (copy-row) ( i j bitmap texture end -- )
i end < [ i end < [
i j bitmap texture copy-pixel i j bitmap texture copy-pixel
i j bitmap texture end (copy-row) bitmap texture end (copy-row)
] when ; inline ] when ; inline
: copy-row ( i j bitmap texture width width2 -- i j ) :: copy-row ( i j bitmap texture width width2 -- i j )
i j bitmap texture i width + (copy-row) i j bitmap texture i width + (copy-row)
i width + i width +
j width2 + ; inline j width2 + ; inline
:: copy-bitmap ( glyph texture -- ) :: copy-bitmap ( glyph texture -- )
[let* | texture [ texture alien-address ] [let* | bitmap [ glyph glyph-bitmap-buffer ]
bitmap [ glyph glyph-bitmap-buffer alien-address ]
rows [ glyph glyph-bitmap-rows ] rows [ glyph glyph-bitmap-rows ]
width [ glyph glyph-bitmap-width ] width [ glyph glyph-bitmap-width ]
width2 [ width next-power-of-2 2 * ] | width2 [ width next-power-of-2 2 * ] |