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