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

Side by Side Diff: Source/platform/fonts/shaping/HarfBuzzShaper.cpp

Issue 813883002: replace COMPILE_ASSERT with static_assert in platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: final fixups Created 6 years 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 unified diff | Download patch
« no previous file with comments | « Source/platform/fonts/FontWidthVariant.h ('k') | Source/platform/fonts/skia/FontCacheSkia.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 Google Inc. All rights reserved. 2 * Copyright (c) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 startCharacter, endCharacter - startCharacter, 795 startCharacter, endCharacter - startCharacter,
796 TextDirectionToHBDirection(m_run.direction(), m_font->fontDescription(). orientation(), fontData), 796 TextDirectionToHBDirection(m_run.direction(), m_font->fontDescription(). orientation(), fontData),
797 ICUScriptToHBScript(script))); 797 ICUScriptToHBScript(script)));
798 } 798 }
799 799
800 static const uint16_t* toUint16(const UChar* src) 800 static const uint16_t* toUint16(const UChar* src)
801 { 801 {
802 // FIXME: This relies on undefined behavior however it works on the 802 // FIXME: This relies on undefined behavior however it works on the
803 // current versions of all compilers we care about and avoids making 803 // current versions of all compilers we care about and avoids making
804 // a copy of the string. 804 // a copy of the string.
805 COMPILE_ASSERT(sizeof(UChar) == sizeof(uint16_t), UChar_is_the_same_size_as_ uint16_t); 805 static_assert(sizeof(UChar) == sizeof(uint16_t), "UChar should be the same s ize as uint16_t");
806 return reinterpret_cast<const uint16_t*>(src); 806 return reinterpret_cast<const uint16_t*>(src);
807 } 807 }
808 808
809 bool HarfBuzzShaper::shapeHarfBuzzRuns() 809 bool HarfBuzzShaper::shapeHarfBuzzRuns()
810 { 810 {
811 HarfBuzzScopedPtr<hb_buffer_t> harfBuzzBuffer(hb_buffer_create(), hb_buffer_ destroy); 811 HarfBuzzScopedPtr<hb_buffer_t> harfBuzzBuffer(hb_buffer_create(), hb_buffer_ destroy);
812 812
813 HarfBuzzRunCache& runCache = harfBuzzRunCache(); 813 HarfBuzzRunCache& runCache = harfBuzzRunCache();
814 const FontDescription& fontDescription = m_font->fontDescription(); 814 const FontDescription& fontDescription = m_font->fontDescription();
815 const String& localeString = fontDescription.locale(); 815 const String& localeString = fontDescription.locale();
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 // possibly invalid from, to arguments. 1144 // possibly invalid from, to arguments.
1145 if (!foundToX && !foundFromX) 1145 if (!foundToX && !foundFromX)
1146 fromX = toX = 0; 1146 fromX = toX = 0;
1147 1147
1148 if (fromX < toX) 1148 if (fromX < toX)
1149 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); 1149 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height);
1150 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); 1150 return FloatRect(point.x() + toX, point.y(), fromX - toX, height);
1151 } 1151 }
1152 1152
1153 } // namespace blink 1153 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/FontWidthVariant.h ('k') | Source/platform/fonts/skia/FontCacheSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698