blob: 1a7459f6e81cea5bdee273c325d7c47d9b3e4e03 [file] [log] [blame]
tomhudsoneebc39a2015-02-23 12:18:05 -08001/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef DMSrcSinkAndroid_DEFINED
9#define DMSrcSinkAndroid_DEFINED
10
11#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
12
13#include "DMSrcSink.h"
14
15namespace DM {
16
17/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
18
tomhudson64de1e12015-03-05 08:01:07 -080019// Draws to the Android Framework's HWUI API.
20
tomhudsoneebc39a2015-02-23 12:18:05 -080021class HWUISink : public Sink {
22public:
23 HWUISink() { }
24
25 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const SK_OVERRIDE;
26 int enclave() const SK_OVERRIDE { return kGPU_Enclave; }
27 const char* fileExtension() const SK_OVERRIDE { return "png"; }
tomhudsoneebc39a2015-02-23 12:18:05 -080028};
29
30/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
31
tomhudson64de1e12015-03-05 08:01:07 -080032// Trims draw commands to only include those supported by the Android Framework's HWUI API.
33
34class ViaAndroidSDK : public Sink {
35public:
36 explicit ViaAndroidSDK(Sink*);
37
38 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const SK_OVERRIDE;
39 int enclave() const SK_OVERRIDE { return fSink->enclave(); }
40 const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension(); }
41
42private:
43 SkAutoTDelete<Sink> fSink;
44};
45
46/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
47
tomhudsoneebc39a2015-02-23 12:18:05 -080048} // namespace DM
49
50#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK
51
52#endif // DMSrcSinkAndroid_DEFINED