Revert "Fix clipping of SkMatrixImageFilter input"
This reverts commit cb8b5d1101
.
Reason for revert: Chrome layout tests
Original change's description:
> Fix clipping of SkMatrixImageFilter input
>
> Bug: skia:7931
> Change-Id: I3e424dcd5c0b04542976f4f59a5836e7c3079d06
> Reviewed-on: https://skia-review.googlesource.com/127020
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=egdaniel@google.com,robertphillips@google.com
Change-Id: I6b871071e180c45016038dcf2b01d2c96e93911c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7931
Reviewed-on: https://skia-review.googlesource.com/127160
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
010ce2bc74
commit
ef4f7b4dc1
@ -61,39 +61,57 @@ protected:
|
|||||||
void onDraw(SkCanvas* canvas) override {
|
void onDraw(SkCanvas* canvas) override {
|
||||||
canvas->clear(SK_ColorBLACK);
|
canvas->clear(SK_ColorBLACK);
|
||||||
|
|
||||||
const SkRect srcRect = SkRect::MakeWH(96, 96);
|
SkRect srcRect = SkRect::MakeWH(96, 96);
|
||||||
const SkSize deviceSize = SkSize::Make(16, 16);
|
|
||||||
|
|
||||||
this->draw(canvas, srcRect, deviceSize, kNone_SkFilterQuality, nullptr);
|
SkSize deviceSize = SkSize::Make(16, 16);
|
||||||
|
this->draw(canvas,
|
||||||
|
srcRect,
|
||||||
|
deviceSize,
|
||||||
|
kNone_SkFilterQuality,
|
||||||
|
nullptr);
|
||||||
|
|
||||||
canvas->translate(srcRect.width() + SkIntToScalar(10), 0);
|
canvas->translate(srcRect.width() + SkIntToScalar(10), 0);
|
||||||
this->draw(canvas, srcRect, deviceSize, kLow_SkFilterQuality, nullptr);
|
this->draw(canvas,
|
||||||
|
srcRect,
|
||||||
|
deviceSize,
|
||||||
|
kLow_SkFilterQuality,
|
||||||
|
nullptr);
|
||||||
|
|
||||||
canvas->translate(srcRect.width() + SkIntToScalar(10), 0);
|
canvas->translate(srcRect.width() + SkIntToScalar(10), 0);
|
||||||
this->draw(canvas, srcRect, deviceSize, kMedium_SkFilterQuality, nullptr);
|
this->draw(canvas,
|
||||||
|
srcRect,
|
||||||
|
deviceSize,
|
||||||
|
kMedium_SkFilterQuality,
|
||||||
|
nullptr);
|
||||||
|
|
||||||
canvas->translate(srcRect.width() + SkIntToScalar(10), 0);
|
canvas->translate(srcRect.width() + SkIntToScalar(10), 0);
|
||||||
this->draw(canvas, srcRect, deviceSize, kHigh_SkFilterQuality, nullptr);
|
this->draw(canvas,
|
||||||
|
srcRect,
|
||||||
|
deviceSize,
|
||||||
|
kHigh_SkFilterQuality,
|
||||||
|
nullptr);
|
||||||
|
|
||||||
|
sk_sp<SkSurface> surface(SkSurface::MakeRasterN32Premul(16, 16));
|
||||||
|
SkCanvas* surfaceCanvas = surface->getCanvas();
|
||||||
|
surfaceCanvas->clear(0x000000);
|
||||||
{
|
{
|
||||||
sk_sp<SkSurface> surface(SkSurface::MakeRasterN32Premul(16, 16));
|
SkPaint paint;
|
||||||
SkCanvas* surfaceCanvas = surface->getCanvas();
|
paint.setColor(0xFF00FF00);
|
||||||
surfaceCanvas->clear(0x000000);
|
SkRect ovalRect = SkRect::MakeWH(16, 16);
|
||||||
{
|
ovalRect.inset(SkIntToScalar(2)/3, SkIntToScalar(2)/3);
|
||||||
SkPaint paint;
|
surfaceCanvas->drawOval(ovalRect, paint);
|
||||||
paint.setColor(0xFF00FF00);
|
|
||||||
SkRect ovalRect = SkRect::MakeWH(16, 16);
|
|
||||||
ovalRect.inset(SkIntToScalar(2)/3, SkIntToScalar(2)/3);
|
|
||||||
surfaceCanvas->drawOval(ovalRect, paint);
|
|
||||||
}
|
|
||||||
sk_sp<SkImage> image(surface->makeImageSnapshot());
|
|
||||||
SkRect inRect = SkRect::MakeXYWH(-4, -4, 20, 20);
|
|
||||||
SkRect outRect = SkRect::MakeXYWH(-24, -24, 120, 120);
|
|
||||||
sk_sp<SkImageFilter> source(
|
|
||||||
SkImageSource::Make(std::move(image), inRect, outRect, kHigh_SkFilterQuality));
|
|
||||||
canvas->translate(srcRect.width() + SkIntToScalar(10), 0);
|
|
||||||
this->draw(canvas, srcRect, deviceSize, kHigh_SkFilterQuality, std::move(source));
|
|
||||||
}
|
}
|
||||||
|
sk_sp<SkImage> image(surface->makeImageSnapshot());
|
||||||
|
SkRect inRect = SkRect::MakeXYWH(-4, -4, 20, 20);
|
||||||
|
SkRect outRect = SkRect::MakeXYWH(-24, -24, 120, 120);
|
||||||
|
sk_sp<SkImageFilter> source(
|
||||||
|
SkImageSource::Make(std::move(image), inRect, outRect, kHigh_SkFilterQuality));
|
||||||
|
canvas->translate(srcRect.width() + SkIntToScalar(10), 0);
|
||||||
|
this->draw(canvas,
|
||||||
|
srcRect,
|
||||||
|
deviceSize,
|
||||||
|
kHigh_SkFilterQuality,
|
||||||
|
std::move(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -131,15 +131,7 @@ SkIRect SkMatrixImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatr
|
|||||||
matrix.postConcat(ctm);
|
matrix.postConcat(ctm);
|
||||||
SkRect floatBounds;
|
SkRect floatBounds;
|
||||||
matrix.mapRect(&floatBounds, SkRect::Make(src));
|
matrix.mapRect(&floatBounds, SkRect::Make(src));
|
||||||
SkIRect result = floatBounds.roundOut();
|
return floatBounds.roundOut();
|
||||||
|
|
||||||
if (kReverse_MapDirection == direction && kNone_SkFilterQuality != fFilterQuality) {
|
|
||||||
// When filtering we might need some pixels in the source that might be otherwise
|
|
||||||
// clipped off.
|
|
||||||
result.outset(1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkMatrixImageFilter::toString(SkString* str) const {
|
void SkMatrixImageFilter::toString(SkString* str) const {
|
||||||
|
Loading…
Reference in New Issue
Block a user