Revert "Revert "Remove MakeForLocalSpace since picture image is sufficient""
This reverts commitfc45998242
. Reason for revert: google3 updated (I think) Original change's description: > Revert "Remove MakeForLocalSpace since picture image is sufficient" > > This reverts commit0d8766c84c
. > > Reason for revert: broke google3 > > Original change's description: > > Remove MakeForLocalSpace since picture image is sufficient > > > > Bug: skia: > > Change-Id: If38e702c418e93141311490edf447d1f09ed4434 > > Reviewed-on: https://skia-review.googlesource.com/68640 > > Commit-Queue: Mike Reed <reed@google.com> > > Reviewed-by: Florin Malita <fmalita@chromium.org> > > TBR=robertphillips@google.com,fmalita@chromium.org,reed@google.com > > Change-Id: I3dec3d2c704e02b4db5977c27cc3e6d9f1c68ed5 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia: > Reviewed-on: https://skia-review.googlesource.com/69500 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Mike Reed <reed@google.com> TBR=robertphillips@google.com,fmalita@chromium.org,reed@google.com Change-Id: I5751fa637d280f361dea0f248a43c1f7e9bd8bdc No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/69661 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
4b56375651
commit
77e487dfc0
@ -920,20 +920,12 @@ static sk_sp<SkImageFilter> make_fuzz_imageFilter(Fuzz* fuzz, int depth) {
|
||||
return SkPictureImageFilter::Make(std::move(picture), cropRect);
|
||||
}
|
||||
case 22: {
|
||||
SkRect cropRect;
|
||||
SkFilterQuality filterQuality;
|
||||
fuzz->next(&cropRect, &filterQuality);
|
||||
sk_sp<SkPicture> picture = make_fuzz_picture(fuzz, depth - 1);
|
||||
return SkPictureImageFilter::MakeForLocalSpace(std::move(picture), cropRect,
|
||||
filterQuality);
|
||||
}
|
||||
case 23: {
|
||||
SkRect src, dst;
|
||||
fuzz->next(&src, &dst);
|
||||
sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1);
|
||||
return SkTileImageFilter::Make(src, dst, std::move(input));
|
||||
}
|
||||
case 24: {
|
||||
case 23: {
|
||||
SkBlendMode blendMode;
|
||||
bool useCropRect;
|
||||
fuzz->next(&useCropRect, &blendMode);
|
||||
|
@ -11,6 +11,9 @@
|
||||
#include "SkPictureImageFilter.h"
|
||||
#include "SkPictureRecorder.h"
|
||||
|
||||
#include "SkImage.h"
|
||||
#include "SkImageSource.h"
|
||||
|
||||
// This GM exercises the SkPictureImageFilter ImageFilter class.
|
||||
|
||||
static void fill_rect_filtered(SkCanvas* canvas,
|
||||
@ -70,6 +73,16 @@ protected:
|
||||
fLCDPicture = make_LCD_picture();
|
||||
}
|
||||
|
||||
sk_sp<SkImageFilter> make(sk_sp<SkPicture> pic, SkRect r, SkFilterQuality fq) {
|
||||
SkISize dim = { SkScalarRoundToInt(r.width()), SkScalarRoundToInt(r.height()) };
|
||||
auto img = SkImage::MakeFromPicture(pic, dim, nullptr, nullptr,
|
||||
SkImage::BitDepth::kU8, SkColorSpace::MakeSRGB());
|
||||
return SkImageSource::Make(img, r, r, fq);
|
||||
}
|
||||
sk_sp<SkImageFilter> make(SkFilterQuality fq) {
|
||||
return make(fPicture, fPicture->cullRect(), fq);
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
canvas->clear(SK_ColorGRAY);
|
||||
{
|
||||
@ -81,14 +94,8 @@ protected:
|
||||
srcRect));
|
||||
sk_sp<SkImageFilter> pictureSourceEmptyRect(SkPictureImageFilter::Make(fPicture,
|
||||
emptyRect));
|
||||
sk_sp<SkImageFilter> pictureSourceResampled(SkPictureImageFilter::MakeForLocalSpace(
|
||||
fPicture,
|
||||
fPicture->cullRect(),
|
||||
kLow_SkFilterQuality));
|
||||
sk_sp<SkImageFilter> pictureSourcePixelated(SkPictureImageFilter::MakeForLocalSpace(
|
||||
fPicture,
|
||||
fPicture->cullRect(),
|
||||
kNone_SkFilterQuality));
|
||||
sk_sp<SkImageFilter> pictureSourceResampled = make(kLow_SkFilterQuality);
|
||||
sk_sp<SkImageFilter> pictureSourcePixelated = make(kNone_SkFilterQuality);
|
||||
|
||||
canvas->save();
|
||||
// Draw the picture unscaled.
|
||||
@ -111,10 +118,7 @@ protected:
|
||||
canvas->drawRect(bounds, stroke);
|
||||
|
||||
SkPaint paint;
|
||||
paint.setImageFilter(SkPictureImageFilter::MakeForLocalSpace(
|
||||
fLCDPicture,
|
||||
fPicture->cullRect(),
|
||||
kNone_SkFilterQuality));
|
||||
paint.setImageFilter(make(fLCDPicture, fPicture->cullRect(), kNone_SkFilterQuality));
|
||||
|
||||
canvas->scale(4, 4);
|
||||
canvas->translate(-0.9f*srcRect.fLeft, -2.45f*srcRect.fTop);
|
||||
|
@ -201,10 +201,11 @@ private:
|
||||
// V56: Add TileMode in SkBlurImageFilter.
|
||||
// V57: Sweep tiling info.
|
||||
// V58: No more 2pt conical flipping.
|
||||
// V59: No more LocalSpace option on PictureImageFilter
|
||||
|
||||
// Only SKPs within the min/current picture version range (inclusive) can be read.
|
||||
static const uint32_t MIN_PICTURE_VERSION = 51; // Produced by Chrome ~M56.
|
||||
static const uint32_t CURRENT_PICTURE_VERSION = 58;
|
||||
static const uint32_t CURRENT_PICTURE_VERSION = 59;
|
||||
|
||||
static bool IsValidPictInfo(const SkPictInfo& info);
|
||||
static sk_sp<SkPicture> Forwardport(const SkPictInfo&,
|
||||
|
@ -24,17 +24,6 @@ public:
|
||||
*/
|
||||
static sk_sp<SkImageFilter> Make(sk_sp<SkPicture> picture, const SkRect& cropRect);
|
||||
|
||||
/**
|
||||
* Refs the passed-in picture. The picture is rasterized at a resolution that matches the
|
||||
* local coordinate space. If the picture needs to be resampled for drawing it into the
|
||||
* destination canvas, bilinear filtering will be used. cropRect can be used to crop or
|
||||
* expand the destination rect when the picture is drawn. (No scaling is implied by the
|
||||
* dest rect; only the CTM is applied.)
|
||||
*/
|
||||
static sk_sp<SkImageFilter> MakeForLocalSpace(sk_sp<SkPicture> picture,
|
||||
const SkRect& cropRect,
|
||||
SkFilterQuality filterQuality);
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)
|
||||
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
kTileModeInBlurImageFilter_Version = 56,
|
||||
kTileInfoInSweepGradient_Version = 57,
|
||||
k2PtConicalNoFlip_Version = 58,
|
||||
kRemovePictureImageFilterLocalSpace = 59,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -29,16 +29,6 @@ sk_sp<SkImageFilter> SkPictureImageFilter::Make(sk_sp<SkPicture> picture,
|
||||
nullptr));
|
||||
}
|
||||
|
||||
sk_sp<SkImageFilter> SkPictureImageFilter::MakeForLocalSpace(sk_sp<SkPicture> picture,
|
||||
const SkRect& cropRect,
|
||||
SkFilterQuality filterQuality) {
|
||||
return sk_sp<SkImageFilter>(new SkPictureImageFilter(std::move(picture),
|
||||
cropRect,
|
||||
kLocalSpace_PictureResolution,
|
||||
filterQuality,
|
||||
nullptr));
|
||||
}
|
||||
|
||||
SkPictureImageFilter::SkPictureImageFilter(sk_sp<SkPicture> picture)
|
||||
: INHERITED(nullptr, 0, nullptr)
|
||||
, fPicture(std::move(picture))
|
||||
@ -71,14 +61,25 @@ sk_sp<SkFlattenable> SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) {
|
||||
}
|
||||
}
|
||||
buffer.readRect(&cropRect);
|
||||
PictureResolution pictureResolution = (PictureResolution)buffer.readInt();
|
||||
|
||||
if (kLocalSpace_PictureResolution == pictureResolution) {
|
||||
//filterLevel is only serialized if pictureResolution is LocalSpace
|
||||
SkFilterQuality filterQuality = (SkFilterQuality)buffer.readInt();
|
||||
return MakeForLocalSpace(picture, cropRect, filterQuality);
|
||||
// NOTE: these two fields can be removed from the class once we have out-lived the need
|
||||
// to load pictures older than SkReadBuffer::kRemovePictureImageFilterLocalSpace
|
||||
//
|
||||
PictureResolution pictureResolution = kDeviceSpace_PictureResolution;
|
||||
SkFilterQuality filterQuality = kNone_SkFilterQuality;
|
||||
|
||||
if (buffer.isVersionLT(SkReadBuffer::kRemovePictureImageFilterLocalSpace)) {
|
||||
pictureResolution = (PictureResolution)buffer.readInt();
|
||||
if (kLocalSpace_PictureResolution == pictureResolution) {
|
||||
//filterLevel is only serialized if pictureResolution is LocalSpace
|
||||
filterQuality = (SkFilterQuality)buffer.readInt();
|
||||
}
|
||||
}
|
||||
return Make(picture, cropRect);
|
||||
return sk_sp<SkImageFilter>(new SkPictureImageFilter(picture,
|
||||
cropRect,
|
||||
pictureResolution,
|
||||
filterQuality,
|
||||
nullptr));
|
||||
}
|
||||
|
||||
void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const {
|
||||
@ -92,10 +93,6 @@ void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const {
|
||||
}
|
||||
}
|
||||
buffer.writeRect(fCropRect);
|
||||
buffer.writeInt(fPictureResolution);
|
||||
if (kLocalSpace_PictureResolution == fPictureResolution) {
|
||||
buffer.writeInt(fFilterQuality);
|
||||
}
|
||||
}
|
||||
|
||||
sk_sp<SkSpecialImage> SkPictureImageFilter::onFilterImage(SkSpecialImage* source,
|
||||
|
Loading…
Reference in New Issue
Block a user