Add debug trap to track down crash.

Original CL by arthurhsu: http://codereview.appspot.com/5144046/

BUG=CR 94421

Review URL: http://codereview.appspot.com/5132051

git-svn-id: http://skia.googlecode.com/svn/trunk@2344 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
vandebo@chromium.org 2011-09-27 19:49:57 +00:00
parent f65dfbf4e5
commit f8897e8d5b

View File

@ -978,12 +978,22 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
OUTLINETEXTMETRIC otm;
if (!GetOutlineTextMetrics(hdc, sizeof(otm), &otm) ||
!GetTextFace(hdc, LF_FACESIZE, lf.lfFaceName)) {
// TODO(arthurhsu): remove after resolving http://crbug.com/94421
DWORD error_code = GetLastError();
SK_DEBUGBREAK(error_code == 0); // Possibly caused by sandboxing.
SK_DEBUGBREAK(false); // GDI corruption.
goto Error;
}
lf.lfHeight = -SkToS32(otm.otmEMSquare);
designFont = CreateFontIndirect(&lf);
SelectObject(hdc, designFont);
if (!GetOutlineTextMetrics(hdc, sizeof(otm), &otm)) {
// TODO(arthurhsu): remove after resolving http://crbug.com/94421
DWORD error_code = GetLastError();
SK_DEBUGBREAK(error_code == 0); // Possibly caused by sandboxing.
SK_DEBUGBREAK(false); // GDI corruption.
goto Error;
}
const unsigned glyphCount = calculateGlyphCount(hdc);