OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 233 |
234 return typefacesEqual | 234 return typefacesEqual |
235 && m_textSize == a.m_textSize | 235 && m_textSize == a.m_textSize |
236 && m_fakeBold == a.m_fakeBold | 236 && m_fakeBold == a.m_fakeBold |
237 && m_fakeItalic == a.m_fakeItalic | 237 && m_fakeItalic == a.m_fakeItalic |
238 && m_orientation == a.m_orientation | 238 && m_orientation == a.m_orientation |
239 && m_style == a.m_style | 239 && m_style == a.m_style |
240 && m_isHashTableDeletedValue == a.m_isHashTableDeletedValue; | 240 && m_isHashTableDeletedValue == a.m_isHashTableDeletedValue; |
241 } | 241 } |
242 | 242 |
243 unsigned FontPlatformData::hash() const | |
244 { | |
245 unsigned h = SkTypeface::UniqueID(m_typeface.get()); | |
246 h ^= 0x01010101 * ((static_cast<int>(m_orientation) << 2) | (static_cast<int
>(m_fakeBold) << 1) | static_cast<int>(m_fakeItalic)); | |
247 | |
248 // This memcpy is to avoid a reinterpret_cast that breaks strict-aliasing | |
249 // rules. Memcpy is generally optimized enough so that performance doesn't | |
250 // matter here. | |
251 uint32_t textSizeBytes; | |
252 memcpy(&textSizeBytes, &m_textSize, sizeof(uint32_t)); | |
253 h ^= textSizeBytes; | |
254 | |
255 return h; | |
256 } | |
257 | |
258 bool FontPlatformData::isFixedPitch() const | 243 bool FontPlatformData::isFixedPitch() const |
259 { | 244 { |
260 notImplemented(); | 245 notImplemented(); |
261 return false; | 246 return false; |
262 } | 247 } |
263 | 248 |
264 HarfBuzzFace* FontPlatformData::harfBuzzFace() const | 249 HarfBuzzFace* FontPlatformData::harfBuzzFace() const |
265 { | 250 { |
266 if (!m_harfBuzzFace) | 251 if (!m_harfBuzzFace) |
267 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this
), uniqueID()); | 252 m_harfBuzzFace = HarfBuzzFace::create(const_cast<FontPlatformData*>(this
), uniqueID()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 m_style.useAutoHint = useSkiaAutoHint; | 291 m_style.useAutoHint = useSkiaAutoHint; |
307 if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference) | 292 if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference) |
308 m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; | 293 m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; |
309 if (m_style.useAntiAlias == FontRenderStyle::NoPreference) | 294 if (m_style.useAntiAlias == FontRenderStyle::NoPreference) |
310 m_style.useAntiAlias = useSkiaAntiAlias; | 295 m_style.useAntiAlias = useSkiaAntiAlias; |
311 if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference) | 296 if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference) |
312 m_style.useSubpixelRendering = useSkiaSubpixelRendering; | 297 m_style.useSubpixelRendering = useSkiaSubpixelRendering; |
313 } | 298 } |
314 | 299 |
315 } // namespace WebCore | 300 } // namespace WebCore |
OLD | NEW |