| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright 2014 Google Inc. |    2  * Copyright 2014 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 "GrStencilAndCoverTextContext.h" |    8 #include "GrStencilAndCoverTextContext.h" | 
|    9 #include "GrAtlasTextContext.h" |    9 #include "GrAtlasTextContext.h" | 
|   10 #include "GrContext.h" |   10 #include "GrContext.h" | 
|   11 #include "GrDrawContext.h" |   11 #include "GrDrawContext.h" | 
|   12 #include "GrPath.h" |   12 #include "GrPath.h" | 
|   13 #include "GrPathRange.h" |   13 #include "GrPathRange.h" | 
 |   14 #include "GrPipelineBuilder.h" | 
|   14 #include "GrResourceProvider.h" |   15 #include "GrResourceProvider.h" | 
|   15 #include "GrTextUtils.h" |   16 #include "GrTextUtils.h" | 
|   16 #include "SkAutoKern.h" |   17 #include "SkAutoKern.h" | 
|   17 #include "SkDraw.h" |   18 #include "SkDraw.h" | 
|   18 #include "SkDrawProcs.h" |   19 #include "SkDrawProcs.h" | 
|   19 #include "SkGlyphCache.h" |   20 #include "SkGlyphCache.h" | 
|   20 #include "SkGrPriv.h" |   21 #include "SkGrPriv.h" | 
|   21 #include "SkDrawFilter.h" |   22 #include "SkDrawFilter.h" | 
|   22 #include "SkPath.h" |   23 #include "SkPath.h" | 
|   23 #include "SkTextBlobRunIterator.h" |   24 #include "SkTextBlobRunIterator.h" | 
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  635         // For clipping we'll just skip any optimizations based on the bounds. T
     his does, however, |  636         // For clipping we'll just skip any optimizations based on the bounds. T
     his does, however, | 
|  636         // hurt batching. |  637         // hurt batching. | 
|  637         const SkRect bounds = SkRect::MakeIWH(drawContext->width(), drawContext-
     >height()); |  638         const SkRect bounds = SkRect::MakeIWH(drawContext->width(), drawContext-
     >height()); | 
|  638  |  639  | 
|  639         SkAutoTUnref<GrDrawBatch> batch( |  640         SkAutoTUnref<GrDrawBatch> batch( | 
|  640             GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRat
     io * x, |  641             GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRat
     io * x, | 
|  641                                          fTextInverseRatio * y, grPaint.getColor
     (), |  642                                          fTextInverseRatio * y, grPaint.getColor
     (), | 
|  642                                          GrPathRendering::kWinding_FillType, gly
     phs, fInstanceData, |  643                                          GrPathRendering::kWinding_FillType, gly
     phs, fInstanceData, | 
|  643                                          bounds)); |  644                                          bounds)); | 
|  644  |  645  | 
|  645         SkASSERT(drawContext->mustUseHWAA(grPaint) == grPaint.isAntiAlias()); |  646         GrPipelineBuilder pipelineBuilder(grPaint); | 
|  646         drawContext->drawBatch(grPaint, clip, kCoverPass, batch); |  647         pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, grPaint.i
     sAntiAlias()); | 
 |  648         pipelineBuilder.setUserStencil(&kCoverPass); | 
 |  649  | 
 |  650         drawContext->drawBatch(pipelineBuilder, clip, batch); | 
|  647     } |  651     } | 
|  648  |  652  | 
|  649     if (fFallbackTextBlob) { |  653     if (fFallbackTextBlob) { | 
|  650         SkPaint fallbackSkPaint(originalSkPaint); |  654         SkPaint fallbackSkPaint(originalSkPaint); | 
|  651         fStyle.strokeRec().applyToPaint(&fallbackSkPaint); |  655         fStyle.strokeRec().applyToPaint(&fallbackSkPaint); | 
|  652         if (!fStyle.isSimpleFill()) { |  656         if (!fStyle.isSimpleFill()) { | 
|  653             fallbackSkPaint.setStrokeWidth(fStyle.strokeRec().getWidth() * fText
     Ratio); |  657             fallbackSkPaint.setStrokeWidth(fStyle.strokeRec().getWidth() * fText
     Ratio); | 
|  654         } |  658         } | 
|  655  |  659  | 
|  656         fallbackTextContext->drawTextBlob(ctx, drawContext, clip, fallbackSkPain
     t, viewMatrix, |  660         fallbackTextContext->drawTextBlob(ctx, drawContext, clip, fallbackSkPain
     t, viewMatrix, | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  729 } |  733 } | 
|  730  |  734  | 
|  731 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
     ed(int *count) { |  735 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
     ed(int *count) { | 
|  732     *count = fCount; |  736     *count = fCount; | 
|  733     if (fCount) { |  737     if (fCount) { | 
|  734         this->flush(); |  738         this->flush(); | 
|  735         return fBuilder->build(); |  739         return fBuilder->build(); | 
|  736     } |  740     } | 
|  737     return nullptr; |  741     return nullptr; | 
|  738 } |  742 } | 
| OLD | NEW |