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

Side by Side Diff: sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp

Issue 1241673004: Minor sky/engine updates for Mac target (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove file added as a result of a bad merge Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. 2 * Copyright (c) 2007, 2008, 2010 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 } 118 }
119 119
120 void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, 120 void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
121 const GlyphBuffer& glyphBuffer, unsigned from, unsigned numGlyphs, 121 const GlyphBuffer& glyphBuffer, unsigned from, unsigned numGlyphs,
122 const FloatPoint& point, const FloatRect& textRect) const 122 const FloatPoint& point, const FloatRect& textRect) const
123 { 123 {
124 SkScalar x = SkFloatToScalar(point.x()); 124 SkScalar x = SkFloatToScalar(point.x());
125 SkScalar y = SkFloatToScalar(point.y()); 125 SkScalar y = SkFloatToScalar(point.y());
126 126
127 // ENABLE_OPENTYPE_VERTICAL is not enabled on MACOSX
128 #if !OS(MACOSX)
127 const OpenTypeVerticalData* verticalData = font->verticalData(); 129 const OpenTypeVerticalData* verticalData = font->verticalData();
128 if (font->platformData().orientation() == Vertical && verticalData) { 130 if (font->platformData().orientation() == Vertical && verticalData) {
129 SkAutoSTMalloc<32, SkPoint> storage(numGlyphs); 131 SkAutoSTMalloc<32, SkPoint> storage(numGlyphs);
130 SkPoint* pos = storage.get(); 132 SkPoint* pos = storage.get();
131 133
132 AffineTransform savedMatrix = gc->getCTM(); 134 AffineTransform savedMatrix = gc->getCTM();
133 gc->concatCTM(AffineTransform(0, -1, 1, 0, point.x(), point.y())); 135 gc->concatCTM(AffineTransform(0, -1, 1, 0, point.x(), point.y()));
134 gc->concatCTM(AffineTransform(1, 0, 0, 1, -point.x(), -point.y())); 136 gc->concatCTM(AffineTransform(1, 0, 0, 1, -point.x(), -point.y()));
135 137
136 const unsigned kMaxBufferLength = 256; 138 const unsigned kMaxBufferLength = 256;
(...skipping 21 matching lines...) Expand all
158 y + -SkIntToScalar(-lroundf(currentWidth - translations[i].y ()))); 160 y + -SkIntToScalar(-lroundf(currentWidth - translations[i].y ())));
159 currentWidth += glyphBuffer.advanceAt(from + glyphIndex); 161 currentWidth += glyphBuffer.advanceAt(from + glyphIndex);
160 } 162 }
161 horizontalOffset += currentWidth; 163 horizontalOffset += currentWidth;
162 paintGlyphs(gc, font, glyphs, chunkLength, pos, textRect); 164 paintGlyphs(gc, font, glyphs, chunkLength, pos, textRect);
163 } 165 }
164 166
165 gc->setCTM(savedMatrix); 167 gc->setCTM(savedMatrix);
166 return; 168 return;
167 } 169 }
170 #endif
168 171
169 if (!glyphBuffer.hasOffsets()) { 172 if (!glyphBuffer.hasOffsets()) {
170 SkAutoSTMalloc<64, SkScalar> storage(numGlyphs); 173 SkAutoSTMalloc<64, SkScalar> storage(numGlyphs);
171 SkScalar* xpos = storage.get(); 174 SkScalar* xpos = storage.get();
172 const float* adv = glyphBuffer.advances(from); 175 const float* adv = glyphBuffer.advances(from);
173 for (unsigned i = 0; i < numGlyphs; i++) { 176 for (unsigned i = 0; i < numGlyphs; i++) {
174 xpos[i] = x; 177 xpos[i] = x;
175 x += SkFloatToScalar(adv[i]); 178 x += SkFloatToScalar(adv[i]);
176 } 179 }
177 const Glyph* glyphs = glyphBuffer.glyphs(from); 180 const Glyph* glyphs = glyphBuffer.glyphs(from);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 SkScalar advance = SkFloatToScalar(initialAdvance); 322 SkScalar advance = SkFloatToScalar(initialAdvance);
320 323
321 bool success = glyphBuffer.hasOffsets() ? 324 bool success = glyphBuffer.hasOffsets() ?
322 buildTextBlobInternal<true>(glyphBuffer, advance, builder) : 325 buildTextBlobInternal<true>(glyphBuffer, advance, builder) :
323 buildTextBlobInternal<false>(glyphBuffer, advance, builder); 326 buildTextBlobInternal<false>(glyphBuffer, advance, builder);
324 return success ? adoptRef(builder.build()) : nullptr; 327 return success ? adoptRef(builder.build()) : nullptr;
325 } 328 }
326 329
327 330
328 } // namespace blink 331 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/platform/fonts/apple/FontPlatformDataApple.cpp ('k') | sky/engine/platform/fonts/ios/FontPlatformDataIOS.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698