oleaut32: Get rid of duplicated condition check.

This commit is contained in:
Nikolay Sivov 2011-08-21 13:40:32 +04:00 committed by Alexandre Julliard
parent c69be3bfb9
commit e800158ab0
1 changed files with 84 additions and 87 deletions

View File

@ -583,8 +583,6 @@ static int CALLBACK font_enum_proc(const LOGFONTW *elf, const TEXTMETRICW *ntm,
}
static void realize_font(OLEFontImpl *This)
{
if (This->dirty)
{
LOGFONTW logFont;
INT fontHeight;
@ -593,6 +591,8 @@ static void realize_font(OLEFontImpl *This)
HFONT old_font;
TEXTMETRICW tm;
if (!This->dirty) return;
text_face[0] = 0;
if(This->gdiFont)
@ -621,7 +621,6 @@ static void realize_font(OLEFontImpl *This)
if(data.avail_cs != -1) logFont.lfCharSet = data.avail_cs;
}
/*
* The height of the font returned by the get_Size property is the
* height of the font in points multiplied by 10000... Using some
@ -634,7 +633,6 @@ static void realize_font(OLEFontImpl *This)
fontHeight = MulDiv( This->description.cySize.s.Lo, This->cyLogical*635, This->cyHimetric*18 );
logFont.lfHeight = ((fontHeight%10000L)>5000L) ? (-fontHeight/10000L) - 1 :
(-fontHeight/10000L);
logFont.lfItalic = This->description.fItalic;
@ -666,7 +664,6 @@ static void realize_font(OLEFontImpl *This)
This->nRealHeight = tm.tmHeight - tm.tmInternalLeading; /* corresponds to LOGFONT lfHeight */
SelectObject(hdc, old_font);
}
}
/************************************************************************
* OLEFontImpl_get_Name (IFont)
@ -683,7 +680,7 @@ static HRESULT WINAPI OLEFontImpl_get_Name(
if (pname==0)
return E_POINTER;
if(this->dirty) realize_font(this);
realize_font(this);
if (this->description.lpstrName!=0)
*pname = SysAllocString(this->description.lpstrName);
@ -741,7 +738,7 @@ static HRESULT WINAPI OLEFontImpl_get_Size(
if (!psize) return E_POINTER;
if(this->dirty) realize_font(this);
realize_font(this);
/*
* Convert realized font height in pixels to points descaled by current
@ -785,7 +782,7 @@ static HRESULT WINAPI OLEFontImpl_get_Bold(
if (!pbold) return E_POINTER;
if(this->dirty) realize_font(this);
realize_font(this);
*pbold = this->description.sWeight > 550;
@ -820,7 +817,7 @@ static HRESULT WINAPI OLEFontImpl_get_Italic(
if (pitalic==0)
return E_POINTER;
if(this->dirty) realize_font(this);
realize_font(this);
*pitalic = this->description.fItalic;
@ -856,7 +853,7 @@ static HRESULT WINAPI OLEFontImpl_get_Underline(
if (punderline==0)
return E_POINTER;
if(this->dirty) realize_font(this);
realize_font(this);
*punderline = this->description.fUnderline;
@ -892,7 +889,7 @@ static HRESULT WINAPI OLEFontImpl_get_Strikethrough(
if (pstrikethrough==0)
return E_POINTER;
if(this->dirty) realize_font(this);
realize_font(this);
*pstrikethrough = this->description.fStrikethrough;
@ -928,7 +925,7 @@ static HRESULT WINAPI OLEFontImpl_get_Weight(
if (pweight==0)
return E_POINTER;
if(this->dirty) realize_font(this);
realize_font(this);
*pweight = this->description.sWeight;
@ -964,7 +961,7 @@ static HRESULT WINAPI OLEFontImpl_get_Charset(
if (pcharset==0)
return E_POINTER;
if(this->dirty) realize_font(this);
realize_font(this);
*pcharset = this->description.sCharset;
@ -999,7 +996,7 @@ static HRESULT WINAPI OLEFontImpl_get_hFont(
if (phfont==NULL)
return E_POINTER;
if(this->dirty) realize_font(this);
realize_font(this);
*phfont = this->gdiFont;
TRACE("Returning %p\n", *phfont);