Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1234)

Unified Diff: Source/core/platform/graphics/skia/FontPlatformDataSkia.cpp

Issue 24874002: Have all skia platforms share FontPlatformData::hash() implementation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/graphics/skia/FontPlatformDataSkia.cpp
diff --git a/Source/core/platform/graphics/skia/FontPlatformDataSkia.cpp b/Source/core/platform/graphics/skia/FontPlatformDataSkia.cpp
index 33c5662efae83bd65b5dfbc3e2a399c09e17346b..f5dfd8fe2c55491d5dd5f3ffb7a6af85e196e2b7 100644
--- a/Source/core/platform/graphics/skia/FontPlatformDataSkia.cpp
+++ b/Source/core/platform/graphics/skia/FontPlatformDataSkia.cpp
@@ -37,6 +37,24 @@
namespace WebCore {
+#if (!ENABLE(GDI_FONTS_ON_WINDOWS) || !OS(WIN)) && !OS(MACOSX)
+unsigned FontPlatformData::hash() const
+{
+ unsigned h = SkTypeface::UniqueID(m_typeface.get());
+ h ^= 0x01010101 * ((static_cast<int>(m_orientation) << 2) | (static_cast<int>(m_fakeBold) << 1) | static_cast<int>(m_fakeItalic));
+
+ // This memcpy is to avoid a reinterpret_cast that breaks strict-aliasing
+ // rules. Memcpy is generally optimized enough so that performance doesn't
+ // matter here.
+ uint32_t textSizeBytes;
+ memcpy(&textSizeBytes, &m_textSize, sizeof(uint32_t));
+ h ^= textSizeBytes;
+
+ return h;
+}
+
+#endif
+
#if ENABLE(OPENTYPE_VERTICAL)
PassRefPtr<OpenTypeVerticalData> FontPlatformData::verticalData() const
{
« no previous file with comments | « Source/core/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698