Eric Pouech : gdi32: Better error handling in enhanced metafile.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Oct 24 04:55:26 CDT 2006


Module: wine
Branch: master
Commit: bc7df7ad80af9822a7d22d77289d9a13a63bc588
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bc7df7ad80af9822a7d22d77289d9a13a63bc588

Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date:   Sun Oct 22 21:48:19 2006 +0200

gdi32: Better error handling in enhanced metafile.

---

 dlls/gdi32/enhmfdrv/graphics.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/dlls/gdi32/enhmfdrv/graphics.c b/dlls/gdi32/enhmfdrv/graphics.c
index 13b4a06..cf4603b 100644
--- a/dlls/gdi32/enhmfdrv/graphics.c
+++ b/dlls/gdi32/enhmfdrv/graphics.c
@@ -756,18 +756,19 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT
         for (i = 0; i < count; i++) {
             textWidth += lpDx[i];
         }
-        GetTextExtentPoint32W(physDev->hdc, str, count, &strSize);
-        textHeight = strSize.cy;
+        if (GetTextExtentPoint32W(physDev->hdc, str, count, &strSize))
+            textHeight = strSize.cy;
     }
     else {
         UINT i;
         INT *dx = (INT *)((char*)pemr + pemr->emrtext.offDx);
         SIZE charSize;
         for (i = 0; i < count; i++) {
-            GetTextExtentPoint32W(physDev->hdc, str + i, 1, &charSize);
-            dx[i] = charSize.cx;
-            textWidth += charSize.cx;
-            textHeight = max(textHeight, charSize.cy);
+            if (GetTextExtentPoint32W(physDev->hdc, str + i, 1, &charSize)) {
+                dx[i] = charSize.cx;
+                textWidth += charSize.cx;
+                textHeight = max(textHeight, charSize.cy);
+            }
         }
     }
 
@@ -791,7 +792,8 @@ BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT
     switch (textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE)) {
     case TA_BASELINE: {
         TEXTMETRICW tm;
-        GetTextMetricsW(physDev->hdc, &tm);
+        if (!GetTextMetricsW(physDev->hdc, &tm))
+            tm.tmDescent = 0;
         /* Play safe here... it's better to have a bounding box */
         /* that is too big than too small. */
         pemr->rclBounds.top    = y - textHeight - 1;




More information about the wine-cvs mailing list