| 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" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 const GrClip& clip, const GrPaint& p
aint, | 75 const GrClip& clip, const GrPaint& p
aint, |
| 76 const SkPaint& skPaint, const SkMatr
ix& viewMatrix, | 76 const SkPaint& skPaint, const SkMatr
ix& viewMatrix, |
| 77 const SkSurfaceProps& props, | 77 const SkSurfaceProps& props, |
| 78 const char text[], size_t byteLength
, | 78 const char text[], size_t byteLength
, |
| 79 SkScalar x, SkScalar y, const SkIRec
t& clipBounds) { | 79 SkScalar x, SkScalar y, const SkIRec
t& clipBounds) { |
| 80 if (context->abandoned()) { | 80 if (context->abandoned()) { |
| 81 return; | 81 return; |
| 82 } else if (this->canDraw(skPaint, viewMatrix)) { | 82 } else if (this->canDraw(skPaint, viewMatrix)) { |
| 83 if (skPaint.getTextSize() > 0) { | 83 if (skPaint.getTextSize() > 0) { |
| 84 TextRun run(skPaint); | 84 TextRun run(skPaint); |
| 85 GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled()
); | 85 GrPipelineBuilder pipelineBuilder(paint); |
| 86 run.setText(text, byteLength, x, y); | 86 run.setText(text, byteLength, x, y); |
| 87 run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), view
Matrix, props, 0, 0, | 87 run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), view
Matrix, props, 0, 0, |
| 88 clipBounds, fFallbackTextContext, skPaint); | 88 clipBounds, fFallbackTextContext, skPaint); |
| 89 } | 89 } |
| 90 return; | 90 return; |
| 91 } else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props, | 91 } else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props, |
| 92 *context->caps()->shaderCaps())) { | 92 *context->caps()->shaderCaps())) { |
| 93 fFallbackTextContext->drawText(context, dc, clip, paint, skPaint, viewMa
trix, props, text, | 93 fFallbackTextContext->drawText(context, dc, clip, paint, skPaint, viewMa
trix, props, text, |
| 94 byteLength, x, y, clipBounds); | 94 byteLength, x, y, clipBounds); |
| 95 return; | 95 return; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 110 size_t byteLength, | 110 size_t byteLength, |
| 111 const SkScalar pos[], | 111 const SkScalar pos[], |
| 112 int scalarsPerPosition, | 112 int scalarsPerPosition, |
| 113 const SkPoint& offset, | 113 const SkPoint& offset, |
| 114 const SkIRect& clipBounds) { | 114 const SkIRect& clipBounds) { |
| 115 if (context->abandoned()) { | 115 if (context->abandoned()) { |
| 116 return; | 116 return; |
| 117 } else if (this->canDraw(skPaint, viewMatrix)) { | 117 } else if (this->canDraw(skPaint, viewMatrix)) { |
| 118 if (skPaint.getTextSize() > 0) { | 118 if (skPaint.getTextSize() > 0) { |
| 119 TextRun run(skPaint); | 119 TextRun run(skPaint); |
| 120 GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled()
); | 120 GrPipelineBuilder pipelineBuilder(paint); |
| 121 run.setPosText(text, byteLength, pos, scalarsPerPosition, offset); | 121 run.setPosText(text, byteLength, pos, scalarsPerPosition, offset); |
| 122 run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), view
Matrix, props, 0, 0, | 122 run.draw(context, dc, &pipelineBuilder, clip, paint.getColor(), view
Matrix, props, 0, 0, |
| 123 clipBounds, fFallbackTextContext, skPaint); | 123 clipBounds, fFallbackTextContext, skPaint); |
| 124 } | 124 } |
| 125 return; | 125 return; |
| 126 } else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props, | 126 } else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props, |
| 127 *context->caps()->shaderCaps())) { | 127 *context->caps()->shaderCaps())) { |
| 128 fFallbackTextContext->drawPosText(context, dc, clip, paint, skPaint, vie
wMatrix, props, | 128 fFallbackTextContext->drawPosText(context, dc, clip, paint, skPaint, vie
wMatrix, props, |
| 129 text, byteLength, pos, | 129 text, byteLength, pos, |
| 130 scalarsPerPosition, offset, clipBounds
); | 130 scalarsPerPosition, offset, clipBounds
); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 drawFilter, clipBounds); | 218 drawFilter, clipBounds); |
| 219 return; | 219 return; |
| 220 } | 220 } |
| 221 | 221 |
| 222 GrPaint paint; | 222 GrPaint paint; |
| 223 if (!SkPaintToGrPaint(context, skPaint, viewMatrix, dc->isGammaCorrect(), &p
aint)) { | 223 if (!SkPaintToGrPaint(context, skPaint, viewMatrix, dc->isGammaCorrect(), &p
aint)) { |
| 224 return; | 224 return; |
| 225 } | 225 } |
| 226 | 226 |
| 227 const TextBlob& blob = this->findOrCreateTextBlob(skBlob, skPaint); | 227 const TextBlob& blob = this->findOrCreateTextBlob(skBlob, skPaint); |
| 228 GrPipelineBuilder pipelineBuilder(paint, dc->isUnifiedMultisampled()); | 228 GrPipelineBuilder pipelineBuilder(paint); |
| 229 | 229 |
| 230 TextBlob::Iter iter(blob); | 230 TextBlob::Iter iter(blob); |
| 231 for (TextRun* run = iter.get(); run; run = iter.next()) { | 231 for (TextRun* run = iter.get(); run; run = iter.next()) { |
| 232 run->draw(context, dc, &pipelineBuilder, clip, paint.getColor(), viewMat
rix, props, x, y, | 232 run->draw(context, dc, &pipelineBuilder, clip, paint.getColor(), viewMat
rix, props, x, y, |
| 233 clipBounds, fFallbackTextContext, skPaint); | 233 clipBounds, fFallbackTextContext, skPaint); |
| 234 run->releaseGlyphCache(); | 234 run->releaseGlyphCache(); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 static inline int style_key_cnt(const GrStyle& style) { | 238 static inline int style_key_cnt(const GrStyle& style) { |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 } | 729 } |
| 730 | 730 |
| 731 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { | 731 const SkTextBlob* GrStencilAndCoverTextContext::FallbackBlobBuilder::buildIfNeed
ed(int *count) { |
| 732 *count = fCount; | 732 *count = fCount; |
| 733 if (fCount) { | 733 if (fCount) { |
| 734 this->flush(); | 734 this->flush(); |
| 735 return fBuilder->build(); | 735 return fBuilder->build(); |
| 736 } | 736 } |
| 737 return nullptr; | 737 return nullptr; |
| 738 } | 738 } |
| OLD | NEW |