aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/SkCanvas_Reference.bmh1
-rw-r--r--include/core/SkCanvas.h9
-rw-r--r--src/core/SkCanvas.cpp40
-rw-r--r--src/gpu/SkGpuDevice.cpp11
4 files changed, 29 insertions, 32 deletions
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index 6c12339ce3..2990a8c48c 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -4690,6 +4690,7 @@ Blend_Mode, and Draw_Looper. If #bitmap_or_image# is kAlpha_8_SkColorType, apply
If paint contains Mask_Filter, generate mask from #bitmap_or_image# bounds. If paint
Filter_Quality set to kNone_SkFilterQuality, disable pixel filtering. For all
other values of paint Filter_Quality, use kLow_SkFilterQuality to filter pixels.
+Any SkMaskFilter on the paint is ignored as is the paint's antialiasing state.
##
#Method void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 12f1926844..8a46320ea9 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1734,7 +1734,8 @@ public:
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
@@ -1836,7 +1837,8 @@ public:
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
@@ -1866,7 +1868,8 @@ public:
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
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 00bbdf418e..8230fb3928 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1745,15 +1745,20 @@ void SkCanvas::drawImageRect(const SkImage* image, const SkRect& dst, const SkPa
}
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);
}
}
@@ -1762,8 +1767,7 @@ public:
}
private:
- const SkPaint* fPaint;
- SkLazyPaint fLazyPaint;
+ SkTCopyOnFirstWrite<SkPaint> fPaint;
};
} // namespace
@@ -1775,8 +1779,8 @@ void SkCanvas::drawImageNine(const SkImage* image, const SkIRect& center, const
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);
}
@@ -1798,8 +1802,8 @@ void SkCanvas::drawImageLattice(const SkImage* image, const Lattice& lattice, co
}
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);
}
@@ -1840,8 +1844,8 @@ void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
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);
}
@@ -1862,8 +1866,8 @@ void SkCanvas::drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
}
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);
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 27daab6479..883f32605a 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1397,17 +1397,6 @@ void SkGpuDevice::drawProducerLattice(GrTextureProducer* producer,
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));
}