1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can 5 * be found in the LICENSE file. 6 * 7 */ 8 9 #pragma once 10 11 // 12 // 13 // 14 15 #include "types.h" 16 17 // 18 // Add defensive high guard-bit flags to the opaque path and raster 19 // handles. This is tested once and stripped down to a handle. 20 // 21 // union skc_typed_handle 22 // { 23 // skc_uint u32; 24 // 25 // struct { 26 // skc_uint handle : 30; 27 // skc_uint is_path : 1; 28 // skc_uint is_raster : 1; 29 // }; 30 // struct { 31 // skc_uint na : 30; 32 // skc_uint type : 2; 33 // }; 34 // } 35 // 36 37 typedef enum skc_typed_handle_type_e 38 { 39 SKC_TYPED_HANDLE_TYPE_IS_PATH = 0x40000000, 40 SKC_TYPED_HANDLE_TYPE_IS_RASTER = 0x80000000 41 } skc_typed_handle_type_e; 42 43 typedef skc_uint skc_typed_handle_t; 44 typedef skc_uint skc_handle_t; 45 46 // 47 // 48 // 49 50 #define SKC_TYPED_HANDLE_MASK_TYPE (SKC_TYPED_HANDLE_TYPE_IS_PATH | SKC_TYPED_HANDLE_TYPE_IS_RASTER) 51 52 #define SKC_TYPED_HANDLE_TO_HANDLE(h) ((h) & ~SKC_TYPED_HANDLE_MASK_TYPE) 53 54 #define SKC_TYPED_HANDLE_IS_TYPE(h,t) ((h) & (t)) 55 #define SKC_TYPED_HANDLE_IS_PATH(h) ((h) & SKC_TYPED_HANDLE_TYPE_IS_PATH) 56 #define SKC_TYPED_HANDLE_IS_RASTER(h) ((h) & SKC_TYPED_HANDLE_TYPE_IS_RASTER) 57 58 // 59 // 60 // 61