OLD | NEW |
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 const GOFFSET* offsets, | 184 const GOFFSET* offsets, |
185 const SkPoint* origin) | 185 const SkPoint* origin) |
186 { | 186 { |
187 HDC dc = GetDC(0); | 187 HDC dc = GetDC(0); |
188 HGDIOBJ oldFont = SelectObject(dc, hfont); | 188 HGDIOBJ oldFont = SelectObject(dc, hfont); |
189 | 189 |
190 PlatformContextSkia* platformContext = context->platformContext(); | 190 PlatformContextSkia* platformContext = context->platformContext(); |
191 SkCanvas* canvas = platformContext->canvas(); | 191 SkCanvas* canvas = platformContext->canvas(); |
192 TextDrawingModeFlags textMode = platformContext->getTextDrawingMode(); | 192 TextDrawingModeFlags textMode = platformContext->getTextDrawingMode(); |
193 | 193 |
| 194 // If platformContext is GPU-backed make its GL context current. |
| 195 platformContext->makeGrContextCurrent(); |
| 196 |
194 // Filling (if necessary). This is the common case. | 197 // Filling (if necessary). This is the common case. |
195 SkPaint paint; | 198 SkPaint paint; |
196 platformContext->setupPaintForFilling(&paint); | 199 platformContext->setupPaintForFilling(&paint); |
197 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 200 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
198 setupPaintForFont(hfont, &paint, platformContext); | 201 setupPaintForFont(hfont, &paint, platformContext); |
199 | 202 |
200 bool didFill = false; | 203 bool didFill = false; |
201 | 204 |
202 if ((textMode & TextModeFill) && (SkColorGetA(paint.getColor()) || paint.get
Looper())) { | 205 if ((textMode & TextModeFill) && (SkColorGetA(paint.getColor()) || paint.get
Looper())) { |
203 skiaDrawText(canvas, *origin, &paint, &glyphs[0], &advances[0], &offsets
[0], numGlyphs); | 206 skiaDrawText(canvas, *origin, &paint, &glyphs[0], &advances[0], &offsets
[0], numGlyphs); |
(...skipping 24 matching lines...) Expand all Loading... |
228 } | 231 } |
229 | 232 |
230 skiaDrawText(canvas, *origin, &paint, &glyphs[0], &advances[0], &offsets
[0], numGlyphs); | 233 skiaDrawText(canvas, *origin, &paint, &glyphs[0], &advances[0], &offsets
[0], numGlyphs); |
231 } | 234 } |
232 | 235 |
233 SelectObject(dc, oldFont); | 236 SelectObject(dc, oldFont); |
234 ReleaseDC(0, dc); | 237 ReleaseDC(0, dc); |
235 } | 238 } |
236 | 239 |
237 } // namespace WebCore | 240 } // namespace WebCore |
OLD | NEW |