| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "GrTextContext.h" | 8 #include "GrTextContext.h" |
| 9 #include "GrBlurUtils.h" | 9 #include "GrBlurUtils.h" |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| 11 #include "GrDrawContext.h" | 11 #include "GrDrawContext.h" |
| 12 #include "GrFontScaler.h" | 12 #include "GrFontScaler.h" |
| 13 | 13 |
| 14 #include "SkAutoKern.h" | 14 #include "SkAutoKern.h" |
| 15 #include "SkDrawFilter.h" | 15 #include "SkDrawFilter.h" |
| 16 #include "SkDrawProcs.h" | 16 #include "SkDrawProcs.h" |
| 17 #include "SkGlyphCache.h" | 17 #include "SkGlyphCache.h" |
| 18 #include "SkGpuDevice.h" | 18 #include "SkGpuDevice.h" |
| 19 #include "SkGrPriv.h" |
| 19 #include "SkTextBlob.h" | 20 #include "SkTextBlob.h" |
| 20 #include "SkTextMapStateProc.h" | 21 #include "SkTextMapStateProc.h" |
| 21 #include "SkTextToPathIter.h" | 22 #include "SkTextToPathIter.h" |
| 22 | 23 |
| 23 GrTextContext::GrTextContext(GrContext* context, const SkSurfaceProps& surfacePr
ops) | 24 GrTextContext::GrTextContext(GrContext* context, const SkSurfaceProps& surfacePr
ops) |
| 24 : fFallbackTextContext(nullptr) | 25 : fFallbackTextContext(nullptr) |
| 25 , fContext(context) | 26 , fContext(context) |
| 26 , fSurfaceProps(surfaceProps) { | 27 , fSurfaceProps(surfaceProps) { |
| 27 } | 28 } |
| 28 | 29 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 124 |
| 124 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ
e)) { | 125 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ
e)) { |
| 125 // A false return from filter() means we should abort the current dr
aw. | 126 // A false return from filter() means we should abort the current dr
aw. |
| 126 runPaint = skPaint; | 127 runPaint = skPaint; |
| 127 continue; | 128 continue; |
| 128 } | 129 } |
| 129 | 130 |
| 130 runPaint.setFlags(FilterTextFlags(fSurfaceProps, runPaint)); | 131 runPaint.setFlags(FilterTextFlags(fSurfaceProps, runPaint)); |
| 131 | 132 |
| 132 GrPaint grPaint; | 133 GrPaint grPaint; |
| 133 if (!SkPaint2GrPaint(fContext, runPaint, viewMatrix, true, &grPaint)) { | 134 if (!SkPaintToGrPaint(fContext, runPaint, viewMatrix, &grPaint)) { |
| 134 return; | 135 return; |
| 135 } | 136 } |
| 136 | 137 |
| 137 switch (it.positioning()) { | 138 switch (it.positioning()) { |
| 138 case SkTextBlob::kDefault_Positioning: | 139 case SkTextBlob::kDefault_Positioning: |
| 139 this->drawText(dc, rt, clip, grPaint, runPaint, viewMatrix, (const c
har *)it.glyphs(), | 140 this->drawText(dc, rt, clip, grPaint, runPaint, viewMatrix, (const c
har *)it.glyphs(), |
| 140 textLen, x + offset.x(), y + offset.y(), clipBounds); | 141 textLen, x + offset.x(), y + offset.y(), clipBounds); |
| 141 break; | 142 break; |
| 142 case SkTextBlob::kHorizontal_Positioning: | 143 case SkTextBlob::kHorizontal_Positioning: |
| 143 this->drawPosText(dc, rt, clip, grPaint, runPaint, viewMatrix, (cons
t char*)it.glyphs(), | 144 this->drawPosText(dc, rt, clip, grPaint, runPaint, viewMatrix, (cons
t char*)it.glyphs(), |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { | 270 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { |
| 270 scaler = (GrFontScaler*)auxData; | 271 scaler = (GrFontScaler*)auxData; |
| 271 } | 272 } |
| 272 if (nullptr == scaler) { | 273 if (nullptr == scaler) { |
| 273 scaler = new GrFontScaler(cache); | 274 scaler = new GrFontScaler(cache); |
| 274 cache->setAuxProc(GlyphCacheAuxProc, scaler); | 275 cache->setAuxProc(GlyphCacheAuxProc, scaler); |
| 275 } | 276 } |
| 276 | 277 |
| 277 return scaler; | 278 return scaler; |
| 278 } | 279 } |
| OLD | NEW |