Coverage Report

Created: 2021-08-22 09:07

/src/skia/modules/sksg/src/SkSGTransformPriv.h
Line
Count
Source
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
13
namespace sksg {
14
15
// Helper for accessing implementation-private Transform methods.
16
class TransformPriv final {
17
public:
18
19
7.46k
    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
25
private:
26
    TransformPriv() = delete;
27
};
28
29
template <>
30
42.0k
inline SkMatrix TransformPriv::As<SkMatrix>(const sk_sp<Transform>& t) {
31
42.0k
    return t->asMatrix();
32
42.0k
}
33
34
template <>
35
5.46k
inline SkM44 TransformPriv::As<SkM44>(const sk_sp<Transform>& t) {
36
5.46k
    return t->asM44();
37
5.46k
}
38
39
} // namespace sksg
40
41
#endif // SkSGTransformPriv_DEFINED