| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "GrAtlasTextContext.h" | 7 #include "GrAtlasTextContext.h" |
| 8 | 8 |
| 9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
| 10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 bool noGamma) { | 353 bool noGamma) { |
| 354 skPaint.getScalerContextDescriptor(&run->fDescriptor, &fDeviceProperties, vi
ewMatrix, noGamma); | 354 skPaint.getScalerContextDescriptor(&run->fDescriptor, &fDeviceProperties, vi
ewMatrix, noGamma); |
| 355 run->fTypeface.reset(SkSafeRef(skPaint.getTypeface())); | 355 run->fTypeface.reset(SkSafeRef(skPaint.getTypeface())); |
| 356 return SkGlyphCache::DetachCache(run->fTypeface, run->fDescriptor.getDesc())
; | 356 return SkGlyphCache::DetachCache(run->fTypeface, run->fDescriptor.getDesc())
; |
| 357 } | 357 } |
| 358 | 358 |
| 359 void GrAtlasTextContext::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, | 359 void GrAtlasTextContext::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, |
| 360 const SkPaint& skPaint, const SkMatrix& vi
ewMatrix, | 360 const SkPaint& skPaint, const SkMatrix& vi
ewMatrix, |
| 361 const SkTextBlob* blob, SkScalar x, SkScal
ar y, | 361 const SkTextBlob* blob, SkScalar x, SkScal
ar y, |
| 362 SkDrawFilter* drawFilter, const SkIRect& c
lipBounds) { | 362 SkDrawFilter* drawFilter, const SkIRect& c
lipBounds) { |
| 363 // If we have been abandoned, then don't draw |
| 364 if (!fContext->getTextTarget()) { |
| 365 return; |
| 366 } |
| 367 |
| 363 SkAutoTUnref<BitmapTextBlob> cacheBlob; | 368 SkAutoTUnref<BitmapTextBlob> cacheBlob; |
| 364 SkMaskFilter::BlurRec blurRec; | 369 SkMaskFilter::BlurRec blurRec; |
| 365 BitmapTextBlob::Key key; | 370 BitmapTextBlob::Key key; |
| 366 // It might be worth caching these things, but its not clear at this time | 371 // It might be worth caching these things, but its not clear at this time |
| 367 // TODO for animated mask filters, this will fill up our cache. We need a s
afeguard here | 372 // TODO for animated mask filters, this will fill up our cache. We need a s
afeguard here |
| 368 const SkMaskFilter* mf = skPaint.getMaskFilter(); | 373 const SkMaskFilter* mf = skPaint.getMaskFilter(); |
| 369 bool canCache = !(skPaint.getPathEffect() || | 374 bool canCache = !(skPaint.getPathEffect() || |
| 370 (mf && !mf->asABlur(&blurRec)) || | 375 (mf && !mf->asABlur(&blurRec)) || |
| 371 drawFilter); | 376 drawFilter); |
| 372 | 377 |
| (...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2164 pipelineBuilder.setFromPaint(grPaint, rt, clip); | 2169 pipelineBuilder.setFromPaint(grPaint, rt, clip); |
| 2165 | 2170 |
| 2166 GrColor color = grPaint.getColor(); | 2171 GrColor color = grPaint.getColor(); |
| 2167 for (int run = 0; run < cacheBlob->fRunCount; run++) { | 2172 for (int run = 0; run < cacheBlob->fRunCount; run++) { |
| 2168 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk
Paint); | 2173 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk
Paint); |
| 2169 } | 2174 } |
| 2170 | 2175 |
| 2171 // Now flush big glyphs | 2176 // Now flush big glyphs |
| 2172 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); | 2177 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); |
| 2173 } | 2178 } |
| OLD | NEW |