aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-06-28 22:07:26 +0000
committermarha <marha@users.sourceforge.net>2009-06-28 22:07:26 +0000
commit3562e78743202e43aec8727005182a2558117eca (patch)
tree8f9113a77d12470c5c851a2a8e4cb02e89df7d43 /xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c
downloadvcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.gz
vcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.bz2
vcxsrv-3562e78743202e43aec8727005182a2558117eca.zip
Checked in the following released items:
xkeyboard-config-1.4.tar.gz ttf-bitstream-vera-1.10.tar.gz font-alias-1.0.1.tar.gz font-sun-misc-1.0.0.tar.gz font-sun-misc-1.0.0.tar.gz font-sony-misc-1.0.0.tar.gz font-schumacher-misc-1.0.0.tar.gz font-mutt-misc-1.0.0.tar.gz font-misc-misc-1.0.0.tar.gz font-misc-meltho-1.0.0.tar.gz font-micro-misc-1.0.0.tar.gz font-jis-misc-1.0.0.tar.gz font-isas-misc-1.0.0.tar.gz font-dec-misc-1.0.0.tar.gz font-daewoo-misc-1.0.0.tar.gz font-cursor-misc-1.0.0.tar.gz font-arabic-misc-1.0.0.tar.gz font-winitzki-cyrillic-1.0.0.tar.gz font-misc-cyrillic-1.0.0.tar.gz font-cronyx-cyrillic-1.0.0.tar.gz font-screen-cyrillic-1.0.1.tar.gz font-xfree86-type1-1.0.1.tar.gz font-adobe-utopia-type1-1.0.1.tar.gz font-ibm-type1-1.0.0.tar.gz font-bitstream-type1-1.0.0.tar.gz font-bitstream-speedo-1.0.0.tar.gz font-bh-ttf-1.0.0.tar.gz font-bh-type1-1.0.0.tar.gz font-bitstream-100dpi-1.0.0.tar.gz font-bh-lucidatypewriter-100dpi-1.0.0.tar.gz font-bh-100dpi-1.0.0.tar.gz font-adobe-utopia-100dpi-1.0.1.tar.gz font-adobe-100dpi-1.0.0.tar.gz font-util-1.0.1.tar.gz font-bitstream-75dpi-1.0.0.tar.gz font-bh-lucidatypewriter-75dpi-1.0.0.tar.gz font-adobe-utopia-75dpi-1.0.1.tar.gz font-bh-75dpi-1.0.0.tar.gz bdftopcf-1.0.1.tar.gz font-adobe-75dpi-1.0.0.tar.gz mkfontscale-1.0.6.tar.gz openssl-0.9.8k.tar.gz bigreqsproto-1.0.2.tar.gz xtrans-1.2.2.tar.gz resourceproto-1.0.2.tar.gz inputproto-1.4.4.tar.gz compositeproto-0.4.tar.gz damageproto-1.1.0.tar.gz zlib-1.2.3.tar.gz xkbcomp-1.0.5.tar.gz freetype-2.3.9.tar.gz pthreads-w32-2-8-0-release.tar.gz pixman-0.12.0.tar.gz kbproto-1.0.3.tar.gz evieext-1.0.2.tar.gz fixesproto-4.0.tar.gz recordproto-1.13.2.tar.gz randrproto-1.2.2.tar.gz scrnsaverproto-1.1.0.tar.gz renderproto-0.9.3.tar.gz xcmiscproto-1.1.2.tar.gz fontsproto-2.0.2.tar.gz xextproto-7.0.3.tar.gz xproto-7.0.14.tar.gz libXdmcp-1.0.2.tar.gz libxkbfile-1.0.5.tar.gz libfontenc-1.0.4.tar.gz libXfont-1.3.4.tar.gz libX11-1.1.5.tar.gz libXau-1.0.4.tar.gz libxcb-1.1.tar.gz xorg-server-1.5.3.tar.gz
Diffstat (limited to 'xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c')
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c200
1 files changed, 200 insertions, 0 deletions
diff --git a/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c b/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c
new file mode 100644
index 000000000..556650fb0
--- /dev/null
+++ b/xorg-server/hw/xfree86/xaa/xaaNonTEGlyph.c
@@ -0,0 +1,200 @@
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaacexp.h"
+#include "xf86.h"
+
+/* Not used anymore because the algorithm isn't correct. It doesn't
+ handle overlapping characters properly */
+
+#ifdef TRIPLE_BITS
+#define NonTEGlyphFunc EXPNAME(XAANonTEGlyphScanlineFunc3)
+#else
+#define NonTEGlyphFunc EXPNAME(XAANonTEGlyphScanlineFunc)
+#endif
+
+/********************************************************************
+
+ Here we have NonTEGlyphRenders for a bunch of different color
+ expansion types. The driver may provide its own renderer, but
+ this is the default one which renders using lower-level primitives
+ exported by the chipset driver.
+
+********************************************************************/
+
+/* Since the dimensions of the text string and the backing rectangle
+ do not always coincide, it is possible that wBack or wText
+ may be 0! The NonTEGlyphRender must always check for this. */
+
+/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not,
+ with TRIPLE_BITS or not. A total of 8 versions */
+
+/* if the backing rectangle and text are of the same dimensions
+ then we can draw in one pass */
+
+void
+#ifdef TRIPLE_BITS
+EXPNAME(XAANonTEGlyphRenderer3)(
+#else
+EXPNAME(XAANonTEGlyphRenderer)(
+#endif
+ ScrnInfoPtr pScrn,
+ int xText, int wText,
+ int y, int h, int skipleft, int startline,
+ NonTEGlyphInfo *glyphp,
+ int fg, int rop,
+ unsigned int planemask )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32* base = (CARD32*)infoRec->ColorExpandBase;
+#ifdef TRIPLE_BITS
+ int dwords = ((3 * wText + 31) >> 5) * h;
+#else
+ int dwords = ((wText + 31) >> 5) * h;
+#endif
+
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(
+ pScrn, fg, -1, rop, planemask);
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(
+ pScrn, xText, y, wText, h, 0);
+
+#ifndef FIXEDBASE
+#ifdef TRIPLE_BITS
+ if((((3 * wText + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+#else
+ if((((wText + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+#endif
+ while(h--)
+ base = NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
+ else
+#endif
+ while(h--)
+ NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
+
+ if((infoRec->CPUToScreenColorExpandFillFlags & CPU_TRANSFER_PAD_QWORD) &&
+ (dwords & 1)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+ if(infoRec->CPUToScreenColorExpandFillFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+#ifndef FIXEDBASE
+/* Scanline version of above gets built for LSBFIRST and MSBFIRST */
+
+void
+#ifdef TRIPLE_BITS
+EXPNAME(XAANonTEGlyphRendererScanline3)(
+#else
+EXPNAME(XAANonTEGlyphRendererScanline)(
+#endif
+ ScrnInfoPtr pScrn,
+ int xText, int wText,
+ int y, int h, int skipleft, int startline,
+ NonTEGlyphInfo *glyphp,
+ int fg, int rop,
+ unsigned int planemask )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int bufferNo = 0;
+ CARD32* base;
+
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
+ pScrn, fg, -1, rop, planemask);
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, xText, y, wText, h, 0);
+
+ while(h--) {
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ NonTEGlyphFunc(base, glyphp, startline++, wText, skipleft);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+#endif
+
+/********************************************************************
+
+ Generic NonTE scanline rendering code.
+
+********************************************************************/
+
+
+CARD32*
+NonTEGlyphFunc(
+ CARD32 *base,
+ NonTEGlyphInfo *glyphp,
+ int line, int TotalWidth, int skipleft )
+{
+ CARD32 bits = 0;
+ int shift = glyphp->width;
+
+ if(skipleft) {
+ if((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits = SHIFT_R(glyphp->bitsp[line], skipleft);
+ shift -= skipleft;
+ } else if((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits = glyphp->bitsp[line];
+
+
+ while(TotalWidth > 32) {
+ while(shift < 32) {
+ glyphp++;
+ if((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits |= SHIFT_L(glyphp->bitsp[line],shift);
+ shift += glyphp->width;
+ }
+#ifdef TRIPLE_BITS
+ WRITE_BITS3(bits);
+#else
+ WRITE_BITS(bits);
+#endif
+ shift &= 31;
+ if(shift &&
+ (line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits = SHIFT_R(glyphp->bitsp[line], glyphp->width - shift);
+ else bits = 0;
+ TotalWidth -= 32;
+ }
+
+ if(TotalWidth) {
+ TotalWidth -= shift;
+ while(TotalWidth > 0) {
+ glyphp++;
+ if((line >= glyphp->firstline) && (line <= glyphp->lastline))
+ bits |= SHIFT_L(glyphp->bitsp[line], shift);
+ shift += glyphp->width;
+ TotalWidth -= glyphp->width;
+ }
+#ifdef TRIPLE_BITS
+ if (shift >= 22) {
+ WRITE_BITS3(bits);
+ } else if (shift >= 11) {
+ WRITE_BITS2(bits);
+ } else {
+ WRITE_BITS1(bits);
+ }
+#else
+ WRITE_BITS(bits);
+#endif
+ }
+
+
+ return base;
+}
+
+
+
+