diff options
author | mtklein <mtklein@chromium.org> | 2015-10-16 10:29:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-16 10:29:41 -0700 |
commit | 2e2ea38bb77d42bab292919de5d80286cc354782 (patch) | |
tree | 59edecbf152d2e1d6eef652b473cbbd5ed552358 /dm | |
parent | a106c627532ad669cf7d879955ae8ea6a53233c1 (diff) |
SkRemote
BUG=skia:
Review URL: https://codereview.chromium.org/1391023005
Diffstat (limited to 'dm')
-rw-r--r-- | dm/DM.cpp | 2 | ||||
-rw-r--r-- | dm/DMSrcSink.cpp | 11 | ||||
-rw-r--r-- | dm/DMSrcSink.h | 6 |
3 files changed, 17 insertions, 2 deletions
@@ -611,6 +611,8 @@ static Sink* create_via(const char* tag, Sink* wrapped) { VIA("sp", ViaSingletonPictures, wrapped); VIA("tiles", ViaTiles, 256, 256, nullptr, wrapped); VIA("tiles_rt", ViaTiles, 256, 256, new SkRTreeFactory, wrapped); + VIA("remote", ViaRemote, false, wrapped); + VIA("remote_cache", ViaRemote, true, wrapped); if (FLAGS_matrix.count() == 4) { SkMatrix m; diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 4137154e99..394b84fa7b 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -23,6 +23,7 @@ #include "SkRandom.h" #include "SkRecordDraw.h" #include "SkRecorder.h" +#include "SkRemote.h" #include "SkSVGCanvas.h" #include "SkScaledCodec.h" #include "SkStream.h" @@ -1016,6 +1017,16 @@ Error ViaPipe::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStrin }); } +Error ViaRemote::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const { + return draw_to_canvas(fSink, bitmap, stream, log, src.size(), [&](SkCanvas* canvas) { + SkAutoTDelete<SkRemote::Cache> cache(fCache ? SkRemote::Cache::CreateAlwaysCache() + : SkRemote::Cache::CreateNeverCache()); + SkRemote::Server server(canvas); + SkRemote::Client client(cache, &server); + return src.draw(&client); + }); +} + /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ Error ViaSerialization::draw( diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h index d881137896..1beaec9a69 100644 --- a/dm/DMSrcSink.h +++ b/dm/DMSrcSink.h @@ -304,10 +304,12 @@ public: Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; }; -class ViaDeferred : public Via { +class ViaRemote : public Via { public: - explicit ViaDeferred(Sink* sink) : Via(sink) {} + ViaRemote(bool cache, Sink* sink) : Via(sink), fCache(cache) {} Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; +private: + bool fCache; }; class ViaSerialization : public Via { |