aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DMSrcSinkAndroid.h
diff options
context:
space:
mode:
authorGravatar tomhudson <tomhudson@google.com>2015-02-23 12:18:05 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-23 12:18:05 -0800
commiteebc39ad5a1dcbde1b10a9b2ab54679549522b52 (patch)
tree6bc6e0306b93f365d7c3cf5215b71181799be92e /dm/DMSrcSinkAndroid.h
parent7af21501a61886cac94f0bd5e1c14be2dce9ae63 (diff)
Add HWUI Sink to DM on Android Framework builds
Allows "hwui" as a --config argument to dm, drawing through the Android Framework's HWUI backend. R=djsollen@google.com,mtklein@google.com BUG=skia: Review URL: https://codereview.chromium.org/943393002
Diffstat (limited to 'dm/DMSrcSinkAndroid.h')
-rw-r--r--dm/DMSrcSinkAndroid.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/dm/DMSrcSinkAndroid.h b/dm/DMSrcSinkAndroid.h
new file mode 100644
index 0000000000..1c5fe71f18
--- /dev/null
+++ b/dm/DMSrcSinkAndroid.h
@@ -0,0 +1,38 @@
+/*
+ * 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 {
+
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+class HWUISink : public Sink {
+public:
+ HWUISink() { }
+
+ Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const SK_OVERRIDE;
+ int enclave() const SK_OVERRIDE { return kGPU_Enclave; }
+ const char* fileExtension() const SK_OVERRIDE { return "png"; }
+
+private:
+ const float kDensity = 1.0f;
+ inline float dp(int x) const { return x * kDensity; }
+};
+
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+} // namespace DM
+
+#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK
+
+#endif // DMSrcSinkAndroid_DEFINED