diff options
Diffstat (limited to 'dm')
-rw-r--r-- | dm/DM.cpp | 9 | ||||
-rw-r--r-- | dm/DMSrcSinkAndroid.cpp | 69 | ||||
-rw-r--r-- | dm/DMSrcSinkAndroid.h | 58 |
3 files changed, 0 insertions, 136 deletions
@@ -7,7 +7,6 @@ #include "DMJsonWriter.h" #include "DMSrcSink.h" -#include "DMSrcSinkAndroid.h" #include "ProcStats.h" #include "Resources.h" #include "SkBBHFactory.h" @@ -859,10 +858,6 @@ static Sink* create_sink(const SkCommandLineConfig* config) { #define SINK(t, sink, ...) if (config->getBackend().equals(t)) { return new sink(__VA_ARGS__); } -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - SINK("hwui", HWUISink); -#endif - if (FLAGS_cpu) { auto srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); auto srgbLinearColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGBLinear_Named); @@ -908,10 +903,6 @@ static Sink* create_via(const SkString& tag, Sink* wrapped) { VIA("upright", ViaUpright, m, wrapped); } -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - VIA("androidsdk", ViaAndroidSDK, wrapped); -#endif - #undef VIA return nullptr; } diff --git a/dm/DMSrcSinkAndroid.cpp b/dm/DMSrcSinkAndroid.cpp deleted file mode 100644 index da2b924267..0000000000 --- a/dm/DMSrcSinkAndroid.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "DMSrcSink.h" -#include "DMSrcSinkAndroid.h" - -#include "SkAndroidSDKCanvas.h" -#include "SkCanvas.h" -#include "SkiaCanvasProxy.h" -#include "SkStream.h" -#include <utils/TestWindowContext.h> - -/* These functions are only compiled in the Android Framework. */ - -namespace DM { - -Error HWUISink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) const { - android::uirenderer::TestWindowContext renderer; - renderer.initialize(src.size().width(), src.size().height()); - SkCanvas* canvas = renderer.prepareToDraw(); - Error err = src.draw(canvas); - if (!err.isEmpty()) { - return err; - } - renderer.finishDrawing(); - renderer.fence(); - renderer.capturePixels(dst); - return ""; -} - -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - -ViaAndroidSDK::ViaAndroidSDK(Sink* sink) : fSink(sink) { } - -Error ViaAndroidSDK::draw(const Src& src, - SkBitmap* bitmap, - SkWStream* stream, - SkString* log) const { - struct ProxySrc : public Src { - const Src& fSrc; - ProxySrc(const Src& src) - : fSrc(src) {} - - Error draw(SkCanvas* canvas) const override { - // Pass through HWUI's upper layers to get operational transforms - std::unique_ptr<android::Canvas> ac(android::Canvas::create_canvas(canvas)); - std::unique_ptr<android::uirenderer::SkiaCanvasProxy> scProxy - (new android::uirenderer::SkiaCanvasProxy(ac.get())); - - // Pass through another proxy to get paint transforms - SkAndroidSDKCanvas fc; - fc.reset(scProxy.get()); - - fSrc.draw(&fc); - - return ""; - } - SkISize size() const override { return fSrc.size(); } - Name name() const override { sk_throw(); return ""; } - } proxy(src); - - return fSink->draw(proxy, bitmap, stream, log); -} - -} // namespace DM diff --git a/dm/DMSrcSinkAndroid.h b/dm/DMSrcSinkAndroid.h deleted file mode 100644 index 6717df675f..0000000000 --- a/dm/DMSrcSinkAndroid.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef DMSrcSinkAndroid_DEFINED -#define DMSrcSinkAndroid_DEFINED - -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - -#include "DMSrcSink.h" - -namespace DM { - -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - -// Draws to the Android Framework's HWUI API. - -class HWUISink : public Sink { -public: - HWUISink() { } - - Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; - bool serial() const override { return true; } - const char* fileExtension() const override { return "png"; } - SinkFlags flags() const override { return SinkFlags{ SinkFlags::kGPU, SinkFlags::kDirect }; } -}; - -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - -// Trims draw commands to only include those supported by the Android Framework's HWUI API. - -class ViaAndroidSDK : public Sink { -public: - explicit ViaAndroidSDK(Sink*); - - Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; - bool serial() const override { return fSink->serial(); } - const char* fileExtension() const override { return fSink->fileExtension(); } - SinkFlags flags() const override { - SinkFlags flags = fSink->flags(); - flags.approach = SinkFlags::kIndirect; - return flags; - } - -private: - std::unique_ptr<Sink> fSink; -}; - -/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - -} // namespace DM - -#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK - -#endif // DMSrcSinkAndroid_DEFINED |