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

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

Issue 401553002: Introduce DEFINE_FONT_DATA_TYPE_CASTS, and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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/FontFallbackList.cpp ('k') | Source/platform/fonts/SegmentedFontData.h » ('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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 200 }
201 } 201 }
202 202
203 // Now that we have a buffer full of characters, we want to get back an array 203 // Now that we have a buffer full of characters, we want to get back an array
204 // of glyph indices. This part involves calling into the platform-s pecific 204 // of glyph indices. This part involves calling into the platform-s pecific
205 // routine of our glyph map for actually filling in the page with th e glyphs. 205 // routine of our glyph map for actually filling in the page with th e glyphs.
206 // Success is not guaranteed. For example, Times fails to fill page 260, giving glyph data 206 // Success is not guaranteed. For example, Times fails to fill page 260, giving glyph data
207 // for only 128 out of 256 characters. 207 // for only 128 out of 256 characters.
208 bool haveGlyphs; 208 bool haveGlyphs;
209 if (!fontData->isSegmented()) { 209 if (!fontData->isSegmented()) {
210 m_page = GlyphPage::createForSingleFontData(this, static_cast<co nst SimpleFontData*>(fontData)); 210 m_page = GlyphPage::createForSingleFontData(this, toSimpleFontDa ta(fontData));
211 haveGlyphs = fill(m_page.get(), 0, GlyphPage::size, buffer, buff erLength, static_cast<const SimpleFontData*>(fontData)); 211 haveGlyphs = fill(m_page.get(), 0, GlyphPage::size, buffer, buff erLength, toSimpleFontData(fontData));
212 } else { 212 } else {
213 m_page = GlyphPage::createForMixedFontData(this); 213 m_page = GlyphPage::createForMixedFontData(this);
214 haveGlyphs = false; 214 haveGlyphs = false;
215 215
216 const SegmentedFontData* segmentedFontData = static_cast<const S egmentedFontData*>(fontData); 216 const SegmentedFontData* segmentedFontData = toSegmentedFontData (fontData);
217 for (int i = segmentedFontData->numRanges() - 1; i >= 0; i--) { 217 for (int i = segmentedFontData->numRanges() - 1; i >= 0; i--) {
218 const FontDataRange& range = segmentedFontData->rangeAt(i); 218 const FontDataRange& range = segmentedFontData->rangeAt(i);
219 // all this casting is to ensure all the parameters to min a nd max have the same type, 219 // all this casting is to ensure all the parameters to min a nd max have the same type,
220 // to avoid ambiguous template parameter errors on Windows 220 // to avoid ambiguous template parameter errors on Windows
221 int from = max(0, static_cast<int>(range.from()) - static_ca st<int>(start)); 221 int from = max(0, static_cast<int>(range.from()) - static_ca st<int>(start));
222 int to = 1 + min(static_cast<int>(range.to()) - static_cast< int>(start), static_cast<int>(GlyphPage::size) - 1); 222 int to = 1 + min(static_cast<int>(range.to()) - static_cast< int>(start), static_cast<int>(GlyphPage::size) - 1);
223 if (from >= static_cast<int>(GlyphPage::size) || to <= 0) 223 if (from >= static_cast<int>(GlyphPage::size) || to <= 0)
224 continue; 224 continue;
225 225
226 // If this is a custom font needs to be loaded, do not fill 226 // If this is a custom font needs to be loaded, do not fill
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 printf("\nPage %d:\n", it->key); 414 printf("\nPage %d:\n", it->key);
415 showGlyphPageTree(it->key); 415 showGlyphPageTree(it->key);
416 } 416 }
417 } 417 }
418 418
419 void showGlyphPageTree(unsigned pageNumber) 419 void showGlyphPageTree(unsigned pageNumber)
420 { 420 {
421 WebCore::GlyphPageTreeNode::getRoot(pageNumber)->showSubtree(); 421 WebCore::GlyphPageTreeNode::getRoot(pageNumber)->showSubtree();
422 } 422 }
423 #endif 423 #endif
OLDNEW
« no previous file with comments | « Source/platform/fonts/FontFallbackList.cpp ('k') | Source/platform/fonts/SegmentedFontData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698