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

Side by Side Diff: Source/core/platform/graphics/chromium/FontChromiumWin.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
« no previous file with comments | « no previous file | Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.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 Apple Computer, Inc. 2 * Copyright (C) 2006, 2007 Apple Computer, Inc.
3 * Copyright (c) 2006, 2007, 2008, 2009, Google Inc. All rights reserved. 3 * Copyright (c) 2006, 2007, 2008, 2009, Google Inc. All rights reserved.
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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // If the text is RTL, left will actually be after right. 170 // If the text is RTL, left will actually be after right.
171 if (left < right) 171 if (left < right)
172 return FloatRect(left, point.y(), 172 return FloatRect(left, point.y(),
173 right - left, static_cast<float>(h)); 173 right - left, static_cast<float>(h));
174 174
175 return FloatRect(right, point.y(), 175 return FloatRect(right, point.y(),
176 left - right, static_cast<float>(h)); 176 left - right, static_cast<float>(h));
177 } 177 }
178 178
179 void Font::drawComplexText(GraphicsContext* graphicsContext, 179 void Font::drawComplexText(GraphicsContext* graphicsContext,
180 const TextRunPaintInfo& runInfo, 180 const TextRunPaintInfo& runInfo,
181 const FloatPoint& point) const 181 const FloatPoint& point) const
182 { 182 {
183 UniscribeHelperTextRun state(runInfo.run, *this); 183 UniscribeHelperTextRun state(runInfo.run, *this);
184 184
185 SkColor color = graphicsContext->effectiveFillColor(); 185 SkColor color = graphicsContext->effectiveFillColor();
186 unsigned char alpha = SkColorGetA(color); 186 unsigned char alpha = SkColorGetA(color);
187 // Skip 100% transparent text; no need to draw anything. 187 // Skip 100% transparent text; no need to draw anything.
188 if (!alpha && graphicsContext->strokeStyle() == NoStroke) 188 if (!alpha && graphicsContext->strokeStyle() == NoStroke)
189 return; 189 return;
190 190
191 HDC hdc = 0; 191 HDC hdc = 0;
192 // Uniscribe counts the coordinates from the upper left, while WebKit uses 192 // Uniscribe counts the coordinates from the upper left, while WebKit uses
193 // the baseline, so we have to subtract off the ascent. 193 // the baseline, so we have to subtract off the ascent.
194 state.draw(graphicsContext, hdc, lroundf(point.x()), lroundf(point.y() - fon tMetrics().ascent()), runInfo.bounds, runInfo.from, runInfo.to); 194 state.draw(graphicsContext, primaryFont()->platformData(), hdc, lroundf(poin t.x()), lroundf(point.y() - fontMetrics().ascent()), runInfo.bounds, runInfo.fro m, runInfo.to);
195 } 195 }
196 196
197 void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRunPaintInfo& /* runInfo */, const AtomicString& /* mark */, const FloatPoi nt& /* point */) const 197 void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRunPaintInfo& /* runInfo */, const AtomicString& /* mark */, const FloatPoi nt& /* point */) const
198 { 198 {
199 notImplemented(); 199 notImplemented();
200 } 200 }
201 201
202 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const 202 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* /* fallbackFonts */, GlyphOverflow* /* glyphOverflow */) const
203 { 203 {
204 UniscribeHelperTextRun state(run, *this); 204 UniscribeHelperTextRun state(run, *this);
(...skipping 13 matching lines...) Expand all
218 int charIndex = state.xToCharacter(x); 218 int charIndex = state.xToCharacter(x);
219 219
220 // XToCharacter will return -1 if the position is before the first 220 // XToCharacter will return -1 if the position is before the first
221 // character (we get called like this sometimes). 221 // character (we get called like this sometimes).
222 if (charIndex < 0) 222 if (charIndex < 0)
223 charIndex = 0; 223 charIndex = 0;
224 return charIndex; 224 return charIndex;
225 } 225 }
226 226
227 } // namespace WebCore 227 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/platform/graphics/chromium/FontPlatformDataChromiumWin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698