| 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 "GrBitmapTextContext.h" | 10 #include "GrBitmapTextContext.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 (context, props, enable
)); | 73 (context, props, enable
)); |
| 74 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, pro
ps); | 74 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, pro
ps); |
| 75 | 75 |
| 76 return textContext; | 76 return textContext; |
| 77 } | 77 } |
| 78 | 78 |
| 79 GrDistanceFieldTextContext::~GrDistanceFieldTextContext() { | 79 GrDistanceFieldTextContext::~GrDistanceFieldTextContext() { |
| 80 SkSafeSetNull(fGammaTexture); | 80 SkSafeSetNull(fGammaTexture); |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint, const SkMatrix& v
iewMatrix) { | 83 bool GrDistanceFieldTextContext::canDraw(const GrRenderTarget* rt, const SkPaint
& paint, |
| 84 const SkMatrix& viewMatrix) { |
| 84 // TODO: support perspective (need getMaxScale replacement) | 85 // TODO: support perspective (need getMaxScale replacement) |
| 85 if (viewMatrix.hasPerspective()) { | 86 if (viewMatrix.hasPerspective()) { |
| 86 return false; | 87 return false; |
| 87 } | 88 } |
| 88 | 89 |
| 89 SkScalar maxScale = viewMatrix.getMaxScale(); | 90 SkScalar maxScale = viewMatrix.getMaxScale(); |
| 90 SkScalar scaledTextSize = maxScale*paint.getTextSize(); | 91 SkScalar scaledTextSize = maxScale*paint.getTextSize(); |
| 91 // Scaling up beyond 2x yields undesireable artifacts | 92 // Scaling up beyond 2x yields undesireable artifacts |
| 92 if (scaledTextSize > 2*kLargeDFFontSize) { | 93 if (scaledTextSize > 2*kLargeDFFontSize) { |
| 93 return false; | 94 return false; |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 } | 719 } |
| 719 } | 720 } |
| 720 | 721 |
| 721 inline void GrDistanceFieldTextContext::finish() { | 722 inline void GrDistanceFieldTextContext::finish() { |
| 722 this->flush(); | 723 this->flush(); |
| 723 fTotalVertexCount = 0; | 724 fTotalVertexCount = 0; |
| 724 | 725 |
| 725 GrTextContext::finish(); | 726 GrTextContext::finish(); |
| 726 } | 727 } |
| 727 | 728 |
| OLD | NEW |