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 // 10 // 11 // 12 13 #include "surface.h" 14 #include "composition.h" 15 #include "styling.h" 16 17 // 18 // 19 // 20 21 skc_err 22 skc_surface_retain(skc_surface_t surface) 23 { 24 surface->ref_count += 1; 25 26 return SKC_ERR_SUCCESS; 27 } 28 29 skc_err 30 skc_surface_release(skc_surface_t surface) 31 { 32 surface->release(surface->impl); 33 34 return SKC_ERR_SUCCESS; 35 } 36 37 // 38 // 39 // 40 41 skc_err 42 skc_surface_render(skc_surface_t surface, 43 skc_styling_t styling, 44 skc_composition_t composition, 45 skc_framebuffer_t fb, 46 uint32_t const clip[4], 47 int32_t const txty[2], 48 skc_surface_render_notify notify, 49 void * data) 50 { 51 skc_err err; 52 53 // seal styling -- no dependencies so this will start immediately 54 if ((err = skc_styling_seal(styling)) != SKC_ERR_SUCCESS) 55 return err; 56 57 // seal composition -- force starts any dependent paths or rasters 58 if ((err = skc_composition_seal(composition)) != SKC_ERR_SUCCESS) 59 return err; 60 61 // 62 // NOTE: there is purposefully no guard against any of the following 63 // use cases: 64 // 65 // - Simultaneous renders to different frambuffers. 66 // 67 // - Simultaneous renders with potentially overlapping clips to 68 // the same framebuffer. 69 // 70 // NOTE: we may want to support concurrent rendering of 71 // non-overlapping clips. This is fairly easy but at this point 72 // doesn't seem like a common use case. 73 // 74 surface->render(surface->impl, 75 styling,composition, 76 fb,clip,txty, 77 notify,data); 78 79 return SKC_ERR_SUCCESS; 80 } 81 82 // 83 // 84 // 85