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

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: Commet fixes 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 | « Source/platform/fonts/GlyphPage.h ('k') | 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 GlyphPageTreeNode* node = GlyphPageTreeNode::getRootChild(this, character >> GlyphPage::sizeBits);
165 return node->page() ? node->page()->glyphAt(character & 0xFF) : 0;
165 } 166 }
166 167
167 bool SimpleFontData::isSegmented() const 168 bool SimpleFontData::isSegmented() const
168 { 169 {
169 return false; 170 return false;
170 } 171 }
171 172
172 PassRefPtr<SimpleFontData> SimpleFontData::verticalRightOrientationFontData() co nst 173 PassRefPtr<SimpleFontData> SimpleFontData::verticalRightOrientationFontData() co nst
173 { 174 {
174 if (!m_derivedFontData) 175 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 259 PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescri ption& fontDescription, float scaleFactor) const
259 { 260 {
260 // FIXME: Support scaled SVG fonts. Given that SVG is scalable in general th is should be achievable. 261 // FIXME: Support scaled SVG fonts. Given that SVG is scalable in general th is should be achievable.
261 if (isSVGFont()) 262 if (isSVGFont())
262 return nullptr; 263 return nullptr;
263 264
264 return platformCreateScaledFontData(fontDescription, scaleFactor); 265 return platformCreateScaledFontData(fontDescription, scaleFactor);
265 } 266 }
266 267
267 } // namespace WebCore 268 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/fonts/GlyphPage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698