• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2014 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 SkOTTable_gasp_DEFINED
9 #define SkOTTable_gasp_DEFINED
10 
11 #include "SkEndian.h"
12 #include "SkOTTableTypes.h"
13 
14 #pragma pack(push, 1)
15 
16 struct SkOTTableGridAndScanProcedure {
17     static const SK_OT_CHAR TAG0 = 'g';
18     static const SK_OT_CHAR TAG1 = 'a';
19     static const SK_OT_CHAR TAG2 = 's';
20     static const SK_OT_CHAR TAG3 = 'p';
21     static const SK_OT_ULONG TAG = SkOTTableTAG<SkOTTableGridAndScanProcedure>::value;
22 
23     SK_OT_USHORT version;
24     static const SK_OT_USHORT version0 = SkTEndian_SwapBE16(0);
25     static const SK_OT_USHORT version1 = SkTEndian_SwapBE16(1);
26 
27     SK_OT_USHORT numRanges;
28 
29     struct GaspRange {
30         SK_OT_USHORT maxPPEM;
31         union behavior {
32             struct Field {
33                 //8-15
34                 SK_OT_BYTE_BITFIELD(
35                     Reserved08,
36                     Reserved09,
37                     Reserved10,
38                     Reserved11,
39                     Reserved12,
40                     Reserved13,
41                     Reserved14,
42                     Reserved15)
43                 //0-7
44                 SK_OT_BYTE_BITFIELD(
45                     Gridfit,
46                     DoGray,
47                     SymmetricGridfit,  // Version 1
48                     SymmetricSmoothing,  // Version 1
49                     Reserved04,
50                     Reserved05,
51                     Reserved06,
52                     Reserved07)
53             } field;
54             struct Raw {
55                 static const SK_OT_USHORT GridfitMask = SkTEndian_SwapBE16(1 << 0);
56                 static const SK_OT_USHORT DoGrayMask = SkTEndian_SwapBE16(1 << 1);
57                 static const SK_OT_USHORT SymmetricGridfitMask = SkTEndian_SwapBE16(1 << 2);
58                 static const SK_OT_USHORT SymmetricSmoothingMask = SkTEndian_SwapBE16(1 << 3);
59                 SK_OT_USHORT value;
60             } raw;
61         } flags;
62     }; //gaspRange[numRanges]
63 };
64 
65 #pragma pack(pop)
66 
67 
68 #include <stddef.h>
69 static_assert(offsetof(SkOTTableGridAndScanProcedure, numRanges) == 2, "SkOTTableGridAndScanProcedure_numRanges_not_at_2");
70 static_assert(sizeof(SkOTTableGridAndScanProcedure) == 4, "sizeof_SkOTTableGridAndScanProcedure_not_4");
71 
72 #endif
73