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

Side by Side Diff: Source/core/platform/graphics/skia/SkiaFontWin.cpp

Issue 25094004: Update SkiaFontWin::paintSkiaText to override typeface for HFONT (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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) 2008, Google Inc. All rights reserved. 2 * Copyright (c) 2008, 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 TextDrawingModeFlags textMode = context->textDrawingMode(); 98 TextDrawingModeFlags textMode = context->textDrawingMode();
99 99
100 // Filling (if necessary). This is the common case. 100 // Filling (if necessary). This is the common case.
101 SkPaint paint; 101 SkPaint paint;
102 context->setupPaintForFilling(&paint); 102 context->setupPaintForFilling(&paint);
103 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 103 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
104 data.setupPaint(&paint, context); 104 data.setupPaint(&paint, context);
105 105
106 // FIXME: Only needed to support the HFONT based paintSkiaText 106 // FIXME: Only needed to support the HFONT based paintSkiaText
107 // version where a new typeface is created from the HFONT. 107 // version where a new typeface is created from the HFONT.
108 // As such it can go away once the direct-GDI code path is removed. 108 // As such it can go away once the HFONT code path is removed.
109 #if ENABLE(GDI_FONTS_ON_WINDOWS)
110 paint.setTypeface(face); 109 paint.setTypeface(face);
111 #endif
112 110
113 bool didFill = false; 111 bool didFill = false;
114 112
115 if ((textMode & TextModeFill) && (SkColorGetA(paint.getColor()) || paint.get Looper())) { 113 if ((textMode & TextModeFill) && (SkColorGetA(paint.getColor()) || paint.get Looper())) {
116 skiaDrawText(context, origin, textRect, &paint, &glyphs[0], &advances[0] , &offsets[0], numGlyphs); 114 skiaDrawText(context, origin, textRect, &paint, &glyphs[0], &advances[0] , &offsets[0], numGlyphs);
117 didFill = true; 115 didFill = true;
118 } 116 }
119 117
120 // Stroking on top (if necessary). 118 // Stroking on top (if necessary).
121 if ((textMode & TextModeStroke) 119 if ((textMode & TextModeStroke)
122 && context->strokeStyle() != NoStroke 120 && context->strokeStyle() != NoStroke
123 && context->strokeThickness() > 0) { 121 && context->strokeThickness() > 0) {
124 122
125 paint.reset(); 123 paint.reset();
126 context->setupPaintForStroking(&paint); 124 context->setupPaintForStroking(&paint);
127 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 125 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
128 data.setupPaint(&paint, context); 126 data.setupPaint(&paint, context);
129 #if ENABLE(GDI_FONTS_ON_WINDOWS)
130 paint.setTypeface(face); 127 paint.setTypeface(face);
131 #endif
132 128
133 if (didFill) { 129 if (didFill) {
134 // If there is a shadow and we filled above, there will already be 130 // If there is a shadow and we filled above, there will already be
135 // a shadow. We don't want to draw it again or it will be too dark 131 // a shadow. We don't want to draw it again or it will be too dark
136 // and it will go on top of the fill. 132 // and it will go on top of the fill.
137 // 133 //
138 // Note that this isn't strictly correct, since the stroke could be 134 // Note that this isn't strictly correct, since the stroke could be
139 // very thick and the shadow wouldn't account for this. The "right" 135 // very thick and the shadow wouldn't account for this. The "right"
140 // thing would be to draw to a new layer and then draw that layer 136 // thing would be to draw to a new layer and then draw that layer
141 // with a shadow. But this is a lot of extra work for something 137 // with a shadow. But this is a lot of extra work for something
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 173
178 // Ensure font load for printing, because PDF device needs it. 174 // Ensure font load for printing, because PDF device needs it.
179 if (context->isPrintingDevice()) 175 if (context->isPrintingDevice())
180 FontPlatformData::ensureFontLoaded(hfont); 176 FontPlatformData::ensureFontLoaded(hfont);
181 177
182 RefPtr<SkTypeface> face = CreateTypefaceFromHFont(hfont, &size, &paintTextFl ags); 178 RefPtr<SkTypeface> face = CreateTypefaceFromHFont(hfont, &size, &paintTextFl ags);
183 paintSkiaText(context, data, face.get(), size, paintTextFlags, numGlyphs, gl yphs, advances, offsets, origin, textRect); 179 paintSkiaText(context, data, face.get(), size, paintTextFlags, numGlyphs, gl yphs, advances, offsets, origin, textRect);
184 } 180 }
185 181
186 } // namespace WebCore 182 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698