Remove DMSrcSinkAndroid.
This code involves Skia having knowledge of HWUI internals and causes problems with various build systems. It is also not currently being used and is therefore expendable. Change-Id: I7b6a37fa4c9afcefbc6a957b49e7735da872ff14 Reviewed-on: https://skia-review.googlesource.com/6597 Commit-Queue: Derek Sollenberger <djsollen@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com>
This commit is contained in:
parent
d4e75e24a7
commit
c65386ae55
@ -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;
|
||||
}
|
||||
|
@ -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
|
@ -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
|
@ -16,10 +16,6 @@
|
||||
['skia_android_framework', {
|
||||
'libraries': [
|
||||
'skia_static.a',
|
||||
'hwui_static.a',
|
||||
],
|
||||
'sources': [
|
||||
'../dm/DMSrcSinkAndroid.cpp',
|
||||
],
|
||||
'dependencies': [
|
||||
'tools.gyp:android_utils',
|
||||
|
@ -433,7 +433,6 @@ DM_SRCS_ALL = struct(
|
||||
"tools/timer/*.h",
|
||||
],
|
||||
exclude = [
|
||||
"dm/DMSrcSinkAndroid.cpp", # Android-only.
|
||||
"tests/FontMgrAndroidParserTest.cpp", # Android-only.
|
||||
"tests/PathOpsSkpClipTest.cpp", # Alternate main.
|
||||
"tests/skia_test.cpp", # Old main.
|
||||
@ -459,8 +458,6 @@ DM_SRCS_UNIX = struct(
|
||||
|
||||
DM_SRCS_ANDROID = struct(
|
||||
include = [
|
||||
# Depends on Android HWUI library that is not available in google3.
|
||||
#"dm/DMSrcSinkAndroid.cpp",
|
||||
"tests/FontMgrAndroidParserTest.cpp",
|
||||
# TODO(benjaminwagner): Figure out how to compile with EGL.
|
||||
"tools/gpu/gl/CreatePlatformGLContext_none.cpp",
|
||||
|
@ -19,9 +19,6 @@ static const char defaultConfigs[] =
|
||||
"8888 gpu nonrendering"
|
||||
#if defined(SK_BUILD_FOR_WIN)
|
||||
" angle_d3d11_es2"
|
||||
#endif
|
||||
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||
" hwui"
|
||||
#endif
|
||||
;
|
||||
|
||||
@ -82,11 +79,7 @@ static const struct {
|
||||
};
|
||||
|
||||
static const char configHelp[] =
|
||||
"Options: 565 8888 srgb f16 nonrendering null pdf pdfa skp pipe svg xps"
|
||||
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||
" hwui"
|
||||
#endif
|
||||
;
|
||||
"Options: 565 8888 srgb f16 nonrendering null pdf pdfa skp pipe svg xps";
|
||||
|
||||
static const char* config_help_fn() {
|
||||
static SkString helpString;
|
||||
|
Loading…
Reference in New Issue
Block a user