Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkOTTableTypes.h
Go to the documentation of this file.
1/*
2 * Copyright 2012 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 SkOTTableTypes_DEFINED
9#define SkOTTableTypes_DEFINED
10
12#include "src/base/SkEndian.h"
13
14//All SK_OT_ prefixed types should be considered as big endian.
15typedef uint8_t SK_OT_BYTE;
16#if CHAR_BIT == 8
17typedef signed char SK_OT_CHAR; //easier to debug
18#else
19typedef int8_t SK_OT_CHAR;
20#endif
21typedef uint16_t SK_OT_SHORT;
22typedef uint16_t SK_OT_USHORT;
23typedef uint32_t SK_OT_ULONG;
24typedef uint32_t SK_OT_LONG;
25//16.16 Signed fixed point representation.
26typedef int32_t SK_OT_Fixed;
27//2.14 Signed fixed point representation.
28typedef uint16_t SK_OT_F2DOT14;
29//F units are the units of measurement in em space.
30typedef uint16_t SK_OT_FWORD;
31typedef uint16_t SK_OT_UFWORD;
32//Number of seconds since 12:00 midnight, January 1, 1904.
33typedef uint64_t SK_OT_LONGDATETIME;
34
35#define SK_OT_BYTE_BITFIELD SK_UINT8_BITFIELD
36
37template<typename T> class SkOTTableTAG {
38public:
39 /**
40 * SkOTTableTAG<T>::value is the big endian value of an OpenType table tag.
41 * It may be directly compared with raw big endian table data.
42 */
44 SkSetFourByteTag(T::TAG0, T::TAG1, T::TAG2, T::TAG3)
45 );
46};
47
48/** SkOTSetUSHORTBit<N>::value is an SK_OT_USHORT with the Nth BE bit set. */
49template <unsigned N> struct SkOTSetUSHORTBit {
50 static_assert(N < 16, "NTooBig");
51 static const uint16_t bit = 1u << N;
53};
54
55/** SkOTSetULONGBit<N>::value is an SK_OT_ULONG with the Nth BE bit set. */
56template <unsigned N> struct SkOTSetULONGBit {
57 static_assert(N < 32, "NTooBig");
58 static const uint32_t bit = 1u << N;
60};
61
62#endif
#define SkTEndian_SwapBE32(n)
Definition SkEndian.h:143
#define SkTEndian_SwapBE16(n)
Definition SkEndian.h:142
uint8_t SK_OT_BYTE
uint16_t SK_OT_USHORT
uint32_t SK_OT_LONG
uint32_t SK_OT_ULONG
int8_t SK_OT_CHAR
uint16_t SK_OT_SHORT
int32_t SK_OT_Fixed
uint16_t SK_OT_F2DOT14
uint64_t SK_OT_LONGDATETIME
uint16_t SK_OT_FWORD
uint16_t SK_OT_UFWORD
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
Definition SkTypes.h:167
#define N
Definition beziers.cpp:19
static const SK_OT_ULONG value
static const uint32_t bit
static const SK_OT_ULONG value
static const uint16_t bit
static const SK_OT_USHORT value