1 /* 2 * Copyright 2016 Google Inc. 3 * 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 * 8 */ 9 10 #include "SkContext_Compute.h" 11 12 // 13 // 14 // 15 16 // 17 // 18 // 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 #ifdef __cplusplus 25 } 26 #endif 27 28 #define TARGET_PLATFORM_SUBSTRING "TO BE SET" 29 #define TARGET_DEVICE_SUBSTRING "TO BE SET" 30 31 // 32 // 33 // 34 35 // 36 // 37 // 38 SkContext_Compute(GrGLInterface const * fInterface)39SkContext_Compute::SkContext_Compute(GrGLInterface const * fInterface) 40 : fInterface(fInterface) 41 { 42 // 43 // Make sure fInterface destruction occurs after compute 44 // 45 SkSafeRef(fInterface); 46 47 skc_err err; 48 49 // 50 // CREATE A NEW SPINEL CONTEXT AND ATTACH TO WINDOW 51 // 52 err = skc_context_create(&context, TARGET_PLATFORM_SUBSTRING, TARGET_DEVICE_SUBSTRING); 53 SKC_ERR_CHECK(err); 54 55 // 56 // CREATE A NEW REUSABLE INTEROP OBJECT 57 // 58 // interop = skc_interop_create(fInterface,1); TODO have this in skc.h 59 60 // 61 // CREATE A NEW REUSABLE SURFACE OBJECT 62 // 63 err = skc_surface_create(context, 64 interop, 65 &surface); 66 SKC_ERR_CHECK(err); 67 } 68 69 // 70 // 71 // 72 ~SkContext_Compute()73SkContext_Compute::~SkContext_Compute() 74 { 75 skc_err err; 76 77 // dispose of surface 78 err = skc_surface_dispose(surface); 79 SKC_ERR_CHECK(err); 80 81 // dispose of interop 82 // skc_interop_dispose(interop); TODO have this in skc.h 83 84 // dispose of context 85 err = skc_context_release(context); 86 SKC_ERR_CHECK(err); 87 88 // unref GL interface 89 SkSafeUnref(fInterface); 90 } 91 92 // 93 // 94 // 95 96