SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
If paint contains SkMaskFilter, generate mask from bitmap bounds. If paint's
SkFilterQuality is higher than kLow_SkFilterQuality, it will be treated as if it
- were kLow_SkFilterQuality.
+ were kLow_SkFilterQuality. Any SkMaskFilter on the paint is ignored as is the paint's
+ antialiasing state.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as SkShader made from SkShader::MakeBitmapShader with
SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
If paint contains SkMaskFilter, generate mask from bitmap bounds. If paint's
SkFilterQuality is higher than kLow_SkFilterQuality, it will be treated as if it
- were kLow_SkFilterQuality.
+ were kLow_SkFilterQuality. Any SkMaskFilter on the paint is ignored as is the paint's
+ antialiasing state.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as SkShader made from SkShader::MakeBitmapShader with
SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
If paint contains SkMaskFilter, generate mask from bitmap bounds. If paint's
SkFilterQuality is higher than kLow_SkFilterQuality, it will be treated as if it
- were kLow_SkFilterQuality.
+ were kLow_SkFilterQuality. Any SkMaskFilter on the paint is ignored as is the paint's
+ antialiasing state.
If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
just as SkShader made from SkShader::MakeBitmapShader with
}
namespace {
-class NoneOrLowQualityFilterPaint : SkNoncopyable {
+class LatticePaint : SkNoncopyable {
public:
- NoneOrLowQualityFilterPaint(const SkPaint* origPaint) {
- if (origPaint && origPaint->getFilterQuality() > kLow_SkFilterQuality) {
- fLazyPaint.set(*origPaint);
- fLazyPaint.get()->setFilterQuality(kLow_SkFilterQuality);
- fPaint = fLazyPaint.get();
- } else {
- fPaint = origPaint;
+ LatticePaint(const SkPaint* origPaint) : fPaint(origPaint) {
+ if (!origPaint) {
+ return;
+ }
+ if (origPaint->getFilterQuality() > kLow_SkFilterQuality) {
+ fPaint.writable()->setFilterQuality(kLow_SkFilterQuality);
+ }
+ if (origPaint->getMaskFilter()) {
+ fPaint.writable()->setMaskFilter(nullptr);
+ }
+ if (origPaint->isAntiAlias()) {
+ fPaint.writable()->setAntiAlias(false);
}
}
}
private:
- const SkPaint* fPaint;
- SkLazyPaint fLazyPaint;
+ SkTCopyOnFirstWrite<SkPaint> fPaint;
};
} // namespace
return;
}
if (SkLatticeIter::Valid(image->width(), image->height(), center)) {
- NoneOrLowQualityFilterPaint lowPaint(paint);
- this->onDrawImageNine(image, center, dst, lowPaint.get());
+ LatticePaint latticePaint(paint);
+ this->onDrawImageNine(image, center, dst, latticePaint.get());
} else {
this->drawImageRect(image, dst, paint);
}
}
if (SkLatticeIter::Valid(image->width(), image->height(), latticePlusBounds)) {
- NoneOrLowQualityFilterPaint lowPaint(paint);
- this->onDrawImageLattice(image, latticePlusBounds, dst, lowPaint.get());
+ LatticePaint latticePaint(paint);
+ this->onDrawImageLattice(image, latticePlusBounds, dst, latticePaint.get());
} else {
this->drawImageRect(image, dst, paint);
}
return;
}
if (SkLatticeIter::Valid(bitmap.width(), bitmap.height(), center)) {
- NoneOrLowQualityFilterPaint lowPaint(paint);
- this->onDrawBitmapNine(bitmap, center, dst, lowPaint.get());
+ LatticePaint latticePaint(paint);
+ this->onDrawBitmapNine(bitmap, center, dst, latticePaint.get());
} else {
this->drawBitmapRect(bitmap, dst, paint);
}
}
if (SkLatticeIter::Valid(bitmap.width(), bitmap.height(), latticePlusBounds)) {
- NoneOrLowQualityFilterPaint lowPaint(paint);
- this->onDrawBitmapLattice(bitmap, latticePlusBounds, dst, lowPaint.get());
+ LatticePaint latticePaint(paint);
+ this->onDrawBitmapLattice(bitmap, latticePlusBounds, dst, latticePaint.get());
} else {
this->drawBitmapRect(bitmap, dst, paint);
}
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawProducerLattice", fContext.get());
SkTCopyOnFirstWrite<SkPaint> paint(&origPaint);
- bool useFallback = paint->getMaskFilter() || paint->isAntiAlias() ||
- GrFSAAType::kUnifiedMSAA == fRenderTargetContext->fsaaType();
- if (useFallback) {
- SkRect srcR, dstR;
- while (iter->next(&srcR, &dstR)) {
- this->drawTextureProducer(producer, &srcR, &dstR, SkCanvas::kStrict_SrcRectConstraint,
- this->ctm(), *paint);
- }
- return;
- }
-
if (!producer->isAlphaOnly() && (paint->getColor() & 0x00FFFFFF) != 0x00FFFFFF) {
paint.writable()->setColor(SkColorSetARGB(origPaint.getAlpha(), 0xFF, 0xFF, 0xFF));
}