Fix undefined behavior in DirectWrite GDI compatible metrics.
GetGdiCompatibleGlyphMetrics checks the matrix passed to it.
If the matrix has any NaNs or INFs or otherwise looks bad, it returns
E_INVALIDARG and so the advances will be zero.
BUG=skia:2579
R=reed@google.com
Review URL: https://codereview.chromium.org/298863002
git-svn-id: http://skia.googlecode.com/svn/trunk@14829 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/utils/win/SkHRESULT.cpp b/src/utils/win/SkHRESULT.cpp
index 111cb76..495f074 100644
--- a/src/utils/win/SkHRESULT.cpp
+++ b/src/utils/win/SkHRESULT.cpp
@@ -9,10 +9,11 @@
#include "SkHRESULT.h"
-void SkTraceHR(const char* file, unsigned long line,
- HRESULT hr, const char* msg) {
- SkDEBUGCODE(if (NULL != msg) SkDEBUGF(("%s\n", msg)));
- SkDEBUGF(("%s(%lu) : error 0x%x: ", file, line, hr));
+void SkTraceHR(const char* file, unsigned long line, HRESULT hr, const char* msg) {
+ if (NULL != msg) {
+ SkDebugf("%s\n", msg);
+ }
+ SkDebugf("%s(%lu) : error 0x%x: ", file, line, hr);
LPSTR errorText = NULL;
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
@@ -27,9 +28,9 @@
);
if (NULL == errorText) {
- SkDEBUGF(("<unknown>\n"));
+ SkDebugf("<unknown>\n");
} else {
- SkDEBUGF(("%s", errorText));
+ SkDebugf("%s", errorText);
LocalFree(errorText);
errorText = NULL;
}