OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrDistanceFieldTextContext.h" | 8 #include "GrDistanceFieldTextContext.h" |
9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
11 #include "GrFontScaler.h" | 11 #include "GrFontScaler.h" |
12 #include "SkGlyphCache.h" | 12 #include "SkGlyphCache.h" |
13 #include "GrIndexBuffer.h" | 13 #include "GrIndexBuffer.h" |
14 #include "GrTextStrike.h" | 14 #include "GrTextStrike.h" |
15 #include "GrTextStrike_impl.h" | 15 #include "GrTextStrike_impl.h" |
| 16 #include "SkDraw.h" |
16 #include "SkGpuDevice.h" | 17 #include "SkGpuDevice.h" |
17 #include "SkPath.h" | 18 #include "SkPath.h" |
18 #include "SkRTConf.h" | 19 #include "SkRTConf.h" |
19 #include "SkStrokeRec.h" | 20 #include "SkStrokeRec.h" |
20 #include "effects/GrDistanceFieldTextureEffect.h" | 21 #include "effects/GrDistanceFieldTextureEffect.h" |
21 | 22 |
22 static const int kGlyphCoordsAttributeIndex = 1; | 23 static const int kGlyphCoordsAttributeIndex = 1; |
23 | 24 |
24 static const int kBaseDFFontSize = 32; | 25 static const int kBaseDFFontSize = 32; |
25 | 26 |
26 SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false, | 27 SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false, |
27 "Dump the contents of the font cache before every purge."); | 28 "Dump the contents of the font cache before every purge."); |
28 | 29 |
| 30 bool GrDistanceFieldTextContext::CanDraw(const SkPaint& paint, const SkMatrix& c
tm) { |
| 31 return !paint.getRasterizer() && !paint.getMaskFilter() && |
| 32 paint.getStyle() == SkPaint::kFill_Style && |
| 33 !SkDraw::ShouldDrawTextAsPaths(paint, ctm); |
| 34 } |
| 35 |
29 GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context, | 36 GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context, |
30 const GrPaint& grPaint, | 37 const GrPaint& grPaint, |
31 const SkPaint& skPaint, | 38 const SkPaint& skPaint, |
32 const SkDeviceProperties&
properties) | 39 const SkDeviceProperties&
properties) |
33 : GrTextContext(context, grPaint, sk
Paint, properties) { | 40 : GrTextContext(context, grPaint, sk
Paint, properties) { |
34 fStrike = NULL; | 41 fStrike = NULL; |
35 | 42 |
36 fCurrTexture = NULL; | 43 fCurrTexture = NULL; |
37 fCurrVertex = 0; | 44 fCurrVertex = 0; |
38 | 45 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 SkScalarToFixed(x) - (glyph.fAdvanceX >> a
lignShift) | 414 SkScalarToFixed(x) - (glyph.fAdvanceX >> a
lignShift) |
408 + SK_FixedHalf, //d1g.fHalfSampleX, | 415 + SK_FixedHalf, //d1g.fHalfSampleX, |
409 SkScalarToFixed(y) - (glyph.fAdvanceY >> a
lignShift) | 416 SkScalarToFixed(y) - (glyph.fAdvanceY >> a
lignShift) |
410 + SK_FixedHalf, //d1g.fHalfSampleY, | 417 + SK_FixedHalf, //d1g.fHalfSampleY, |
411 fontScaler); | 418 fontScaler); |
412 } | 419 } |
413 pos += scalarsPerPosition; | 420 pos += scalarsPerPosition; |
414 } | 421 } |
415 } | 422 } |
416 } | 423 } |
OLD | NEW |