static BOOL RenderingEnabled = TRUE;
#define MAX_FONT_CACHE 256
-UINT Hits;
-UINT Misses;
typedef struct _FONT_CACHE_ENTRY
{
PLIST_ENTRY CurrentEntry;
PFONT_CACHE_ENTRY FontEntry;
-// DbgPrint("CacheGet\n");
-
CurrentEntry = FontCacheListHead.Flink;
while (CurrentEntry != &FontCacheListHead)
{
if (CurrentEntry == &FontCacheListHead)
{
-// DbgPrint("Miss! %x\n", FontEntry->Glyph);
- /*
- Misses++;
- if (Misses>100) {
- DbgPrint ("Hits: %d Misses: %d\n", Hits, Misses);
- Hits = Misses = 0;
- }
- */
return NULL;
}
RemoveEntryList(CurrentEntry);
InsertHeadList(&FontCacheListHead, CurrentEntry);
-
-// DbgPrint("Hit! %x\n", FontEntry->Glyph);
- /*
- Hits++;
-
- if (Hits>100) {
- DbgPrint ("Hits: %d Misses: %d\n", Hits, Misses);
- Hits = Misses = 0;
- }
- */
return FontEntry->Glyph;
}
INT error;
PFONT_CACHE_ENTRY NewEntry;
-// DbgPrint("CacheSet.\n");
-
error = FT_Get_Glyph(GlyphSlot, &GlyphCopy);
if (error)
{
- DbgPrint("Failure caching glyph.\n");
+ DPRINT1("Failure caching glyph.\n");
return NULL;
};
error = FT_Glyph_To_Bitmap(&GlyphCopy, RenderMode, 0, 1);
if (error)
{
- DbgPrint("Failure rendering glyph.\n");
+ DPRINT1("Failure rendering glyph.\n");
return NULL;
};
NewEntry = ExAllocatePoolWithTag(PagedPool, sizeof(FONT_CACHE_ENTRY), TAG_FONT);
if (!NewEntry)
{
- DbgPrint("Alloc failure caching glyph.\n");
+ DPRINT1("Alloc failure caching glyph.\n");
FT_Done_Glyph(GlyphCopy);
return NULL;
}
FontCacheNumEntries--;
}
-// DbgPrint("Returning the glyphcopy: %x\n", GlyphCopy);
-
return GlyphCopy;
}
BOOL bIgnoreRotation)
{
static const FT_Matrix identityMat = {(1 << 16), 0, 0, (1 << 16)};
- PDC_ATTR Dc_Attr;
+ PDC_ATTR pdcattr;
PTEXTOBJ TextObj;
PFONTGDI FontGDI;
HFONT hFont = 0;
DPRINT("%d, %08x, %p, %08lx, %p, %p\n", wch, iFormat, pgm,
cjBuf, pvBuf, pmat2);
- Dc_Attr = dc->pDc_Attr;
- if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+ pdcattr = dc->pdcattr;
- MatrixS2XForm(&xForm, &dc->DcLevel.mxWorldToDevice);
+ MatrixS2XForm(&xForm, &dc->dclevel.mxWorldToDevice);
eM11 = xForm.eM11;
- hFont = Dc_Attr->hlfntNew;
+ hFont = pdcattr->hlfntNew;
TextObj = RealizeFontInit(hFont);
if (!TextObj)
LPFONTSIGNATURE lpSig,
DWORD dwFlags)
{
- PDC_ATTR Dc_Attr;
+ PDC_ATTR pdcattr;
UINT Ret = DEFAULT_CHARSET, i;
HFONT hFont;
PTEXTOBJ TextObj;
DWORD cp, fs0;
USHORT usACP, usOEM;
- Dc_Attr = Dc->pDc_Attr;
- if (!Dc_Attr) Dc_Attr = &Dc->Dc_Attr;
- hFont = Dc_Attr->hlfntNew;
+ pdcattr = Dc->pdcattr;
+ hFont = pdcattr->hlfntNew;
TextObj = RealizeFontInit(hFont);
if (!TextObj)
PTMW_INTERNAL ptmwi)
{
PDC dc;
- PDC_ATTR Dc_Attr;
+ PDC_ATTR pdcattr;
PTEXTOBJ TextObj;
PFONTGDI FontGDI;
FT_Face Face;
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
- Dc_Attr = dc->pDc_Attr;
- if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
- TextObj = RealizeFontInit(Dc_Attr->hlfntNew);
+ pdcattr = dc->pdcattr;
+ TextObj = RealizeFontInit(pdcattr->hlfntNew);
if (NULL != TextObj)
{
FontGDI = ObjToGDI(TextObj->Font, FONT);
IN INT XStart,
IN INT YStart,
IN UINT fuOptions,
- IN OPTIONAL LPRECT lprc,
+ IN OPTIONAL PRECTL lprc,
IN LPWSTR String,
IN INT Count,
IN OPTIONAL LPINT Dx,
*/
DC *dc;
- PDC_ATTR Dc_Attr;
+ PDC_ATTR pdcattr;
SURFOBJ *SurfObj;
SURFACE *psurf = NULL;
int error, glyph_index, n, i;
FT_Bool use_kerning;
RECTL DestRect, MaskRect;
POINTL SourcePoint, BrushOrigin;
- HBRUSH hBrushFg = NULL;
- PGDIBRUSHOBJ BrushFg = NULL;
- GDIBRUSHINST BrushFgInst;
- HBRUSH hBrushBg = NULL;
- PGDIBRUSHOBJ BrushBg = NULL;
- GDIBRUSHINST BrushBgInst;
HBITMAP HSourceGlyph;
SURFOBJ *SourceGlyphSurf;
SIZEL bitSize;
FONTOBJ *FontObj;
PFONTGDI FontGDI;
PTEXTOBJ TextObj = NULL;
- PPALGDI PalDestGDI;
XLATEOBJ *XlateObj=NULL, *XlateObj2=NULL;
- ULONG Mode;
FT_Render_Mode RenderMode;
BOOLEAN Render;
POINT Start;
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
- if (dc->DC_Type == DC_TYPE_INFO)
+ if (dc->dctype == DC_TYPE_INFO)
{
DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */
return TRUE;
}
- Dc_Attr = dc->pDc_Attr;
- if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
+ pdcattr = dc->pdcattr;
+
+ if (pdcattr->ulDirty_ & DIRTY_TEXT)
+ DC_vUpdateTextBrush(dc);
+
+ if ((fuOptions & ETO_OPAQUE) || pdcattr->jBkMode == OPAQUE)
+ {
+ if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
+ DC_vUpdateBackgroundBrush(dc);
+ }
/* Check if String is valid */
if ((Count > 0xFFFF) || (Count > 0 && String == NULL))
DxShift = fuOptions & ETO_PDY ? 1 : 0;
- if (PATH_IsPathOpen(dc->DcLevel))
+ if (PATH_IsPathOpen(dc->dclevel))
{
if (!PATH_ExtTextOut( dc,
XStart,
YStart,
fuOptions,
- (const RECT *)lprc,
+ (const RECTL *)lprc,
String,
Count,
(const INT *)Dx)) goto fail;
IntLPtoDP(dc, (POINT *)lprc, 2);
}
- psurf = SURFACE_LockSurface(dc->w.hBitmap);
+ psurf = SURFACE_LockSurface(dc->rosdc.hBitmap);
if (!psurf)
{
goto fail;
}
SurfObj = &psurf->SurfObj;
- ASSERT(SurfObj);
Start.x = XStart;
Start.y = YStart;
/* Create the brushes */
hDestPalette = psurf->hDIBPalette;
if (!hDestPalette) hDestPalette = pPrimarySurface->DevInfo.hpalDefault;
- PalDestGDI = PALETTE_LockPalette(hDestPalette);
- if ( !PalDestGDI )
- Mode = PAL_RGB;
- else
- {
- Mode = PalDestGDI->Mode;
- PALETTE_UnlockPalette(PalDestGDI);
- }
- XlateObj = (XLATEOBJ*)IntEngCreateXlate(Mode, PAL_RGB, hDestPalette, NULL);
+ XlateObj = (XLATEOBJ*)IntEngCreateXlate(0, PAL_RGB, hDestPalette, NULL);
if ( !XlateObj )
{
goto fail;
}
- hBrushFg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, Dc_Attr->crForegroundClr), 0);
- if ( !hBrushFg )
- {
- goto fail;
- }
- BrushFg = BRUSHOBJ_LockBrush(hBrushFg);
- if ( !BrushFg )
- {
- goto fail;
- }
- IntGdiInitBrushInstance(&BrushFgInst, BrushFg, NULL);
- if ((fuOptions & ETO_OPAQUE) || Dc_Attr->jBkMode == OPAQUE)
- {
- hBrushBg = NtGdiCreateSolidBrush(XLATEOBJ_iXlate(XlateObj, Dc_Attr->crBackgroundClr), 0);
- if ( !hBrushBg )
- {
- goto fail;
- }
- BrushBg = BRUSHOBJ_LockBrush(hBrushBg);
- if ( !BrushBg )
- {
- goto fail;
- }
- IntGdiInitBrushInstance(&BrushBgInst, BrushBg, NULL);
- }
- XlateObj2 = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, Mode, NULL, hDestPalette);
+ XlateObj2 = (XLATEOBJ*)IntEngCreateXlate(PAL_RGB, 0, NULL, hDestPalette);
if ( !XlateObj2 )
{
goto fail;
if ((fuOptions & ETO_OPAQUE) && lprc)
{
- DestRect.left = lprc->left + dc->ptlDCOrig.x;
- DestRect.top = lprc->top + dc->ptlDCOrig.y;
- DestRect.right = lprc->right + dc->ptlDCOrig.x;
- DestRect.bottom = lprc->bottom + dc->ptlDCOrig.y;
+ DestRect.left = lprc->left;
+ DestRect.top = lprc->top;
+ DestRect.right = lprc->right;
+ DestRect.bottom = lprc->bottom;
+
IntLPtoDP(dc, (LPPOINT)&DestRect, 2);
+
+ DestRect.left += dc->ptlDCOrig.x;
+ DestRect.top += dc->ptlDCOrig.y;
+ DestRect.right += dc->ptlDCOrig.x;
+ DestRect.bottom += dc->ptlDCOrig.y;
+
IntEngBitBlt(
&psurf->SurfObj,
NULL,
NULL,
- dc->CombinedClip,
+ dc->rosdc.CombinedClip,
NULL,
&DestRect,
&SourcePoint,
&SourcePoint,
- &BrushBgInst.BrushObject,
+ &dc->eboBackground.BrushObject,
&BrushOrigin,
ROP3_TO_ROP4(PATCOPY));
fuOptions &= ~ETO_OPAQUE;
}
else
{
- if (Dc_Attr->jBkMode == OPAQUE)
+ if (pdcattr->jBkMode == OPAQUE)
{
fuOptions |= ETO_OPAQUE;
}
}
- TextObj = RealizeFontInit(Dc_Attr->hlfntNew);
+ TextObj = RealizeFontInit(pdcattr->hlfntNew);
if (TextObj == NULL)
{
goto fail;
* Process the vertical alignment and determine the yoff.
*/
- if (Dc_Attr->lTextAlign & TA_BASELINE)
+ if (pdcattr->lTextAlign & TA_BASELINE)
yoff = 0;
- else if (Dc_Attr->lTextAlign & TA_BOTTOM)
+ else if (pdcattr->lTextAlign & TA_BOTTOM)
yoff = -face->size->metrics.descender >> 6;
else /* TA_TOP */
yoff = face->size->metrics.ascender >> 6;
* Process the horizontal alignment and modify XStart accordingly.
*/
- if (Dc_Attr->lTextAlign & (TA_RIGHT | TA_CENTER))
+ if (pdcattr->lTextAlign & (TA_RIGHT | TA_CENTER))
{
ULONGLONG TextWidth = 0;
LPCWSTR TempText = String;
previous = 0;
- if (Dc_Attr->lTextAlign & TA_RIGHT)
+ if (pdcattr->lTextAlign & TA_RIGHT)
{
RealXStart -= TextWidth;
}
goto fail;
}
}
-// DbgPrint("realglyph: %x\n", realglyph);
-// DbgPrint("TextLeft: %d\n", TextLeft);
/* retrieve kerning distance and move pen position */
if (use_kerning && previous && glyph_index && NULL == Dx)
FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
TextLeft += delta.x;
}
-// DPRINT1("TextLeft: %d\n", TextLeft);
-// DPRINT1("TextTop: %d\n", TextTop);
+ DPRINT("TextLeft: %d\n", TextLeft);
+ DPRINT("TextTop: %d\n", TextTop);
if (realglyph->format == ft_glyph_format_outline)
{
- DbgPrint("Should already be done\n");
+ DPRINT1("Should already be done\n");
// error = FT_Render_Glyph(glyph, RenderMode);
error = FT_Glyph_To_Bitmap(&realglyph, RenderMode, 0, 0);
if (error)
}
realglyph2 = (FT_BitmapGlyph)realglyph;
-// DPRINT1("Pitch: %d\n", pitch);
-// DPRINT1("Advance: %d\n", realglyph->advance.x);
+ DPRINT("Advance: %d\n", realglyph->advance.x);
if (fuOptions & ETO_OPAQUE)
{
&psurf->SurfObj,
NULL,
NULL,
- dc->CombinedClip,
+ dc->rosdc.CombinedClip,
NULL,
&DestRect,
&SourcePoint,
&SourcePoint,
- &BrushBgInst.BrushObject,
+ &dc->eboBackground.BrushObject,
&BrushOrigin,
ROP3_TO_ROP4(PATCOPY));
BackgroundLeft = DestRect.right;
IntEngMaskBlt(
SurfObj,
SourceGlyphSurf,
- dc->CombinedClip,
+ dc->rosdc.CombinedClip,
XlateObj,
XlateObj2,
&DestRect,
- &SourcePoint,
(PPOINTL)&MaskRect,
- &BrushFgInst.BrushObject,
+ &dc->eboText.BrushObject,
&BrushOrigin);
EngUnlockSurface(SourceGlyphSurf);
if (NULL == Dx)
{
TextLeft += realglyph->advance.x >> 10;
-// DbgPrint("new TextLeft: %d\n", TextLeft);
+ DPRINT("new TextLeft: %d\n", TextLeft);
}
else
{
TextLeft += Dx[i<<DxShift] << 6;
-// DbgPrint("new TextLeft2: %d\n", TextLeft);
+ DPRINT("new TextLeft2: %d\n", TextLeft);
}
if (DxShift)
SURFACE_UnlockSurface(psurf);
if (TextObj != NULL)
TEXTOBJ_UnlockText(TextObj);
- if (hBrushBg != NULL)
- {
- BRUSHOBJ_UnlockBrush(BrushBg);
- NtGdiDeleteObject(hBrushBg);
- }
- BRUSHOBJ_UnlockBrush(BrushFg);
- NtGdiDeleteObject(hBrushFg);
good:
DC_UnlockDc( dc );
TEXTOBJ_UnlockText(TextObj);
if (psurf != NULL)
SURFACE_UnlockSurface(psurf);
- if (hBrushBg != NULL)
- {
- BRUSHOBJ_UnlockBrush(BrushBg);
- NtGdiDeleteObject(hBrushBg);
- }
- if (hBrushFg != NULL)
- {
- BRUSHOBJ_UnlockBrush(BrushFg);
- NtGdiDeleteObject(hBrushFg);
- }
DC_UnlockDc(dc);
return FALSE;
{
BOOL Result = FALSE;
NTSTATUS Status = STATUS_SUCCESS;
- RECT SafeRect;
+ RECTL SafeRect;
BYTE LocalBuffer[STACK_TEXT_BUFFER_SIZE];
PVOID Buffer = LocalBuffer;
LPWSTR SafeString = NULL;
LPABC SafeBuff;
LPABCFLOAT SafeBuffF = NULL;
PDC dc;
- PDC_ATTR Dc_Attr;
+ PDC_ATTR pdcattr;
PTEXTOBJ TextObj;
PFONTGDI FontGDI;
FT_Face face;
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
- Dc_Attr = dc->pDc_Attr;
- if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
- hFont = Dc_Attr->hlfntNew;
+ pdcattr = dc->pdcattr;
+ hFont = pdcattr->hlfntNew;
TextObj = RealizeFontInit(hFont);
DC_UnlockDc(dc);
LPINT SafeBuff;
PFLOAT SafeBuffF = NULL;
PDC dc;
- PDC_ATTR Dc_Attr;
+ PDC_ATTR pdcattr;
PTEXTOBJ TextObj;
PFONTGDI FontGDI;
FT_Face face;
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
- Dc_Attr = dc->pDc_Attr;
- if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
- hFont = Dc_Attr->hlfntNew;
+ pdcattr = dc->pdcattr;
+ hFont = pdcattr->hlfntNew;
TextObj = RealizeFontInit(hFont);
DC_UnlockDc(dc);
IN DWORD iMode)
{
PDC dc;
- PDC_ATTR Dc_Attr;
+ PDC_ATTR pdcattr;
PTEXTOBJ TextObj;
PFONTGDI FontGDI;
HFONT hFont = 0;
SetLastWin32Error(ERROR_INVALID_HANDLE);
return GDI_ERROR;
}
- Dc_Attr = dc->pDc_Attr;
- if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
- hFont = Dc_Attr->hlfntNew;
+ pdcattr = dc->pdcattr;
+ hFont = pdcattr->hlfntNew;
TextObj = RealizeFontInit(hFont);
DC_UnlockDc(dc);
if (!TextObj)