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

Side by Side Diff: Source/core/platform/graphics/chromium/UniscribeHelper.cpp

Issue 24422003: Merge FontPlatformData::setupPaint and setupPaintForFont on Win (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: w/gdi fix Created 7 years, 2 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) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (c) 2006, 2007, 2008, 2009, 2012 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 // The offset is beyond this item, account for its length and move on. 318 // The offset is beyond this item, account for its length and move on.
319 x -= itemAdvance; 319 x -= itemAdvance;
320 } 320 }
321 321
322 // Error condition, we don't know what to do if we don't have that X 322 // Error condition, we don't know what to do if we don't have that X
323 // position in any of our items. 323 // position in any of our items.
324 return 0; 324 return 0;
325 } 325 }
326 326
327 void UniscribeHelper::draw(GraphicsContext* graphicsContext, HDC dc, 327 void UniscribeHelper::draw(GraphicsContext* graphicsContext,
328 int x, int y, 328 const FontPlatformData& fontPlatformData, HDC dc, int x, int y,
329 const FloatRect& textRect, 329 const FloatRect& textRect, int from, int to)
330 int from, int to)
331 { 330 {
332 HGDIOBJ oldFont = 0; 331 HGDIOBJ oldFont = 0;
333 int curX = x; 332 int curX = x;
334 bool firstRun = true; 333 bool firstRun = true;
335 334
336 for (size_t screenIndex = 0; screenIndex < m_runs.size(); screenIndex++) { 335 for (size_t screenIndex = 0; screenIndex < m_runs.size(); screenIndex++) {
337 int itemIndex = m_screenOrder[screenIndex]; 336 int itemIndex = m_screenOrder[screenIndex];
338 const SCRIPT_ITEM& item = m_runs[itemIndex]; 337 const SCRIPT_ITEM& item = m_runs[itemIndex];
339 const Shaping& shaping = m_shapes[itemIndex]; 338 const Shaping& shaping = m_shapes[itemIndex];
340 339
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 415
417 // Fonts with different ascents can be used to render different 416 // Fonts with different ascents can be used to render different
418 // runs. 'Across-runs' y-coordinate correction needs to be 417 // runs. 'Across-runs' y-coordinate correction needs to be
419 // adjusted for each font. 418 // adjusted for each font.
420 bool textOutOk = false; 419 bool textOutOk = false;
421 for (int executions = 0; executions < 2; ++executions) { 420 for (int executions = 0; executions < 2; ++executions) {
422 SkPoint origin; 421 SkPoint origin;
423 origin.fX = curX + + innerOffset; 422 origin.fX = curX + + innerOffset;
424 origin.fY = y + m_ascent; 423 origin.fY = y + m_ascent;
425 paintSkiaText(graphicsContext, 424 paintSkiaText(graphicsContext,
426 shaping.m_hfont, 425 fontPlatformData,
427 glyphCount, 426 shaping.m_hfont,
428 &shaping.m_glyphs[fromGlyph], 427 glyphCount,
429 advances, 428 &shaping.m_glyphs[fromGlyph],
430 &shaping.m_offsets[fromGlyph], 429 advances,
431 origin, 430 &shaping.m_offsets[fromGlyph],
432 textRect); 431 origin,
432 textRect);
433 textOutOk = true; 433 textOutOk = true;
434 434
435 if (!textOutOk && 0 == executions) { 435 if (!textOutOk && 0 == executions) {
436 // If TextOut is called from the renderer it might fail 436 // If TextOut is called from the renderer it might fail
437 // because the sandbox is preventing it from opening the 437 // because the sandbox is preventing it from opening the
438 // font files. If we are running in the renderer, 438 // font files. If we are running in the renderer,
439 // TryToPreloadFont is overridden to ask the browser to 439 // TryToPreloadFont is overridden to ask the browser to
440 // preload the font for us so we can access it. 440 // preload the font for us so we can access it.
441 tryToPreloadFont(shaping.m_hfont); 441 tryToPreloadFont(shaping.m_hfont);
442 continue; 442 continue;
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 m_featureRecords.resize(featureSettings->size()); 1061 m_featureRecords.resize(featureSettings->size());
1062 for (unsigned i = 0; i < featureSettings->size(); ++i) { 1062 for (unsigned i = 0; i < featureSettings->size(); ++i) {
1063 m_featureRecords[i].lParameter = featureSettings->at(i).value(); 1063 m_featureRecords[i].lParameter = featureSettings->at(i).value();
1064 m_featureRecords[i].tagFeature = convertFeatureTag(featureSettings->at(i ).tag()); 1064 m_featureRecords[i].tagFeature = convertFeatureTag(featureSettings->at(i ).tag());
1065 } 1065 }
1066 m_rangeProperties.potfRecords = &m_featureRecords[0]; 1066 m_rangeProperties.potfRecords = &m_featureRecords[0];
1067 m_rangeProperties.cotfRecords = m_featureRecords.size(); 1067 m_rangeProperties.cotfRecords = m_featureRecords.size();
1068 } 1068 }
1069 1069
1070 } // namespace WebCore 1070 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/chromium/UniscribeHelper.h ('k') | Source/core/platform/graphics/skia/SkiaFontWin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698