1706f2543Smrg 2706f2543Smrg 3706f2543Smrg#ifdef HAVE_XORG_CONFIG_H 4706f2543Smrg#include <xorg-config.h> 5706f2543Smrg#endif 6706f2543Smrg 7706f2543Smrg#include "xaa.h" 8706f2543Smrg#include "xaalocal.h" 9706f2543Smrg#include "xaacexp.h" 10706f2543Smrg#include "xf86.h" 11706f2543Smrg 12706f2543Smrg/* scanline function for TRIPLE_BITS_24BPP */ 13706f2543Smrgstatic CARD32 *DrawTextScanline3(CARD32 *base, CARD32 *mem, int width); 14706f2543Smrg 15706f2543Smrg/* Loop unrolled functions for common font widths */ 16706f2543Smrgstatic CARD32 *DrawTETextScanlineGeneric(CARD32 *base, unsigned int **glyphp, 17706f2543Smrg int line, int width, int glyphwidth); 18706f2543Smrgstatic CARD32 *DrawTETextScanlineWidth7(CARD32 *base, unsigned int **glyphp, 19706f2543Smrg int line, int width, int glyphwidth); 20706f2543Smrgstatic CARD32 *DrawTETextScanlineWidth10(CARD32 *base, unsigned int **glyphp, 21706f2543Smrg int line, int width, int glyphwidth); 22706f2543Smrgstatic CARD32 *DrawTETextScanlineWidth12(CARD32 *base, unsigned int **glyphp, 23706f2543Smrg int line, int width, int glyphwidth); 24706f2543Smrgstatic CARD32 *DrawTETextScanlineWidth14(CARD32 *base, unsigned int **glyphp, 25706f2543Smrg int line, int width, int glyphwidth); 26706f2543Smrgstatic CARD32 *DrawTETextScanlineWidth16(CARD32 *base, unsigned int **glyphp, 27706f2543Smrg int line, int width, int glyphwidth); 28706f2543Smrgstatic CARD32 *DrawTETextScanlineWidth18(CARD32 *base, unsigned int **glyphp, 29706f2543Smrg int line, int width, int glyphwidth); 30706f2543Smrgstatic CARD32 *DrawTETextScanlineWidth24(CARD32 *base, unsigned int **glyphp, 31706f2543Smrg int line, int width, int glyphwidth); 32706f2543Smrg 33706f2543Smrg 34706f2543Smrg#ifdef USEASSEMBLER 35706f2543Smrg# ifdef FIXEDBASE 36706f2543Smrg# ifdef MSBFIRST 37706f2543SmrgCARD32 *DrawTETextScanlineWidth6PMSBFirstFixedBase(CARD32 *base, 38706f2543Smrg unsigned int **glyphp, int line, int width, int glyphwidth); 39706f2543SmrgCARD32 *DrawTETextScanlineWidth8PMSBFirstFixedBase(CARD32 *base, 40706f2543Smrg unsigned int **glyphp, int line, int width, int glyphwidth); 41706f2543SmrgCARD32 *DrawTETextScanlineWidth9PMSBFirstFixedBase(CARD32 *base, 42706f2543Smrg unsigned int **glyphp, int line, int width, int glyphwidth); 43706f2543Smrg# else 44706f2543SmrgCARD32 *DrawTETextScanlineWidth6PLSBFirstFixedBase(CARD32 *base, 45706f2543Smrg unsigned int **glyphp, int line, int width, int glyphwidth); 46706f2543SmrgCARD32 *DrawTETextScanlineWidth8PLSBFirstFixedBase(CARD32 *base, 47706f2543Smrg unsigned int **glyphp, int line, int width, int glyphwidth); 48706f2543SmrgCARD32 *DrawTETextScanlineWidth9PLSBFirstFixedBase(CARD32 *base, 49706f2543Smrg unsigned int **glyphp, int line, int width, int glyphwidth); 50706f2543Smrg# endif 51706f2543Smrg# else 52706f2543Smrg# ifdef MSBFIRST 53706f2543SmrgCARD32 *DrawTETextScanlineWidth6PMSBFirst(CARD32 *base, unsigned int **glyphp, 54706f2543Smrg int line, int width, int glyphwidth); 55706f2543SmrgCARD32 *DrawTETextScanlineWidth8PMSBFirst(CARD32 *base, unsigned int **glyphp, 56706f2543Smrg int line, int width, int glyphwidth); 57706f2543SmrgCARD32 *DrawTETextScanlineWidth9PMSBFirst(CARD32 *base, unsigned int **glyphp, 58706f2543Smrg int line, int width, int glyphwidth); 59706f2543Smrg# else 60706f2543SmrgCARD32 *DrawTETextScanlineWidth6PLSBFirst(CARD32 *base, unsigned int **glyphp, 61706f2543Smrg int line, int width, int glyphwidth); 62706f2543SmrgCARD32 *DrawTETextScanlineWidth8PLSBFirst(CARD32 *base, unsigned int **glyphp, 63706f2543Smrg int line, int width, int glyphwidth); 64706f2543SmrgCARD32 *DrawTETextScanlineWidth9PLSBFirst(CARD32 *base, unsigned int **glyphp, 65706f2543Smrg int line, int width, int glyphwidth); 66706f2543Smrg# endif 67706f2543Smrg# endif 68706f2543Smrg#else 69706f2543Smrgstatic CARD32 *DrawTETextScanlineWidth6(CARD32 *base, unsigned int **glyphp, 70706f2543Smrg int line, int width, int glyphwidth); 71706f2543Smrgstatic CARD32 *DrawTETextScanlineWidth8(CARD32 *base, unsigned int **glyphp, 72706f2543Smrg int line, int width, int glyphwidth); 73706f2543Smrgstatic CARD32 *DrawTETextScanlineWidth9(CARD32 *base, unsigned int **glyphp, 74706f2543Smrg int line, int width, int glyphwidth); 75706f2543Smrg#endif 76706f2543Smrg 77706f2543Smrg#define glyph_scanline_func EXPNAME(XAAGlyphScanlineFunc) 78706f2543Smrg#define glyph_get_scanline_func EXPNAME(XAAGetGlyphScanlineFunc) 79706f2543Smrg 80706f2543Smrg 81706f2543SmrgGlyphScanlineFuncPtr glyph_scanline_func[32] = { 82706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, 83706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, 84706f2543Smrg DrawTETextScanlineGeneric, 85706f2543Smrg#ifdef USEASSEMBLER 86706f2543Smrg# ifdef FIXEDBASE 87706f2543Smrg# ifdef MSBFIRST 88706f2543Smrg DrawTETextScanlineWidth6PMSBFirstFixedBase, 89706f2543Smrg DrawTETextScanlineWidth7, 90706f2543Smrg DrawTETextScanlineWidth8PMSBFirstFixedBase, 91706f2543Smrg DrawTETextScanlineWidth9PMSBFirstFixedBase, 92706f2543Smrg# else 93706f2543Smrg DrawTETextScanlineWidth6PLSBFirstFixedBase, 94706f2543Smrg DrawTETextScanlineWidth7, 95706f2543Smrg DrawTETextScanlineWidth8PLSBFirstFixedBase, 96706f2543Smrg DrawTETextScanlineWidth9PLSBFirstFixedBase, 97706f2543Smrg# endif 98706f2543Smrg# else 99706f2543Smrg# ifdef MSBFIRST 100706f2543Smrg DrawTETextScanlineWidth6PMSBFirst, 101706f2543Smrg DrawTETextScanlineWidth7, 102706f2543Smrg DrawTETextScanlineWidth8PMSBFirst, 103706f2543Smrg DrawTETextScanlineWidth9PMSBFirst, 104706f2543Smrg# else 105706f2543Smrg DrawTETextScanlineWidth6PLSBFirst, 106706f2543Smrg DrawTETextScanlineWidth7, 107706f2543Smrg DrawTETextScanlineWidth8PLSBFirst, 108706f2543Smrg DrawTETextScanlineWidth9PLSBFirst, 109706f2543Smrg# endif 110706f2543Smrg# endif 111706f2543Smrg#else 112706f2543Smrg DrawTETextScanlineWidth6, DrawTETextScanlineWidth7, 113706f2543Smrg DrawTETextScanlineWidth8, DrawTETextScanlineWidth9, 114706f2543Smrg#endif 115706f2543Smrg DrawTETextScanlineWidth10, 116706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineWidth12, 117706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineWidth14, 118706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineWidth16, 119706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineWidth18, 120706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, 121706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, 122706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineWidth24, 123706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, 124706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, 125706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineGeneric, 126706f2543Smrg DrawTETextScanlineGeneric, DrawTETextScanlineGeneric 127706f2543Smrg}; 128706f2543Smrg 129706f2543SmrgGlyphScanlineFuncPtr *glyph_get_scanline_func(void) { 130706f2543Smrg return glyph_scanline_func; 131706f2543Smrg} 132706f2543Smrg 133706f2543Smrg 134706f2543Smrg/******************************************************************** 135706f2543Smrg 136706f2543Smrg Here we have TEGlyphRenders for a bunch of different color 137706f2543Smrg expansion types. The driver may provide its own renderer, but 138706f2543Smrg this is the default one which renders using lower-level primitives 139706f2543Smrg exported by the chipset driver. 140706f2543Smrg 141706f2543Smrg********************************************************************/ 142706f2543Smrg 143706f2543Smrg/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not. 144706f2543Smrg A total of 4 versions */ 145706f2543Smrg 146706f2543Smrgvoid 147706f2543SmrgEXPNAME(XAATEGlyphRenderer)( 148706f2543Smrg ScrnInfoPtr pScrn, 149706f2543Smrg int x, int y, int w, int h, int skipleft, int startline, 150706f2543Smrg unsigned int **glyphs, int glyphWidth, 151706f2543Smrg int fg, int bg, int rop, unsigned planemask 152706f2543Smrg) 153706f2543Smrg{ 154706f2543Smrg XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); 155706f2543Smrg CARD32* base; 156706f2543Smrg GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1]; 157706f2543Smrg int dwords = 0; 158706f2543Smrg 159706f2543Smrg if((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) { 160706f2543Smrg (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask); 161706f2543Smrg (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); 162706f2543Smrg bg = -1; 163706f2543Smrg } 164706f2543Smrg 165706f2543Smrg (*infoRec->SetupForCPUToScreenColorExpandFill)( 166706f2543Smrg pScrn, fg, bg, rop, planemask); 167706f2543Smrg 168706f2543Smrg if(skipleft && 169706f2543Smrg (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) || 170706f2543Smrg (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) && 171706f2543Smrg (skipleft > x)))) { 172706f2543Smrg /* draw the first character only */ 173706f2543Smrg 174706f2543Smrg int count = h, line = startline; 175706f2543Smrg int width = glyphWidth - skipleft; 176706f2543Smrg 177706f2543Smrg if(width > w) width = w; 178706f2543Smrg 179706f2543Smrg (*infoRec->SubsequentCPUToScreenColorExpandFill)( 180706f2543Smrg pScrn, x, y, width, h, 0); 181706f2543Smrg 182706f2543Smrg base = (CARD32*)infoRec->ColorExpandBase; 183706f2543Smrg 184706f2543Smrg while(count--) { 185706f2543Smrg register CARD32 tmp = SHIFT_R(glyphs[0][line++],skipleft); 186706f2543Smrg WRITE_BITS(tmp); 187706f2543Smrg } 188706f2543Smrg 189706f2543Smrg w -= width; 190706f2543Smrg if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) && 191706f2543Smrg ((((width + 31) >> 5) * h) & 1)) { 192706f2543Smrg base = (CARD32*)infoRec->ColorExpandBase; 193706f2543Smrg base[0] = 0x00000000; 194706f2543Smrg } 195706f2543Smrg if(!w) goto THE_END; 196706f2543Smrg glyphs++; 197706f2543Smrg x += width; 198706f2543Smrg skipleft = 0; /* nicely aligned again */ 199706f2543Smrg } 200706f2543Smrg 201706f2543Smrg w += skipleft; 202706f2543Smrg x -= skipleft; 203706f2543Smrg dwords = ((w + 31) >> 5) * h; 204706f2543Smrg 205706f2543Smrg (*infoRec->SubsequentCPUToScreenColorExpandFill)( 206706f2543Smrg pScrn, x, y, w, h, skipleft); 207706f2543Smrg 208706f2543Smrg base = (CARD32*)infoRec->ColorExpandBase; 209706f2543Smrg 210706f2543Smrg#ifndef FIXEDBASE 211706f2543Smrg if((((w + 31) >> 5) * h) <= infoRec->ColorExpandRange) 212706f2543Smrg while(h--) { 213706f2543Smrg base = (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth); 214706f2543Smrg } 215706f2543Smrg else 216706f2543Smrg#endif 217706f2543Smrg while(h--) { 218706f2543Smrg (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth); 219706f2543Smrg } 220706f2543Smrg 221706f2543Smrg if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) && 222706f2543Smrg (dwords & 1)) { 223706f2543Smrg base = (CARD32*)infoRec->ColorExpandBase; 224706f2543Smrg base[0] = 0x00000000; 225706f2543Smrg } 226706f2543Smrg 227706f2543SmrgTHE_END: 228706f2543Smrg 229706f2543Smrg if(infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND) 230706f2543Smrg (*infoRec->Sync)(pScrn); 231706f2543Smrg else SET_SYNC_FLAG(infoRec); 232706f2543Smrg} 233706f2543Smrg 234706f2543Smrg/******************************************************************** 235706f2543Smrg 236706f2543Smrg This is the GlyphRenderer for TRIPLE_BITS_24BPP. It renders to a buffer 237706f2543Smrg with the non FIXEDBASE LSB_FIRST code before tripling, and possibly 238706f2543Smrg reversing the bits and sending them to the screen 239706f2543Smrg 240706f2543Smrg********************************************************************/ 241706f2543Smrg 242706f2543Smrgvoid 243706f2543SmrgEXPNAME(XAATEGlyphRenderer3)( 244706f2543Smrg ScrnInfoPtr pScrn, 245706f2543Smrg int x, int y, int w, int h, int skipleft, int startline, 246706f2543Smrg unsigned int **glyphs, int glyphWidth, 247706f2543Smrg int fg, int bg, int rop, unsigned planemask 248706f2543Smrg) 249706f2543Smrg{ 250706f2543Smrg XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); 251706f2543Smrg CARD32 *base, *mem; 252706f2543Smrg GlyphScanlineFuncPtr GlyphFunc = XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1]; 253706f2543Smrg int dwords = 0; 254706f2543Smrg 255706f2543Smrg if((bg != -1) && 256706f2543Smrg ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) || 257706f2543Smrg ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) && 258706f2543Smrg (!CHECK_RGB_EQUAL(bg))))) { 259706f2543Smrg (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask); 260706f2543Smrg (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); 261706f2543Smrg bg = -1; 262706f2543Smrg } 263706f2543Smrg 264706f2543Smrg (*infoRec->SetupForCPUToScreenColorExpandFill)( 265706f2543Smrg pScrn, fg, bg, rop, planemask); 266706f2543Smrg 267706f2543Smrg if(skipleft) { 268706f2543Smrg /* draw the first character only */ 269706f2543Smrg 270706f2543Smrg int count = h, line = startline; 271706f2543Smrg int width = glyphWidth - skipleft; 272706f2543Smrg CARD32 bits; 273706f2543Smrg 274706f2543Smrg if(width > w) width = w; 275706f2543Smrg (*infoRec->SubsequentCPUToScreenColorExpandFill)( 276706f2543Smrg pScrn, x, y, width, h, 0); 277706f2543Smrg 278706f2543Smrg base = (CARD32*)infoRec->ColorExpandBase; 279706f2543Smrg 280706f2543Smrg while(count--) { 281706f2543Smrg bits = SHIFT_R(glyphs[0][line++],skipleft); 282706f2543Smrg if (width >= 22) { 283706f2543Smrg WRITE_BITS3(bits); 284706f2543Smrg } else if (width >= 11) { 285706f2543Smrg WRITE_BITS2(bits); 286706f2543Smrg } else { 287706f2543Smrg WRITE_BITS1(bits); 288706f2543Smrg } 289706f2543Smrg } 290706f2543Smrg 291706f2543Smrg w -= width; 292706f2543Smrg if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) && 293706f2543Smrg ((((3 * width + 31) >> 5) * h) & 1)) { 294706f2543Smrg base = (CARD32*)infoRec->ColorExpandBase; 295706f2543Smrg base[0] = 0x00000000; 296706f2543Smrg } 297706f2543Smrg if(!w) goto THE_END; 298706f2543Smrg glyphs++; 299706f2543Smrg x += width; 300706f2543Smrg skipleft = 0; /* nicely aligned again */ 301706f2543Smrg } 302706f2543Smrg 303706f2543Smrg dwords = ((3 * w + 31) >> 5) * h; 304706f2543Smrg mem = (CARD32*)malloc(((w + 31) >> 3) * sizeof(char)); 305706f2543Smrg if (!mem) return; 306706f2543Smrg 307706f2543Smrg (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, x, y, w, h, 0); 308706f2543Smrg 309706f2543Smrg base = (CARD32*)infoRec->ColorExpandBase; 310706f2543Smrg 311706f2543Smrg# ifndef FIXEDBASE 312706f2543Smrg if((((3 * w + 31) >> 5) * h) <= infoRec->ColorExpandRange) 313706f2543Smrg while(h--) { 314706f2543Smrg (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth); 315706f2543Smrg base = DrawTextScanline3(base, mem, w); 316706f2543Smrg } 317706f2543Smrg else 318706f2543Smrg# endif 319706f2543Smrg while(h--) { 320706f2543Smrg (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth); 321706f2543Smrg DrawTextScanline3(base, mem, w); 322706f2543Smrg } 323706f2543Smrg 324706f2543Smrg free(mem); 325706f2543Smrg 326706f2543Smrg if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) && 327706f2543Smrg (dwords & 1)) { 328706f2543Smrg base = (CARD32*)infoRec->ColorExpandBase; 329706f2543Smrg base[0] = 0x00000000; 330706f2543Smrg } 331706f2543Smrg 332706f2543SmrgTHE_END: 333706f2543Smrg 334706f2543Smrg if(infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND) 335706f2543Smrg (*infoRec->Sync)(pScrn); 336706f2543Smrg else SET_SYNC_FLAG(infoRec); 337706f2543Smrg} 338706f2543Smrg 339706f2543Smrg 340706f2543Smrg#ifndef FIXEDBASE 341706f2543Smrg/* Scanline version of above gets built for LSBFIRST and MSBFIRST */ 342706f2543Smrg 343706f2543Smrgvoid 344706f2543SmrgEXPNAME(XAATEGlyphRendererScanline)( 345706f2543Smrg ScrnInfoPtr pScrn, 346706f2543Smrg int x, int y, int w, int h, int skipleft, int startline, 347706f2543Smrg unsigned int **glyphs, int glyphWidth, 348706f2543Smrg int fg, int bg, int rop, unsigned planemask 349706f2543Smrg) 350706f2543Smrg{ 351706f2543Smrg XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); 352706f2543Smrg int bufferNo; 353706f2543Smrg CARD32* base; 354706f2543Smrg GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1]; 355706f2543Smrg 356706f2543Smrg if((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) { 357706f2543Smrg (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask); 358706f2543Smrg (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); 359706f2543Smrg bg = -1; 360706f2543Smrg } 361706f2543Smrg 362706f2543Smrg (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)( 363706f2543Smrg pScrn, fg, bg, rop, planemask); 364706f2543Smrg 365706f2543Smrg if(skipleft && 366706f2543Smrg (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) || 367706f2543Smrg (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) && 368706f2543Smrg (skipleft > x)))) { 369706f2543Smrg /* draw the first character only */ 370706f2543Smrg 371706f2543Smrg int count = h, line = startline; 372706f2543Smrg int width = glyphWidth - skipleft; 373706f2543Smrg 374706f2543Smrg if(width > w) width = w; 375706f2543Smrg 376706f2543Smrg (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)( 377706f2543Smrg pScrn, x, y, width, h, 0); 378706f2543Smrg 379706f2543Smrg bufferNo = 0; 380706f2543Smrg 381706f2543Smrg while(count--) { 382706f2543Smrg register CARD32 tmp = SHIFT_R(glyphs[0][line++],skipleft); 383706f2543Smrg base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo]; 384706f2543Smrg WRITE_BITS(tmp); 385706f2543Smrg (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++); 386706f2543Smrg if(bufferNo >= infoRec->NumScanlineColorExpandBuffers) 387706f2543Smrg bufferNo = 0; 388706f2543Smrg } 389706f2543Smrg 390706f2543Smrg w -= width; 391706f2543Smrg if(!w) goto THE_END; 392706f2543Smrg glyphs++; 393706f2543Smrg x += width; 394706f2543Smrg skipleft = 0; /* nicely aligned again */ 395706f2543Smrg } 396706f2543Smrg 397706f2543Smrg w += skipleft; 398706f2543Smrg x -= skipleft; 399706f2543Smrg 400706f2543Smrg (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)( 401706f2543Smrg pScrn, x, y, w, h, skipleft); 402706f2543Smrg 403706f2543Smrg bufferNo = 0; 404706f2543Smrg 405706f2543Smrg while(h--) { 406706f2543Smrg base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo]; 407706f2543Smrg (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth); 408706f2543Smrg (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++); 409706f2543Smrg if(bufferNo >= infoRec->NumScanlineColorExpandBuffers) 410706f2543Smrg bufferNo = 0; 411706f2543Smrg } 412706f2543Smrg 413706f2543SmrgTHE_END: 414706f2543Smrg 415706f2543Smrg SET_SYNC_FLAG(infoRec); 416706f2543Smrg} 417706f2543Smrg 418706f2543Smrgvoid 419706f2543SmrgEXPNAME(XAATEGlyphRendererScanline3)( 420706f2543Smrg ScrnInfoPtr pScrn, 421706f2543Smrg int x, int y, int w, int h, int skipleft, int startline, 422706f2543Smrg unsigned int **glyphs, int glyphWidth, 423706f2543Smrg int fg, int bg, int rop, unsigned planemask 424706f2543Smrg) 425706f2543Smrg{ 426706f2543Smrg XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); 427706f2543Smrg int bufferNo; 428706f2543Smrg CARD32 *base, *mem; 429706f2543Smrg GlyphScanlineFuncPtr GlyphFunc = XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1]; 430706f2543Smrg 431706f2543Smrg if((bg != -1) && 432706f2543Smrg ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) || 433706f2543Smrg ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) && 434706f2543Smrg (!CHECK_RGB_EQUAL(bg))))) { 435706f2543Smrg (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask); 436706f2543Smrg (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); 437706f2543Smrg bg = -1; 438706f2543Smrg } 439706f2543Smrg 440706f2543Smrg (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)( 441706f2543Smrg pScrn, fg, bg, rop, planemask); 442706f2543Smrg 443706f2543Smrg if(skipleft) { 444706f2543Smrg /* draw the first character only */ 445706f2543Smrg 446706f2543Smrg int count = h, line = startline; 447706f2543Smrg int width = glyphWidth - skipleft; 448706f2543Smrg CARD32 bits; 449706f2543Smrg 450706f2543Smrg if(width > w) width = w; 451706f2543Smrg 452706f2543Smrg (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)( 453706f2543Smrg pScrn, x, y, width, h, 0); 454706f2543Smrg 455706f2543Smrg bufferNo = 0; 456706f2543Smrg 457706f2543Smrg while(count--) { 458706f2543Smrg base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo]; 459706f2543Smrg bits = SHIFT_R(glyphs[0][line++],skipleft); 460706f2543Smrg if (width >= 22) { 461706f2543Smrg WRITE_BITS3(bits); 462706f2543Smrg } else if (width >= 11) { 463706f2543Smrg WRITE_BITS2(bits); 464706f2543Smrg } else { 465706f2543Smrg WRITE_BITS1(bits); 466706f2543Smrg } 467706f2543Smrg (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++); 468706f2543Smrg if(bufferNo >= infoRec->NumScanlineColorExpandBuffers) 469706f2543Smrg bufferNo = 0; 470706f2543Smrg } 471706f2543Smrg 472706f2543Smrg w -= width; 473706f2543Smrg if(!w) goto THE_END; 474706f2543Smrg glyphs++; 475706f2543Smrg x += width; 476706f2543Smrg skipleft = 0; /* nicely aligned again */ 477706f2543Smrg } 478706f2543Smrg 479706f2543Smrg w += skipleft; 480706f2543Smrg x -= skipleft; 481706f2543Smrg mem = (CARD32*)malloc(((w + 31) >> 3) * sizeof(char)); 482706f2543Smrg if (!mem) return; 483706f2543Smrg 484706f2543Smrg (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)( 485706f2543Smrg pScrn, x, y, w, h, skipleft); 486706f2543Smrg 487706f2543Smrg bufferNo = 0; 488706f2543Smrg 489706f2543Smrg while(h--) { 490706f2543Smrg base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo]; 491706f2543Smrg (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth); 492706f2543Smrg DrawTextScanline3(base, mem, w); 493706f2543Smrg (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++); 494706f2543Smrg if(bufferNo >= infoRec->NumScanlineColorExpandBuffers) 495706f2543Smrg bufferNo = 0; 496706f2543Smrg } 497706f2543Smrg 498706f2543Smrg free(mem); 499706f2543Smrg 500706f2543SmrgTHE_END: 501706f2543Smrg 502706f2543Smrg SET_SYNC_FLAG(infoRec); 503706f2543Smrg} 504706f2543Smrg 505706f2543Smrg#endif 506706f2543Smrg 507706f2543Smrg 508706f2543Smrg 509706f2543Smrg/******************************************************************** 510706f2543Smrg 511706f2543Smrg TRIPLE_BITS_24BPP scanline rendering code. 512706f2543Smrg 513706f2543Smrg********************************************************************/ 514706f2543Smrg 515706f2543Smrg 516706f2543Smrg 517706f2543Smrgstatic CARD32* 518706f2543SmrgDrawTextScanline3( 519706f2543Smrg CARD32 *base, 520706f2543Smrg CARD32 *mem, 521706f2543Smrg int width ) 522706f2543Smrg{ 523706f2543Smrg 524706f2543Smrg while(width > 32) { 525706f2543Smrg WRITE_BITS3(*mem); 526706f2543Smrg mem++; 527706f2543Smrg width -= 32; 528706f2543Smrg } 529706f2543Smrg if(width) { 530706f2543Smrg if (width >= 22) { 531706f2543Smrg WRITE_BITS3(*mem); 532706f2543Smrg } else if (width >= 11) { 533706f2543Smrg WRITE_BITS2(*mem); 534706f2543Smrg } else { 535706f2543Smrg WRITE_BITS1(*mem); 536706f2543Smrg } 537706f2543Smrg } 538706f2543Smrg 539706f2543Smrg return base; 540706f2543Smrg} 541706f2543Smrg 542706f2543Smrg 543706f2543Smrg/******************************************************************** 544706f2543Smrg 545706f2543Smrg Generic TE scanline rendering code. 546706f2543Smrg 547706f2543Smrg********************************************************************/ 548706f2543Smrg 549706f2543Smrg 550706f2543Smrg 551706f2543Smrgstatic CARD32* 552706f2543SmrgDrawTETextScanlineGeneric( 553706f2543Smrg CARD32 *base, 554706f2543Smrg unsigned int **glyphp, 555706f2543Smrg int line, int width, int glyphwidth ) 556706f2543Smrg{ 557706f2543Smrg CARD32 bits = (*glyphp)[line]; 558706f2543Smrg int shift = glyphwidth; 559706f2543Smrg 560706f2543Smrg while(width > 32) { 561706f2543Smrg while(shift < 32) { 562706f2543Smrg glyphp++; 563706f2543Smrg bits |= SHIFT_L((*glyphp)[line], shift); 564706f2543Smrg shift += glyphwidth; 565706f2543Smrg } 566706f2543Smrg WRITE_BITS(bits); 567706f2543Smrg shift &= 31; 568706f2543Smrg if(shift) 569706f2543Smrg bits = SHIFT_R((*glyphp)[line],(glyphwidth - shift)); 570706f2543Smrg else bits = 0; 571706f2543Smrg width -= 32; 572706f2543Smrg } 573706f2543Smrg 574706f2543Smrg if(width) { 575706f2543Smrg width -= shift; 576706f2543Smrg while(width > 0) { 577706f2543Smrg glyphp++; 578706f2543Smrg bits |= SHIFT_L((*glyphp)[line],shift); 579706f2543Smrg shift += glyphwidth; 580706f2543Smrg width -= glyphwidth; 581706f2543Smrg } 582706f2543Smrg WRITE_BITS(bits); 583706f2543Smrg } 584706f2543Smrg 585706f2543Smrg return base; 586706f2543Smrg} 587706f2543Smrg 588706f2543Smrg 589706f2543Smrg/******************************************************************** 590706f2543Smrg 591706f2543Smrg Loop unrolled TE font scanline rendering code 592706f2543Smrg 593706f2543Smrg********************************************************************/ 594706f2543Smrg 595706f2543Smrg 596706f2543Smrg#ifndef USEASSEMBLER 597706f2543Smrgstatic CARD32* 598706f2543SmrgDrawTETextScanlineWidth6( 599706f2543Smrg CARD32 *base, 600706f2543Smrg unsigned int **glyphp, 601706f2543Smrg int line, int width, int glyphwidth ) 602706f2543Smrg{ 603706f2543Smrg while (1) { 604706f2543Smrg unsigned int bits; 605706f2543Smrg bits = glyphp[0][line]; 606706f2543Smrg bits |= SHIFT_L(glyphp[1][line],6); 607706f2543Smrg bits |= SHIFT_L(glyphp[2][line],12); 608706f2543Smrg bits |= SHIFT_L(glyphp[3][line],18); 609706f2543Smrg bits |= SHIFT_L(glyphp[4][line],24); 610706f2543Smrg bits |= SHIFT_L(glyphp[5][line],30); 611706f2543Smrg WRITE_IN_BITORDER(base, 0, bits); 612706f2543Smrg CHECKRETURN(1); 613706f2543Smrg bits = SHIFT_R(glyphp[5][line],2); 614706f2543Smrg bits |= SHIFT_L(glyphp[6][line],4); 615706f2543Smrg bits |= SHIFT_L(glyphp[7][line],10); 616706f2543Smrg bits |= SHIFT_L(glyphp[8][line],16); 617706f2543Smrg bits |= SHIFT_L(glyphp[9][line],22); 618706f2543Smrg bits |= SHIFT_L(glyphp[10][line],28); 619706f2543Smrg WRITE_IN_BITORDER(base, 1, bits); 620706f2543Smrg CHECKRETURN(2); 621706f2543Smrg bits = SHIFT_R(glyphp[10][line],4); 622706f2543Smrg bits |= SHIFT_L(glyphp[11][line],2); 623706f2543Smrg bits |= SHIFT_L(glyphp[12][line],8); 624706f2543Smrg bits |= SHIFT_L(glyphp[13][line],14); 625706f2543Smrg bits |= SHIFT_L(glyphp[14][line],20); 626706f2543Smrg bits |= SHIFT_L(glyphp[15][line],26); 627706f2543Smrg WRITE_IN_BITORDER(base, 2, bits); 628706f2543Smrg CHECKRETURN(3); 629706f2543Smrg#ifndef FIXEDBASE 630706f2543Smrg base += 3; 631706f2543Smrg#endif 632706f2543Smrg width -= 96; 633706f2543Smrg glyphp += 16; 634706f2543Smrg } 635706f2543Smrg return base; 636706f2543Smrg} 637706f2543Smrg#endif 638706f2543Smrg 639706f2543Smrgstatic CARD32* 640706f2543SmrgDrawTETextScanlineWidth7( 641706f2543Smrg CARD32 *base, 642706f2543Smrg unsigned int **glyphp, 643706f2543Smrg int line, int width, int glyphwidth ) 644706f2543Smrg{ 645706f2543Smrg while (1) { 646706f2543Smrg unsigned int bits; 647706f2543Smrg bits = glyphp[0][line]; 648706f2543Smrg bits |= SHIFT_L(glyphp[1][line],7); 649706f2543Smrg bits |= SHIFT_L(glyphp[2][line],14); 650706f2543Smrg bits |= SHIFT_L(glyphp[3][line],21); 651706f2543Smrg bits |= SHIFT_L(glyphp[4][line],28); 652706f2543Smrg WRITE_IN_BITORDER(base, 0, bits); 653706f2543Smrg CHECKRETURN(1); 654706f2543Smrg bits = SHIFT_R(glyphp[4][line],4); 655706f2543Smrg bits |= SHIFT_L(glyphp[5][line],3); 656706f2543Smrg bits |= SHIFT_L(glyphp[6][line],10); 657706f2543Smrg bits |= SHIFT_L(glyphp[7][line],17); 658706f2543Smrg bits |= SHIFT_L(glyphp[8][line],24); 659706f2543Smrg bits |= SHIFT_L(glyphp[9][line],31); 660706f2543Smrg WRITE_IN_BITORDER(base, 1, bits); 661706f2543Smrg CHECKRETURN(2); 662706f2543Smrg bits = SHIFT_R(glyphp[9][line],1); 663706f2543Smrg bits |= SHIFT_L(glyphp[10][line],6); 664706f2543Smrg bits |= SHIFT_L(glyphp[11][line],13); 665706f2543Smrg bits |= SHIFT_L(glyphp[12][line],20); 666706f2543Smrg bits |= SHIFT_L(glyphp[13][line],27); 667706f2543Smrg WRITE_IN_BITORDER(base, 2, bits); 668706f2543Smrg CHECKRETURN(3); 669706f2543Smrg bits = SHIFT_R(glyphp[13][line],5); 670706f2543Smrg bits |= SHIFT_L(glyphp[14][line],2); 671706f2543Smrg bits |= SHIFT_L(glyphp[15][line],9); 672706f2543Smrg bits |= SHIFT_L(glyphp[16][line],16); 673706f2543Smrg bits |= SHIFT_L(glyphp[17][line],23); 674706f2543Smrg bits |= SHIFT_L(glyphp[18][line],30); 675706f2543Smrg WRITE_IN_BITORDER(base, 3, bits); 676706f2543Smrg CHECKRETURN(4); 677706f2543Smrg bits = SHIFT_R(glyphp[18][line],2); 678706f2543Smrg bits |= SHIFT_L(glyphp[19][line],5); 679706f2543Smrg bits |= SHIFT_L(glyphp[20][line],12); 680706f2543Smrg bits |= SHIFT_L(glyphp[21][line],19); 681706f2543Smrg bits |= SHIFT_L(glyphp[22][line],26); 682706f2543Smrg WRITE_IN_BITORDER(base, 4, bits); 683706f2543Smrg CHECKRETURN(5); 684706f2543Smrg bits = SHIFT_R(glyphp[22][line],6); 685706f2543Smrg bits |= SHIFT_L(glyphp[23][line],1); 686706f2543Smrg bits |= SHIFT_L(glyphp[24][line],8); 687706f2543Smrg bits |= SHIFT_L(glyphp[25][line],15); 688706f2543Smrg bits |= SHIFT_L(glyphp[26][line],22); 689706f2543Smrg bits |= SHIFT_L(glyphp[27][line],29); 690706f2543Smrg WRITE_IN_BITORDER(base, 5, bits); 691706f2543Smrg CHECKRETURN(6); 692706f2543Smrg bits = SHIFT_R(glyphp[27][line],3); 693706f2543Smrg bits |= SHIFT_L(glyphp[28][line],4); 694706f2543Smrg bits |= SHIFT_L(glyphp[29][line],11); 695706f2543Smrg bits |= SHIFT_L(glyphp[30][line],18); 696706f2543Smrg bits |= SHIFT_L(glyphp[31][line],25); 697706f2543Smrg WRITE_IN_BITORDER(base, 6, bits); 698706f2543Smrg CHECKRETURN(7); 699706f2543Smrg#ifndef FIXEDBASE 700706f2543Smrg base += 7; 701706f2543Smrg#endif 702706f2543Smrg width -= 224; 703706f2543Smrg glyphp += 32; 704706f2543Smrg } 705706f2543Smrg return base; 706706f2543Smrg} 707706f2543Smrg 708706f2543Smrg 709706f2543Smrg#ifndef USEASSEMBLER 710706f2543Smrgstatic CARD32* 711706f2543SmrgDrawTETextScanlineWidth8( 712706f2543Smrg CARD32 *base, 713706f2543Smrg unsigned int **glyphp, 714706f2543Smrg int line, int width, int glyphwidth ) 715706f2543Smrg{ 716706f2543Smrg while (1) { 717706f2543Smrg unsigned int bits; 718706f2543Smrg bits = glyphp[0][line]; 719706f2543Smrg bits |= SHIFT_L(glyphp[1][line],8); 720706f2543Smrg bits |= SHIFT_L(glyphp[2][line],16); 721706f2543Smrg bits |= SHIFT_L(glyphp[3][line],24); 722706f2543Smrg WRITE_IN_BITORDER(base, 0, bits); 723706f2543Smrg CHECKRETURN(1); 724706f2543Smrg bits = glyphp[4][line]; 725706f2543Smrg bits |= SHIFT_L(glyphp[5][line],8); 726706f2543Smrg bits |= SHIFT_L(glyphp[6][line],16); 727706f2543Smrg bits |= SHIFT_L(glyphp[7][line],24); 728706f2543Smrg WRITE_IN_BITORDER(base, 1, bits); 729706f2543Smrg CHECKRETURN(2); 730706f2543Smrg#ifndef FIXEDBASE 731706f2543Smrg base += 2; 732706f2543Smrg#endif 733706f2543Smrg width -= 64; 734706f2543Smrg glyphp += 8; 735706f2543Smrg } 736706f2543Smrg return base; 737706f2543Smrg} 738706f2543Smrg#endif 739706f2543Smrg 740706f2543Smrg#ifndef USEASSEMBLER 741706f2543Smrgstatic CARD32* 742706f2543SmrgDrawTETextScanlineWidth9( 743706f2543Smrg CARD32 *base, 744706f2543Smrg unsigned int **glyphp, 745706f2543Smrg int line, int width, int glyphwidth ) 746706f2543Smrg{ 747706f2543Smrg while (1) { 748706f2543Smrg unsigned int bits; 749706f2543Smrg bits = glyphp[0][line]; 750706f2543Smrg bits |= SHIFT_L(glyphp[1][line],9); 751706f2543Smrg bits |= SHIFT_L(glyphp[2][line],18); 752706f2543Smrg bits |= SHIFT_L(glyphp[3][line],27); 753706f2543Smrg WRITE_IN_BITORDER(base, 0, bits); 754706f2543Smrg CHECKRETURN(1); 755706f2543Smrg bits = SHIFT_R(glyphp[3][line],5); 756706f2543Smrg bits |= SHIFT_L(glyphp[4][line],4); 757706f2543Smrg bits |= SHIFT_L(glyphp[5][line],13); 758706f2543Smrg bits |= SHIFT_L(glyphp[6][line],22); 759706f2543Smrg bits |= SHIFT_L(glyphp[7][line],31); 760706f2543Smrg WRITE_IN_BITORDER(base, 1, bits); 761706f2543Smrg CHECKRETURN(2); 762706f2543Smrg bits = SHIFT_R(glyphp[7][line],1); 763706f2543Smrg bits |= SHIFT_L(glyphp[8][line],8); 764706f2543Smrg bits |= SHIFT_L(glyphp[9][line],17); 765706f2543Smrg bits |= SHIFT_L(glyphp[10][line],26); 766706f2543Smrg WRITE_IN_BITORDER(base, 2, bits); 767706f2543Smrg CHECKRETURN(3); 768706f2543Smrg bits = SHIFT_R(glyphp[10][line],6); 769706f2543Smrg bits |= SHIFT_L(glyphp[11][line],3); 770706f2543Smrg bits |= SHIFT_L(glyphp[12][line],12); 771706f2543Smrg bits |= SHIFT_L(glyphp[13][line],21); 772706f2543Smrg bits |= SHIFT_L(glyphp[14][line],30); 773706f2543Smrg WRITE_IN_BITORDER(base, 3, bits); 774706f2543Smrg CHECKRETURN(4); 775706f2543Smrg bits = SHIFT_R(glyphp[14][line],2); 776706f2543Smrg bits |= SHIFT_L(glyphp[15][line],7); 777706f2543Smrg bits |= SHIFT_L(glyphp[16][line],16); 778706f2543Smrg bits |= SHIFT_L(glyphp[17][line],25); 779706f2543Smrg WRITE_IN_BITORDER(base, 4, bits); 780706f2543Smrg CHECKRETURN(5); 781706f2543Smrg bits = SHIFT_R(glyphp[17][line],7); 782706f2543Smrg bits |= SHIFT_L(glyphp[18][line],2); 783706f2543Smrg bits |= SHIFT_L(glyphp[19][line],11); 784706f2543Smrg bits |= SHIFT_L(glyphp[20][line],20); 785706f2543Smrg bits |= SHIFT_L(glyphp[21][line],29); 786706f2543Smrg WRITE_IN_BITORDER(base, 5, bits); 787706f2543Smrg CHECKRETURN(6); 788706f2543Smrg bits = SHIFT_R(glyphp[21][line],3); 789706f2543Smrg bits |= SHIFT_L(glyphp[22][line],6); 790706f2543Smrg bits |= SHIFT_L(glyphp[23][line],15); 791706f2543Smrg bits |= SHIFT_L(glyphp[24][line],24); 792706f2543Smrg WRITE_IN_BITORDER(base, 6, bits); 793706f2543Smrg CHECKRETURN(7); 794706f2543Smrg bits = SHIFT_R(glyphp[24][line],8); 795706f2543Smrg bits |= SHIFT_L(glyphp[25][line],1); 796706f2543Smrg bits |= SHIFT_L(glyphp[26][line],10); 797706f2543Smrg bits |= SHIFT_L(glyphp[27][line],19); 798706f2543Smrg bits |= SHIFT_L(glyphp[28][line],28); 799706f2543Smrg WRITE_IN_BITORDER(base, 7, bits); 800706f2543Smrg CHECKRETURN(8); 801706f2543Smrg bits = SHIFT_R(glyphp[28][line],4); 802706f2543Smrg bits |= SHIFT_L(glyphp[29][line],5); 803706f2543Smrg bits |= SHIFT_L(glyphp[30][line],14); 804706f2543Smrg bits |= SHIFT_L(glyphp[31][line],23); 805706f2543Smrg WRITE_IN_BITORDER(base, 8, bits); 806706f2543Smrg CHECKRETURN(9); 807706f2543Smrg#ifndef FIXEDBASE 808706f2543Smrg base += 9; 809706f2543Smrg#endif 810706f2543Smrg width -= 288; 811706f2543Smrg glyphp += 32; 812706f2543Smrg } 813706f2543Smrg return base; 814706f2543Smrg} 815706f2543Smrg#endif 816706f2543Smrg 817706f2543Smrgstatic CARD32* 818706f2543SmrgDrawTETextScanlineWidth10( 819706f2543Smrg CARD32 *base, 820706f2543Smrg unsigned int **glyphp, 821706f2543Smrg int line, int width, int glyphwidth ) 822706f2543Smrg{ 823706f2543Smrg while (1) { 824706f2543Smrg unsigned int bits; 825706f2543Smrg bits = glyphp[0][line]; 826706f2543Smrg bits |= SHIFT_L(glyphp[1][line],10); 827706f2543Smrg bits |= SHIFT_L(glyphp[2][line],20); 828706f2543Smrg bits |= SHIFT_L(glyphp[3][line],30); 829706f2543Smrg WRITE_IN_BITORDER(base, 0, bits); 830706f2543Smrg CHECKRETURN(1); 831706f2543Smrg bits = SHIFT_R(glyphp[3][line],2); 832706f2543Smrg bits |= SHIFT_L(glyphp[4][line],8); 833706f2543Smrg bits |= SHIFT_L(glyphp[5][line],18); 834706f2543Smrg bits |= SHIFT_L(glyphp[6][line],28); 835706f2543Smrg WRITE_IN_BITORDER(base, 1, bits); 836706f2543Smrg CHECKRETURN(2); 837706f2543Smrg bits = SHIFT_R(glyphp[6][line],4); 838706f2543Smrg bits |= SHIFT_L(glyphp[7][line],6); 839706f2543Smrg bits |= SHIFT_L(glyphp[8][line],16); 840706f2543Smrg bits |= SHIFT_L(glyphp[9][line],26); 841706f2543Smrg WRITE_IN_BITORDER(base, 2, bits); 842706f2543Smrg CHECKRETURN(3); 843706f2543Smrg bits = SHIFT_R(glyphp[9][line],6); 844706f2543Smrg bits |= SHIFT_L(glyphp[10][line],4); 845706f2543Smrg bits |= SHIFT_L(glyphp[11][line],14); 846706f2543Smrg bits |= SHIFT_L(glyphp[12][line],24); 847706f2543Smrg WRITE_IN_BITORDER(base, 3, bits); 848706f2543Smrg CHECKRETURN(4); 849706f2543Smrg bits = SHIFT_R(glyphp[12][line],8); 850706f2543Smrg bits |= SHIFT_L(glyphp[13][line],2); 851706f2543Smrg bits |= SHIFT_L(glyphp[14][line],12); 852706f2543Smrg bits |= SHIFT_L(glyphp[15][line],22); 853706f2543Smrg WRITE_IN_BITORDER(base, 4, bits); 854706f2543Smrg CHECKRETURN(5); 855706f2543Smrg#ifndef FIXEDBASE 856706f2543Smrg base += 5; 857706f2543Smrg#endif 858706f2543Smrg width -= 160; 859706f2543Smrg glyphp += 16; 860706f2543Smrg } 861706f2543Smrg return base; 862706f2543Smrg} 863706f2543Smrg 864706f2543Smrgstatic CARD32* 865706f2543SmrgDrawTETextScanlineWidth12( 866706f2543Smrg CARD32 *base, 867706f2543Smrg unsigned int **glyphp, 868706f2543Smrg int line, int width, int glyphwidth ) 869706f2543Smrg{ 870706f2543Smrg while (1) { 871706f2543Smrg unsigned int bits; 872706f2543Smrg bits = glyphp[0][line]; 873706f2543Smrg bits |= SHIFT_L(glyphp[1][line],12); 874706f2543Smrg bits |= SHIFT_L(glyphp[2][line],24); 875706f2543Smrg WRITE_IN_BITORDER(base, 0, bits); 876706f2543Smrg CHECKRETURN(1); 877706f2543Smrg bits = SHIFT_R(glyphp[2][line],8); 878706f2543Smrg bits |= SHIFT_L(glyphp[3][line],4); 879706f2543Smrg bits |= SHIFT_L(glyphp[4][line],16); 880706f2543Smrg bits |= SHIFT_L(glyphp[5][line],28); 881706f2543Smrg WRITE_IN_BITORDER(base, 1, bits); 882706f2543Smrg CHECKRETURN(2); 883706f2543Smrg bits = SHIFT_R(glyphp[5][line],4); 884706f2543Smrg bits |= SHIFT_L(glyphp[6][line],8); 885706f2543Smrg bits |= SHIFT_L(glyphp[7][line],20); 886706f2543Smrg WRITE_IN_BITORDER(base, 2, bits); 887706f2543Smrg CHECKRETURN(3); 888706f2543Smrg#ifndef FIXEDBASE 889706f2543Smrg base += 3; 890706f2543Smrg#endif 891706f2543Smrg width -= 96; 892706f2543Smrg glyphp += 8; 893706f2543Smrg } 894706f2543Smrg return base; 895706f2543Smrg} 896706f2543Smrg 897706f2543Smrg 898706f2543Smrg 899706f2543Smrgstatic CARD32* 900706f2543SmrgDrawTETextScanlineWidth14( 901706f2543Smrg CARD32 *base, 902706f2543Smrg unsigned int **glyphp, 903706f2543Smrg int line, int width, int glyphwidth ) 904706f2543Smrg{ 905706f2543Smrg while (1) { 906706f2543Smrg unsigned int bits; 907706f2543Smrg bits = glyphp[0][line]; 908706f2543Smrg bits |= SHIFT_L(glyphp[1][line],14); 909706f2543Smrg bits |= SHIFT_L(glyphp[2][line],28); 910706f2543Smrg WRITE_IN_BITORDER(base, 0, bits); 911706f2543Smrg CHECKRETURN(1); 912706f2543Smrg bits = SHIFT_R(glyphp[2][line],4); 913706f2543Smrg bits |= SHIFT_L(glyphp[3][line],10); 914706f2543Smrg bits |= SHIFT_L(glyphp[4][line],24); 915706f2543Smrg WRITE_IN_BITORDER(base, 1, bits); 916706f2543Smrg CHECKRETURN(2); 917706f2543Smrg bits = SHIFT_R(glyphp[4][line],8); 918706f2543Smrg bits |= SHIFT_L(glyphp[5][line],6); 919706f2543Smrg bits |= SHIFT_L(glyphp[6][line],20); 920706f2543Smrg WRITE_IN_BITORDER(base, 2, bits); 921706f2543Smrg CHECKRETURN(3); 922706f2543Smrg bits = SHIFT_R(glyphp[6][line],12); 923706f2543Smrg bits |= SHIFT_L(glyphp[7][line],2); 924706f2543Smrg bits |= SHIFT_L(glyphp[8][line],16); 925706f2543Smrg bits |= SHIFT_L(glyphp[9][line],30); 926706f2543Smrg WRITE_IN_BITORDER(base, 3, bits); 927706f2543Smrg CHECKRETURN(4); 928706f2543Smrg bits = SHIFT_R(glyphp[9][line],2); 929706f2543Smrg bits |= SHIFT_L(glyphp[10][line],12); 930706f2543Smrg bits |= SHIFT_L(glyphp[11][line],26); 931706f2543Smrg WRITE_IN_BITORDER(base, 4, bits); 932706f2543Smrg CHECKRETURN(5); 933706f2543Smrg bits = SHIFT_R(glyphp[11][line],6); 934706f2543Smrg bits |= SHIFT_L(glyphp[12][line],8); 935706f2543Smrg bits |= SHIFT_L(glyphp[13][line],22); 936706f2543Smrg WRITE_IN_BITORDER(base, 5, bits); 937706f2543Smrg CHECKRETURN(6); 938706f2543Smrg bits = SHIFT_R(glyphp[13][line],10); 939706f2543Smrg bits |= SHIFT_L(glyphp[14][line],4); 940706f2543Smrg bits |= SHIFT_L(glyphp[15][line],18); 941706f2543Smrg WRITE_IN_BITORDER(base, 6, bits); 942706f2543Smrg CHECKRETURN(7); 943706f2543Smrg#ifndef FIXEDBASE 944706f2543Smrg base += 7; 945706f2543Smrg#endif 946706f2543Smrg width -= 224; 947706f2543Smrg glyphp += 16; 948706f2543Smrg } 949706f2543Smrg return base; 950706f2543Smrg} 951706f2543Smrg 952706f2543Smrg 953706f2543Smrgstatic CARD32* 954706f2543SmrgDrawTETextScanlineWidth16( 955706f2543Smrg CARD32 *base, 956706f2543Smrg unsigned int **glyphp, 957706f2543Smrg int line, int width, int glyphwidth ) 958706f2543Smrg{ 959706f2543Smrg while (1) { 960706f2543Smrg unsigned int bits; 961706f2543Smrg bits = glyphp[0][line]; 962706f2543Smrg bits |= SHIFT_L(glyphp[1][line],16); 963706f2543Smrg WRITE_IN_BITORDER(base, 0, bits); 964706f2543Smrg CHECKRETURN(1); 965706f2543Smrg bits = glyphp[2][line]; 966706f2543Smrg bits |= SHIFT_L(glyphp[3][line],16); 967706f2543Smrg WRITE_IN_BITORDER(base, 1, bits); 968706f2543Smrg CHECKRETURN(2); 969706f2543Smrg bits = glyphp[4][line]; 970706f2543Smrg bits |= SHIFT_L(glyphp[5][line],16); 971706f2543Smrg WRITE_IN_BITORDER(base, 2, bits); 972706f2543Smrg CHECKRETURN(3); 973706f2543Smrg bits = glyphp[6][line]; 974706f2543Smrg bits |= SHIFT_L(glyphp[7][line],16); 975706f2543Smrg WRITE_IN_BITORDER(base, 3, bits); 976706f2543Smrg CHECKRETURN(4); 977706f2543Smrg#ifndef FIXEDBASE 978706f2543Smrg base += 4; 979706f2543Smrg#endif 980706f2543Smrg width -= 128; 981706f2543Smrg glyphp += 8; 982706f2543Smrg } 983706f2543Smrg return base; 984706f2543Smrg} 985706f2543Smrg 986706f2543Smrg 987706f2543Smrg 988706f2543Smrgstatic CARD32* 989706f2543SmrgDrawTETextScanlineWidth18( 990706f2543Smrg CARD32 *base, 991706f2543Smrg unsigned int **glyphp, 992706f2543Smrg int line, int width, int glyphwidth ) 993706f2543Smrg{ 994706f2543Smrg while (1) { 995706f2543Smrg unsigned int bits; 996706f2543Smrg bits = glyphp[0][line]; 997706f2543Smrg bits |= SHIFT_L(glyphp[1][line],18); 998706f2543Smrg WRITE_IN_BITORDER(base, 0, bits); 999706f2543Smrg CHECKRETURN(1); 1000706f2543Smrg bits = SHIFT_R(glyphp[1][line],14); 1001706f2543Smrg bits |= SHIFT_L(glyphp[2][line],4); 1002706f2543Smrg bits |= SHIFT_L(glyphp[3][line],22); 1003706f2543Smrg WRITE_IN_BITORDER(base, 1, bits); 1004706f2543Smrg CHECKRETURN(2); 1005706f2543Smrg bits = SHIFT_R(glyphp[3][line],10); 1006706f2543Smrg bits |= SHIFT_L(glyphp[4][line],8); 1007706f2543Smrg bits |= SHIFT_L(glyphp[5][line],26); 1008706f2543Smrg WRITE_IN_BITORDER(base, 2, bits); 1009706f2543Smrg CHECKRETURN(3); 1010706f2543Smrg bits = SHIFT_R(glyphp[5][line],6); 1011706f2543Smrg bits |= SHIFT_L(glyphp[6][line],12); 1012706f2543Smrg bits |= SHIFT_L(glyphp[7][line],30); 1013706f2543Smrg WRITE_IN_BITORDER(base, 3, bits); 1014706f2543Smrg CHECKRETURN(4); 1015706f2543Smrg bits = SHIFT_R(glyphp[7][line],2); 1016706f2543Smrg bits |= SHIFT_L(glyphp[8][line],16); 1017706f2543Smrg WRITE_IN_BITORDER(base, 4, bits); 1018706f2543Smrg CHECKRETURN(5); 1019706f2543Smrg bits = SHIFT_R(glyphp[8][line],16); 1020706f2543Smrg bits |= SHIFT_L(glyphp[9][line],2); 1021706f2543Smrg bits |= SHIFT_L(glyphp[10][line],20); 1022706f2543Smrg WRITE_IN_BITORDER(base, 5, bits); 1023706f2543Smrg CHECKRETURN(6); 1024706f2543Smrg bits = SHIFT_R(glyphp[10][line],12); 1025706f2543Smrg bits |= SHIFT_L(glyphp[11][line],6); 1026706f2543Smrg bits |= SHIFT_L(glyphp[12][line],24); 1027706f2543Smrg WRITE_IN_BITORDER(base, 6, bits); 1028706f2543Smrg CHECKRETURN(7); 1029706f2543Smrg bits = SHIFT_R(glyphp[12][line],8); 1030706f2543Smrg bits |= SHIFT_L(glyphp[13][line],10); 1031706f2543Smrg bits |= SHIFT_L(glyphp[14][line],28); 1032706f2543Smrg WRITE_IN_BITORDER(base, 7, bits); 1033706f2543Smrg CHECKRETURN(8); 1034706f2543Smrg bits = SHIFT_R(glyphp[14][line],4); 1035706f2543Smrg bits |= SHIFT_L(glyphp[15][line],14); 1036706f2543Smrg WRITE_IN_BITORDER(base, 8, bits); 1037706f2543Smrg CHECKRETURN(9); 1038706f2543Smrg#ifndef FIXEDBASE 1039706f2543Smrg base += 9; 1040706f2543Smrg#endif 1041706f2543Smrg width -= 288; 1042706f2543Smrg glyphp += 16; 1043706f2543Smrg } 1044706f2543Smrg return base; 1045706f2543Smrg} 1046706f2543Smrg 1047706f2543Smrg 1048706f2543Smrgstatic CARD32* 1049706f2543SmrgDrawTETextScanlineWidth24( 1050706f2543Smrg CARD32 *base, 1051706f2543Smrg unsigned int **glyphp, 1052706f2543Smrg int line, int width, int glyphwidth ) 1053706f2543Smrg{ 1054706f2543Smrg while (1) { 1055706f2543Smrg unsigned int bits; 1056706f2543Smrg bits = glyphp[0][line]; 1057706f2543Smrg bits |= SHIFT_L(glyphp[1][line],24); 1058706f2543Smrg WRITE_IN_BITORDER(base, 0, bits); 1059706f2543Smrg CHECKRETURN(1); 1060706f2543Smrg bits = SHIFT_R(glyphp[1][line],8); 1061706f2543Smrg bits |= SHIFT_L(glyphp[2][line],16); 1062706f2543Smrg WRITE_IN_BITORDER(base, 1, bits); 1063706f2543Smrg CHECKRETURN(2); 1064706f2543Smrg bits = SHIFT_R(glyphp[2][line],16); 1065706f2543Smrg bits |= SHIFT_L(glyphp[3][line],8); 1066706f2543Smrg WRITE_IN_BITORDER(base, 2, bits); 1067706f2543Smrg CHECKRETURN(3); 1068706f2543Smrg#ifndef FIXEDBASE 1069706f2543Smrg base += 3; 1070706f2543Smrg#endif 1071706f2543Smrg width -= 96; 1072706f2543Smrg glyphp += 4; 1073706f2543Smrg } 1074706f2543Smrg return base; 1075706f2543Smrg} 1076706f2543Smrg 1077706f2543Smrg 1078