From c8f740168ff32222a35ab2a3809c7664d7a2432e Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Thu, 21 Dec 2017 16:16:09 -0500 Subject: remove obsolete DM test configs ViaSingletonPictures simulates a load pattern that Blink no longer produces. I don't even remember what Via2ndPic and ViaTwice are meant to test, but I imagine they're quite obsolete. There was a lingering reference to ViaMojo, which otherwise doesn't exist. Bug: skia:7544 Change-Id: I033fd344314054ad66c363e5dbd0a373be188069 Reviewed-on: https://skia-review.googlesource.com/88780 Reviewed-by: Mike Reed Commit-Queue: Mike Klein --- dm/DM.cpp | 3 -- dm/DMSrcSink.cpp | 112 ------------------------------------------------------- dm/DMSrcSink.h | 24 ------------ 3 files changed, 139 deletions(-) (limited to 'dm') diff --git a/dm/DM.cpp b/dm/DM.cpp index 8e22c7e2ec..4f0dcd6a8c 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -929,14 +929,11 @@ static Sink* create_via(const SkString& tag, Sink* wrapped) { VIA("gbr", ViaCSXform, wrapped, rgb_to_gbr(), true); VIA("lite", ViaLite, wrapped); VIA("pipe", ViaPipe, wrapped); - VIA("twice", ViaTwice, wrapped); #ifdef TEST_VIA_SVG VIA("svg", ViaSVG, wrapped); #endif VIA("serialize", ViaSerialization, wrapped); VIA("pic", ViaPicture, wrapped); - VIA("2ndpic", ViaSecondPicture, wrapped); - VIA("sp", ViaSingletonPictures, wrapped); VIA("tiles", ViaTiles, 256, 256, nullptr, wrapped); VIA("tiles_rt", ViaTiles, 256, 256, new SkRTreeFactory, wrapped); diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 506d3fb52e..618064e8a3 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -2070,46 +2070,6 @@ Error ViaPipe::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStrin /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -// Draw the Src into two pictures, then draw the second picture into the wrapped Sink. -// This tests that any shortcuts we may take while recording that second picture are legal. -Error ViaSecondPicture::draw( - const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const { - auto size = src.size(); - return draw_to_canvas(fSink.get(), bitmap, stream, log, size, [&](SkCanvas* canvas) -> Error { - SkPictureRecorder recorder; - sk_sp pic; - for (int i = 0; i < 2; i++) { - Error err = src.draw(recorder.beginRecording(SkIntToScalar(size.width()), - SkIntToScalar(size.height()))); - if (!err.isEmpty()) { - return err; - } - pic = recorder.finishRecordingAsPicture(); - } - canvas->drawPicture(pic); - return check_against_reference(bitmap, src, fSink.get()); - }); -} - -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - -// Draw the Src twice. This can help exercise caching. -Error ViaTwice::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const { - return draw_to_canvas(fSink.get(), bitmap, stream, log, src.size(), [&](SkCanvas* canvas) -> Error { - for (int i = 0; i < 2; i++) { - SkAutoCanvasRestore acr(canvas, true/*save now*/); - canvas->clear(SK_ColorTRANSPARENT); - Error err = src.draw(canvas); - if (err.isEmpty()) { - return err; - } - } - return check_against_reference(bitmap, src, fSink.get()); - }); -} - -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - #ifdef TEST_VIA_SVG #include "SkXMLWriter.h" #include "SkSVGCanvas.h" @@ -2137,78 +2097,6 @@ Error ViaSVG::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -// This is like SkRecords::Draw, in that it plays back SkRecords ops into a Canvas. -// Unlike SkRecords::Draw, it builds a single-op sub-picture out of each Draw-type op. -// This is an only-slightly-exaggerated simluation of Blink's Slimming Paint pictures. -struct DrawsAsSingletonPictures { - SkCanvas* fCanvas; - const SkDrawableList& fDrawables; - SkRect fBounds; - - template - void draw(const T& op, SkCanvas* canvas) { - // We must pass SkMatrix::I() as our initial matrix. - // By default SkRecords::Draw() uses the canvas' matrix as its initial matrix, - // which would have the funky effect of applying transforms over and over. - SkRecords::Draw d(canvas, nullptr, fDrawables.begin(), fDrawables.count(), &SkMatrix::I()); - d(op); - } - - // Draws get their own picture. - template - SK_WHEN(T::kTags & SkRecords::kDraw_Tag, void) operator()(const T& op) { - SkPictureRecorder rec; - this->draw(op, rec.beginRecording(fBounds)); - sk_sp pic(rec.finishRecordingAsPicture()); - fCanvas->drawPicture(pic); - } - - // We'll just issue non-draws directly. - template - skstd::enable_if_t operator()(const T& op) { - this->draw(op, fCanvas); - } -}; - -// Record Src into a picture, then record it into a macro picture with a sub-picture for each draw. -// Then play back that macro picture into our wrapped sink. -Error ViaSingletonPictures::draw( - const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const { - auto size = src.size(); - return draw_to_canvas(fSink.get(), bitmap, stream, log, size, [&](SkCanvas* canvas) -> Error { - // Use low-level (Skia-private) recording APIs so we can read the SkRecord. - SkRecord skr; - SkRecorder recorder(&skr, size.width(), size.height()); - Error err = src.draw(&recorder); - if (!err.isEmpty()) { - return err; - } - - // Record our macro-picture, with each draw op as its own sub-picture. - SkPictureRecorder macroRec; - SkCanvas* macroCanvas = macroRec.beginRecording(SkIntToScalar(size.width()), - SkIntToScalar(size.height())); - - std::unique_ptr drawables(recorder.detachDrawableList()); - const SkDrawableList empty; - - DrawsAsSingletonPictures drawsAsSingletonPictures = { - macroCanvas, - drawables ? *drawables : empty, - SkRect::MakeWH((SkScalar)size.width(), (SkScalar)size.height()), - }; - for (int i = 0; i < skr.count(); i++) { - skr.visit(i, drawsAsSingletonPictures); - } - sk_sp macroPic(macroRec.finishRecordingAsPicture()); - - canvas->drawPicture(macroPic); - return check_against_reference(bitmap, src, fSink.get()); - }); -} - -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - Error ViaLite::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const { auto size = src.size(); SkIRect bounds = {0,0, size.width(), size.height()}; diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h index d44655a477..db1e064d72 100644 --- a/dm/DMSrcSink.h +++ b/dm/DMSrcSink.h @@ -514,36 +514,12 @@ private: std::unique_ptr fFactory; }; -class ViaSecondPicture : public Via { -public: - explicit ViaSecondPicture(Sink* sink) : Via(sink) {} - Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; -}; - -class ViaSingletonPictures : public Via { -public: - explicit ViaSingletonPictures(Sink* sink) : Via(sink) {} - Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; -}; - -class ViaTwice : public Via { -public: - explicit ViaTwice(Sink* sink) : Via(sink) {} - Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; -}; - class ViaSVG : public Via { public: explicit ViaSVG(Sink* sink) : Via(sink) {} Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; }; -class ViaMojo : public Via { -public: - explicit ViaMojo(Sink* sink) : Via(sink) {} - Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; -}; - class ViaLite : public Via { public: explicit ViaLite(Sink* sink) : Via(sink) {} -- cgit v1.2.3