if (skPaint.getTextSize() > 0) {
TextRun run(skPaint);
run.setText(text, byteLength, x, y);
- run.draw(context, dc, paint, clip, paint.getColor(), viewMatrix, props, 0, 0,
+ run.draw(context, dc, paint, clip, viewMatrix, props, 0, 0,
clipBounds, fFallbackTextContext, skPaint);
}
return;
if (skPaint.getTextSize() > 0) {
TextRun run(skPaint);
run.setPosText(text, byteLength, pos, scalarsPerPosition, offset);
- run.draw(context, dc, paint, clip, paint.getColor(), viewMatrix, props, 0, 0,
+ run.draw(context, dc, paint, clip, viewMatrix, props, 0, 0,
clipBounds, fFallbackTextContext, skPaint);
}
return;
TextBlob::Iter iter(blob);
for (TextRun* run = iter.get(); run; run = iter.next()) {
- run->draw(context, dc, paint, clip, paint.getColor(), viewMatrix, props, x, y,
+ // The run's "font" overrides the anti-aliasing of the passed in paint!
+ paint.setAntiAlias(run->isAntiAlias());
+ run->draw(context, dc, paint, clip, viewMatrix, props, x, y,
clipBounds, fFallbackTextContext, skPaint);
run->releaseGlyphCache();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
GrStencilAndCoverTextContext::TextRun::TextRun(const SkPaint& fontAndStroke)
- : fStyle(fontAndStroke),
- fFont(fontAndStroke),
- fTotalGlyphCount(0),
- fFallbackGlyphCount(0),
- fDetachedGlyphCache(nullptr),
- fLastDrawnGlyphsID(SK_InvalidUniqueID) {
+ : fStyle(fontAndStroke)
+ , fFont(fontAndStroke)
+ , fTotalGlyphCount(0)
+ , fFallbackGlyphCount(0)
+ , fDetachedGlyphCache(nullptr)
+ , fLastDrawnGlyphsID(SK_InvalidUniqueID) {
SkASSERT(fFont.getTextSize() > 0);
SkASSERT(!fStyle.hasNonDashPathEffect()); // Arbitrary path effects not supported.
SkASSERT(!fStyle.isSimpleHairline()); // Hairlines are not supported.
GrDrawContext* drawContext,
const GrPaint& grPaint,
const GrClip& clip,
- GrColor color,
const SkMatrix& viewMatrix,
const SkSurfaceProps& props,
SkScalar x, SkScalar y,
GrAtlasTextContext* fallbackTextContext,
const SkPaint& originalSkPaint) const {
SkASSERT(fInstanceData);
- SkASSERT(drawContext->isStencilBufferMultisampled() || !fFont.isAntiAlias());
+ SkASSERT(drawContext->isStencilBufferMultisampled() || !grPaint.isAntiAlias());
if (fInstanceData->count()) {
static constexpr GrUserStencilSettings kCoverPass(
SkAutoTUnref<GrDrawBatch> batch(
GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRatio * x,
- fTextInverseRatio * y, color,
+ fTextInverseRatio * y, grPaint.getColor(),
GrPathRendering::kWinding_FillType, glyphs, fInstanceData,
bounds));
GrPipelineBuilder pipelineBuilder(grPaint);
- pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, fFont.isAntiAlias());
+ pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, grPaint.isAntiAlias());
pipelineBuilder.setUserStencil(&kCoverPass);
drawContext->drawBatch(pipelineBuilder, clip, batch);
void setPosText(const char text[], size_t byteLength, const SkScalar pos[],
int scalarsPerPosition, const SkPoint& offset);
- void draw(GrContext*, GrDrawContext*, const GrPaint&, const GrClip&, GrColor,
+ void draw(GrContext*, GrDrawContext*, const GrPaint&, const GrClip&,
const SkMatrix&, const SkSurfaceProps&,
SkScalar x, SkScalar y, const SkIRect& clipBounds,
GrAtlasTextContext* fallbackTextContext, const SkPaint& originalSkPaint) const;
size_t computeSizeInCache() const;
+ bool isAntiAlias() const { return fFont.isAntiAlias(); }
+
private:
typedef GrDrawPathRangeBatch::InstanceData InstanceData;