1 module skia.SKGraphics; 2 3 import skia.SkiaApi; 4 import skia.Definitions; 5 6 struct SKGraphics { 7 static void Init() { 8 return SkiaApi.sk_graphics_init(); 9 } 10 11 // purge 12 13 static void PurgeFontCache() { 14 return SkiaApi.sk_graphics_purge_font_cache(); 15 } 16 17 static void PurgeResourceCache() { 18 return SkiaApi.sk_graphics_purge_resource_cache(); 19 } 20 21 static void PurgeAllCaches() { 22 return SkiaApi.sk_graphics_purge_all_caches(); 23 } 24 25 // font cache 26 27 static long GetFontCacheUsed() { 28 return cast(long) SkiaApi.sk_graphics_get_font_cache_used(); 29 } 30 31 static long GetFontCacheLimit() { 32 return cast(long) SkiaApi.sk_graphics_get_font_cache_limit(); 33 } 34 35 static long SetFontCacheLimit(long bytes) { 36 return cast(long) SkiaApi.sk_graphics_set_font_cache_limit(cast(void*) bytes); 37 } 38 39 static int GetFontCacheCountUsed() { 40 return SkiaApi.sk_graphics_get_font_cache_count_used(); 41 } 42 43 static int GetFontCacheCountLimit() { 44 return SkiaApi.sk_graphics_get_font_cache_count_limit(); 45 } 46 47 static int SetFontCacheCountLimit(int count) { 48 return SkiaApi.sk_graphics_set_font_cache_count_limit(count); 49 } 50 51 static int GetFontCachePointSizeLimit() { 52 return SkiaApi.sk_graphics_get_font_cache_point_size_limit(); 53 } 54 55 static int SetFontCachePointSizeLimit(int count) { 56 return SkiaApi.sk_graphics_set_font_cache_point_size_limit(count); 57 } 58 59 // resource cache 60 61 static long GetResourceCacheTotalBytesUsed() { 62 return cast(long) SkiaApi.sk_graphics_get_resource_cache_total_bytes_used(); 63 } 64 65 static long GetResourceCacheTotalByteLimit() { 66 return cast(long) SkiaApi.sk_graphics_get_resource_cache_total_byte_limit(); 67 } 68 69 static long SetResourceCacheTotalByteLimit(long bytes) { 70 return cast(long) SkiaApi.sk_graphics_set_resource_cache_total_byte_limit( 71 cast(void*) bytes); 72 } 73 74 static long GetResourceCacheSingleAllocationByteLimit() { 75 return cast(long) SkiaApi.sk_graphics_get_resource_cache_single_allocation_byte_limit(); 76 } 77 78 static long SetResourceCacheSingleAllocationByteLimit(long bytes) { 79 return cast(long) SkiaApi.sk_graphics_set_resource_cache_single_allocation_byte_limit( 80 cast(void*) bytes); 81 } 82 83 // dump 84 85 // static void DumpMemoryStatistics (SKTraceMemoryDump dump) 86 // { 87 // return SkiaApi.sk_graphics_dump_memory_statistics (dump.Handle ? dump.Handle : throw new ArgumentNullException (dump.stringof)); 88 // } 89 90 }