2015-02-23 20:18:05 +00:00
|
|
|
/*
|
|
|
|
* 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 {
|
|
|
|
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
|
2015-03-05 16:01:07 +00:00
|
|
|
// Draws to the Android Framework's HWUI API.
|
|
|
|
|
2015-02-23 20:18:05 +00:00
|
|
|
class HWUISink : public Sink {
|
|
|
|
public:
|
|
|
|
HWUISink() { }
|
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
|
2016-02-08 22:30:25 +00:00
|
|
|
bool serial() const override { return true; }
|
2015-03-26 01:17:31 +00:00
|
|
|
const char* fileExtension() const override { return "png"; }
|
2015-08-03 17:20:28 +00:00
|
|
|
SinkFlags flags() const override { return SinkFlags{ SinkFlags::kGPU, SinkFlags::kDirect }; }
|
2015-02-23 20:18:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
|
2015-03-05 16:01:07 +00:00
|
|
|
// Trims draw commands to only include those supported by the Android Framework's HWUI API.
|
|
|
|
|
|
|
|
class ViaAndroidSDK : public Sink {
|
|
|
|
public:
|
|
|
|
explicit ViaAndroidSDK(Sink*);
|
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
|
2016-02-08 22:30:25 +00:00
|
|
|
bool serial() const override { return fSink->serial(); }
|
2015-03-26 01:17:31 +00:00
|
|
|
const char* fileExtension() const override { return fSink->fileExtension(); }
|
2015-08-03 17:20:28 +00:00
|
|
|
SinkFlags flags() const override {
|
|
|
|
SinkFlags flags = fSink->flags();
|
|
|
|
flags.approach = SinkFlags::kIndirect;
|
|
|
|
return flags;
|
|
|
|
}
|
2015-03-05 16:01:07 +00:00
|
|
|
|
|
|
|
private:
|
2016-11-03 18:40:50 +00:00
|
|
|
std::unique_ptr<Sink> fSink;
|
2015-03-05 16:01:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
|
2015-02-23 20:18:05 +00:00
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK
|
|
|
|
|
|
|
|
#endif // DMSrcSinkAndroid_DEFINED
|