Revert of antialias matrix-image-filter to get smooth diagonals (patchset #6 id:80002 of https://codereview.chromium.org/1134743003/)
Reason for revert: likely affect layouttests, so need to add a guard Original issue's description: > antialias matrix-image-filter to get smooth diagonals > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/fa33f5a6b770130acdc55f2ffe19dd545665726a TBR=senorblanco@google.com,robertphillips@google.com,bsalomon@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1128823010
This commit is contained in:
parent
0135a41e09
commit
daa57bfd42
@ -81,9 +81,6 @@ public:
|
||||
public:
|
||||
virtual ~Proxy() {};
|
||||
|
||||
/**
|
||||
* The returned device will be zero-initialized (transparent black)
|
||||
*/
|
||||
virtual SkBaseDevice* createDevice(int width, int height) = 0;
|
||||
// returns true if the proxy can handle this filter natively
|
||||
virtual bool canHandleImageFilter(const SkImageFilter*) = 0;
|
||||
@ -347,12 +344,6 @@ protected:
|
||||
private:
|
||||
bool usesSrcInput() const { return fUsesSrcInput; }
|
||||
|
||||
// Hack to optimize how we saveLayer, remove when no longer needed by SkCanvas
|
||||
bool mayDrawWithMatrix() const { return this->onMayDrawWithMatrix(); }
|
||||
// Return true if the subclass may draw the src transformed (e.g. w/ matrix)
|
||||
virtual bool onMayDrawWithMatrix() const { return false; }
|
||||
friend class SkCanvas;
|
||||
|
||||
typedef SkFlattenable INHERITED;
|
||||
int fInputCount;
|
||||
SkImageFilter** fInputs;
|
||||
|
@ -992,8 +992,6 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
|
||||
flags |= kClipToLayer_SaveFlag;
|
||||
#endif
|
||||
|
||||
SkImageFilter* imgf = paint ? paint->getImageFilter() : NULL;
|
||||
|
||||
// do this before we create the layer. We don't call the public save() since
|
||||
// that would invoke a possibly overridden virtual
|
||||
this->internalSave();
|
||||
@ -1001,7 +999,7 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
|
||||
fDeviceCMDirty = true;
|
||||
|
||||
SkIRect ir;
|
||||
if (!this->clipRectBounds(bounds, flags, &ir, imgf)) {
|
||||
if (!this->clipRectBounds(bounds, flags, &ir, paint ? paint->getImageFilter() : NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1015,7 +1013,7 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
|
||||
SkPixelGeometry geo = fProps.pixelGeometry();
|
||||
if (paint) {
|
||||
// TODO: perhaps add a query to filters so we might preserve opaqueness...
|
||||
if (imgf || paint->getColorFilter()) {
|
||||
if (paint->getImageFilter() || paint->getColorFilter()) {
|
||||
isOpaque = false;
|
||||
geo = kUnknown_SkPixelGeometry;
|
||||
}
|
||||
@ -1031,10 +1029,7 @@ void SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, Sav
|
||||
|
||||
bool forceSpriteOnRestore = false;
|
||||
{
|
||||
SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage;
|
||||
if (imgf && imgf->mayDrawWithMatrix()) {
|
||||
usage = SkBaseDevice::kPossible_TileUsage;
|
||||
}
|
||||
const SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage;
|
||||
const SkBaseDevice::CreateInfo createInfo = SkBaseDevice::CreateInfo(info, usage, geo);
|
||||
SkBaseDevice* newDev = device->onCreateDevice(createInfo, paint);
|
||||
if (NULL == newDev) {
|
||||
|
@ -21,8 +21,6 @@ public:
|
||||
{}
|
||||
|
||||
SkBaseDevice* createDevice(int w, int h) override {
|
||||
// Our contract is to return a zero-initialized device, so we request iPremul_AlphaType
|
||||
// which is the signal to the fDevice to perform this init.
|
||||
SkBaseDevice::CreateInfo cinfo(SkImageInfo::MakeN32Premul(w, h),
|
||||
SkBaseDevice::kNever_TileUsage,
|
||||
kUnknown_SkPixelGeometry,
|
||||
|
@ -76,13 +76,13 @@ bool SkMatrixImageFilter::onFilterImage(Proxy* proxy,
|
||||
return false;
|
||||
}
|
||||
|
||||
SkPaint paint;
|
||||
paint.setFilterQuality(fFilterQuality);
|
||||
paint.setAntiAlias(true); // since we may be rotated, we definitely want a smooth edge
|
||||
|
||||
SkCanvas canvas(device.get());
|
||||
canvas.translate(-SkIntToScalar(dstBounds.x()), -SkIntToScalar(dstBounds.y()));
|
||||
canvas.concat(matrix);
|
||||
SkPaint paint;
|
||||
|
||||
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
|
||||
paint.setFilterQuality(fFilterQuality);
|
||||
canvas.drawBitmap(src, srcRect.x(), srcRect.y(), &paint);
|
||||
|
||||
*result = device.get()->accessBitmap(false);
|
||||
|
@ -57,8 +57,6 @@ protected:
|
||||
SkIRect* dst) const override;
|
||||
|
||||
private:
|
||||
bool onMayDrawWithMatrix() const override { return true; }
|
||||
|
||||
SkMatrix fTransform;
|
||||
SkFilterQuality fFilterQuality;
|
||||
typedef SkImageFilter INHERITED;
|
||||
|
Loading…
Reference in New Issue
Block a user