| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef DMSrcSinkAndroid_DEFINED | 8 #ifndef DMSrcSinkAndroid_DEFINED |
| 9 #define DMSrcSinkAndroid_DEFINED | 9 #define DMSrcSinkAndroid_DEFINED |
| 10 | 10 |
| 11 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 11 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 12 | 12 |
| 13 #include "DMSrcSink.h" | 13 #include "DMSrcSink.h" |
| 14 | 14 |
| 15 namespace DM { | 15 namespace DM { |
| 16 | 16 |
| 17 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 17 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 18 | 18 |
| 19 // Draws to the Android Framework's HWUI API. | 19 // Draws to the Android Framework's HWUI API. |
| 20 | 20 |
| 21 class HWUISink : public Sink { | 21 class HWUISink : public Sink { |
| 22 public: | 22 public: |
| 23 HWUISink() { } | 23 HWUISink() { } |
| 24 | 24 |
| 25 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; | 25 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 26 int enclave() const override { return kGPU_Enclave; } | 26 bool serial() const override { return true; } |
| 27 const char* fileExtension() const override { return "png"; } | 27 const char* fileExtension() const override { return "png"; } |
| 28 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kGPU, SinkFl
ags::kDirect }; } | 28 SinkFlags flags() const override { return SinkFlags{ SinkFlags::kGPU, SinkFl
ags::kDirect }; } |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 31 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 32 | 32 |
| 33 // Trims draw commands to only include those supported by the Android Framework'
s HWUI API. | 33 // Trims draw commands to only include those supported by the Android Framework'
s HWUI API. |
| 34 | 34 |
| 35 class ViaAndroidSDK : public Sink { | 35 class ViaAndroidSDK : public Sink { |
| 36 public: | 36 public: |
| 37 explicit ViaAndroidSDK(Sink*); | 37 explicit ViaAndroidSDK(Sink*); |
| 38 | 38 |
| 39 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; | 39 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
| 40 int enclave() const override { return fSink->enclave(); } | 40 bool serial() const override { return fSink->serial(); } |
| 41 const char* fileExtension() const override { return fSink->fileExtension();
} | 41 const char* fileExtension() const override { return fSink->fileExtension();
} |
| 42 SinkFlags flags() const override { | 42 SinkFlags flags() const override { |
| 43 SinkFlags flags = fSink->flags(); | 43 SinkFlags flags = fSink->flags(); |
| 44 flags.approach = SinkFlags::kIndirect; | 44 flags.approach = SinkFlags::kIndirect; |
| 45 return flags; | 45 return flags; |
| 46 } | 46 } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 SkAutoTDelete<Sink> fSink; | 49 SkAutoTDelete<Sink> fSink; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 52 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 53 | 53 |
| 54 } // namespace DM | 54 } // namespace DM |
| 55 | 55 |
| 56 #endif // SK_BUILD_FOR_ANDROID_FRAMEWORK | 56 #endif // SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 57 | 57 |
| 58 #endif // DMSrcSinkAndroid_DEFINED | 58 #endif // DMSrcSinkAndroid_DEFINED |
| OLD | NEW |