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

Side by Side Diff: Source/platform/fonts/SimpleFontData.cpp

Issue 227473005: Performance related change, Optimization for / and % operator. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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) 2005, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Alexey Proskuryakov 3 * Copyright (C) 2006 Alexey Proskuryakov
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 GlyphPageTreeNode::pruneTreeFontData(this); 153 GlyphPageTreeNode::pruneTreeFontData(this);
154 } 154 }
155 155
156 const SimpleFontData* SimpleFontData::fontDataForCharacter(UChar32) const 156 const SimpleFontData* SimpleFontData::fontDataForCharacter(UChar32) const
157 { 157 {
158 return this; 158 return this;
159 } 159 }
160 160
161 Glyph SimpleFontData::glyphForCharacter(UChar32 character) const 161 Glyph SimpleFontData::glyphForCharacter(UChar32 character) const
162 { 162 {
163 GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(this, character / GlyphPage::size); 163 // As GlyphPage::size is power of 2 so shifting is valid
164 return node->page() ? node->page()->glyphAt(character % GlyphPage::size) : 0 ; 164 int val = character >> 8;
jungshik at Google 2014/04/07 17:13:58 Hmm... compiler was not smart enough? (GlyphPage:
Stephen Chennney 2014/04/07 18:02:49 This hard bakes GlyphPage::size to 256. At a mini
hj 2014/04/08 02:56:50 Okey, will make changes. as per the shared links w
165 GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(this, val);
166 return node->page() ? node->page()->glyphAt(character - (val << 8)) : 0;
Stephen Chennney 2014/04/07 18:02:49 character - (val << 8) would be better implemented
hj 2014/04/08 02:56:50 Thank you, will make required changes. On 2014/04
165 } 167 }
166 168
167 bool SimpleFontData::isSegmented() const 169 bool SimpleFontData::isSegmented() const
168 { 170 {
169 return false; 171 return false;
170 } 172 }
171 173
172 PassRefPtr<SimpleFontData> SimpleFontData::verticalRightOrientationFontData() co nst 174 PassRefPtr<SimpleFontData> SimpleFontData::verticalRightOrientationFontData() co nst
173 { 175 {
174 if (!m_derivedFontData) 176 if (!m_derivedFontData)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescri ption& fontDescription, float scaleFactor) const 260 PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescri ption& fontDescription, float scaleFactor) const
259 { 261 {
260 // FIXME: Support scaled SVG fonts. Given that SVG is scalable in general th is should be achievable. 262 // FIXME: Support scaled SVG fonts. Given that SVG is scalable in general th is should be achievable.
261 if (isSVGFont()) 263 if (isSVGFont())
262 return nullptr; 264 return nullptr;
263 265
264 return platformCreateScaledFontData(fontDescription, scaleFactor); 266 return platformCreateScaledFontData(fontDescription, scaleFactor);
265 } 267 }
266 268
267 } // namespace WebCore 269 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698