diff options
author | dglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-19 23:31:27 +0000 |
---|---|---|
committer | dglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-19 23:31:27 +0000 |
commit | c3846eb7697b750be87bbb9330f118046a0da211 (patch) | |
tree | 2397cd0b3583ca96f5527e184e27aaa7634d0a73 /webkit/port | |
parent | 2b2d8447b83112a01dd61c2979b683a699d3d775 (diff) | |
download | chromium_src-c3846eb7697b750be87bbb9330f118046a0da211.zip chromium_src-c3846eb7697b750be87bbb9330f118046a0da211.tar.gz chromium_src-c3846eb7697b750be87bbb9330f118046a0da211.tar.bz2 |
De-basify SkiaFontwin
Review URL: http://codereview.chromium.org/15091
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r-- | webkit/port/platform/graphics/skia/SkiaFontWin.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/webkit/port/platform/graphics/skia/SkiaFontWin.cpp b/webkit/port/platform/graphics/skia/SkiaFontWin.cpp index 744494f..28ac5ab 100644 --- a/webkit/port/platform/graphics/skia/SkiaFontWin.cpp +++ b/webkit/port/platform/graphics/skia/SkiaFontWin.cpp @@ -4,8 +4,6 @@ #include <windows.h> -#include "base/basictypes.h" - #include "WTF/ListHashSet.h" #include "WTF/Vector.h" @@ -38,7 +36,9 @@ const bool operator==(const CachedOutlineKey& a, const CachedOutlineKey& b) struct CachedOutlineKeyHash { static unsigned hash(const CachedOutlineKey& key) { - return bit_cast<unsigned>(key.font) + key.glyph; + unsigned keyBytes; + memcpy(&keyBytes, &key.font, sizeof(unsigned)); + return keyBytes + key.glyph; } static unsigned equal(const CachedOutlineKey& a, @@ -58,12 +58,17 @@ const int outlineCacheSize = 256; inline FIXED SkScalarToFIXED(SkScalar x) { - return bit_cast<FIXED>(SkScalarToFixed(x)); + FIXED fixed; + SkFixed skFixed = SkScalarToFixed(x); + memcpy(&fixed, &skFixed, sizeof(FIXED)); + return fixed; } inline SkScalar FIXEDToSkScalar(FIXED fixed) { - return SkFixedToScalar(bit_cast<SkFixed>(fixed)); + SkFixed skFixed; + memcpy(&skFixed, &fixed, sizeof(SkFixed)); + return SkFixedToScalar(skFixed); } // Removes the given key from the cached outlines, also deleting the path. @@ -109,16 +114,19 @@ void AddPolyCurveToPath(const TTPOLYCURVE* polyCurve, SkPath* path) } } +// The size of the glyph outline buffer. +const int glyphPathBufferSize = 4096; + // Fills the given SkPath with the outline for the given glyph index. The font // currently selected into the given DC is used. Returns true on success. bool GetPathForGlyph(HDC dc, WORD glyph, SkPath* path) { - char buffer[4096]; + char buffer[glyphPathBufferSize]; GLYPHMETRICS gm; MAT2 mat = {{0, 1}, {0, 0}, {0, 0}, {0, 1}}; // Each one is (fract,value). DWORD totalSize = GetGlyphOutlineW(dc, glyph, GGO_GLYPH_INDEX | GGO_NATIVE, - &gm, arraysize(buffer), buffer, &mat); + &gm, glyphPathBufferSize, buffer, &mat); if (totalSize == GDI_ERROR) return false; |