| 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 "SkGrPriv.h" |
| 20 #include "SkTextBlob.h" | 20 #include "SkTextBlobRunIterator.h" |
| 21 #include "SkTextMapStateProc.h" | 21 #include "SkTextMapStateProc.h" |
| 22 #include "SkTextToPathIter.h" | 22 #include "SkTextToPathIter.h" |
| 23 | 23 |
| 24 GrTextContext::GrTextContext(GrContext* context, const SkSurfaceProps& surfacePr
ops) | 24 GrTextContext::GrTextContext(GrContext* context, const SkSurfaceProps& surfacePr
ops) |
| 25 : fFallbackTextContext(nullptr) | 25 : fFallbackTextContext(nullptr) |
| 26 , fContext(context) | 26 , fContext(context) |
| 27 , fSurfaceProps(surfaceProps) { | 27 , fSurfaceProps(surfaceProps) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 GrTextContext::~GrTextContext() { | 30 GrTextContext::~GrTextContext() { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 return flags; | 109 return flags; |
| 110 } | 110 } |
| 111 | 111 |
| 112 void GrTextContext::drawTextBlob(GrDrawContext* dc, GrRenderTarget* rt, | 112 void GrTextContext::drawTextBlob(GrDrawContext* dc, GrRenderTarget* rt, |
| 113 const GrClip& clip, const SkPaint& skPaint, | 113 const GrClip& clip, const SkPaint& skPaint, |
| 114 const SkMatrix& viewMatrix, const SkTextBlob* b
lob, | 114 const SkMatrix& viewMatrix, const SkTextBlob* b
lob, |
| 115 SkScalar x, SkScalar y, | 115 SkScalar x, SkScalar y, |
| 116 SkDrawFilter* drawFilter, const SkIRect& clipBo
unds) { | 116 SkDrawFilter* drawFilter, const SkIRect& clipBo
unds) { |
| 117 SkPaint runPaint = skPaint; | 117 SkPaint runPaint = skPaint; |
| 118 | 118 |
| 119 SkTextBlob::RunIterator it(blob); | 119 SkTextBlobRunIterator it(blob); |
| 120 for (;!it.done(); it.next()) { | 120 for (;!it.done(); it.next()) { |
| 121 size_t textLen = it.glyphCount() * sizeof(uint16_t); | 121 size_t textLen = it.glyphCount() * sizeof(uint16_t); |
| 122 const SkPoint& offset = it.offset(); | 122 const SkPoint& offset = it.offset(); |
| 123 // applyFontToPaint() always overwrites the exact same attributes, | 123 // applyFontToPaint() always overwrites the exact same attributes, |
| 124 // so it is safe to not re-seed the paint for this reason. | 124 // so it is safe to not re-seed the paint for this reason. |
| 125 it.applyFontToPaint(&runPaint); | 125 it.applyFontToPaint(&runPaint); |
| 126 | 126 |
| 127 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ
e)) { | 127 if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Typ
e)) { |
| 128 // A false return from filter() means we should abort the current dr
aw. | 128 // A false return from filter() means we should abort the current dr
aw. |
| 129 runPaint = skPaint; | 129 runPaint = skPaint; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { | 272 if (cache->getAuxProcData(GlyphCacheAuxProc, &auxData)) { |
| 273 scaler = (GrFontScaler*)auxData; | 273 scaler = (GrFontScaler*)auxData; |
| 274 } | 274 } |
| 275 if (nullptr == scaler) { | 275 if (nullptr == scaler) { |
| 276 scaler = new GrFontScaler(cache); | 276 scaler = new GrFontScaler(cache); |
| 277 cache->setAuxProc(GlyphCacheAuxProc, scaler); | 277 cache->setAuxProc(GlyphCacheAuxProc, scaler); |
| 278 } | 278 } |
| 279 | 279 |
| 280 return scaler; | 280 return scaler; |
| 281 } | 281 } |
| OLD | NEW |