1/*
2 * Copyright 2019 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 SkSGTransformPriv_DEFINED
9#define SkSGTransformPriv_DEFINED
10
11#include "modules/sksg/include/SkSGTransform.h"
12
13namespace sksg {
14
15// Helper for accessing implementation-private Transform methods.
16class TransformPriv final {
17public:
18
19 static bool Is44(const sk_sp<Transform>&t) { return t->is44(); }
20
21 template <typename T, typename = std::enable_if<std::is_same<T, SkMatrix>::value ||
22 std::is_same<T, SkM44 >::value >>
23 static T As(const sk_sp<Transform>&);
24
25private:
26 TransformPriv() = delete;
27};
28
29template <>
30inline SkMatrix TransformPriv::As<SkMatrix>(const sk_sp<Transform>& t) {
31 return t->asMatrix();
32}
33
34template <>
35inline SkM44 TransformPriv::As<SkM44>(const sk_sp<Transform>& t) {
36 return t->asM44();
37}
38
39} // namespace sksg
40
41#endif // SkSGTransformPriv_DEFINED
42