Allan MacKinnon | 4359d52 | 2018-06-19 13:57:04 -0700 | [diff] [blame] | 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 | skc_err |
| 38 | skc_surface_clear(skc_surface_t surface, |
| 39 | float const rgba[4], |
| 40 | uint32_t const rect[4], |
| 41 | void * fb) |
| 42 | { |
| 43 | surface->clear(surface->impl,rgba,rect,fb); |
| 44 | |
| 45 | return SKC_ERR_SUCCESS; |
| 46 | } |
| 47 | |
| 48 | skc_err |
| 49 | skc_surface_blit(skc_surface_t surface, |
| 50 | uint32_t const rect[4], |
| 51 | int32_t const txty[2]) |
| 52 | { |
| 53 | surface->blit(surface->impl,rect,txty); |
| 54 | |
| 55 | return SKC_ERR_SUCCESS; |
| 56 | } |
| 57 | |
| 58 | // |
| 59 | // |
| 60 | // |
| 61 | |
| 62 | skc_err |
| 63 | skc_surface_render(skc_surface_t surface, |
| 64 | uint32_t const clip[4], |
| 65 | skc_styling_t styling, |
| 66 | skc_composition_t composition, |
| 67 | skc_surface_render_pfn_notify notify, |
| 68 | void * data, |
| 69 | void * fb) |
| 70 | { |
| 71 | skc_err err; |
| 72 | |
| 73 | // seal styling -- no dependencies so this will start immediately |
| 74 | if ((err = skc_styling_seal(styling)) != SKC_ERR_SUCCESS) |
| 75 | return err; |
| 76 | |
| 77 | // seal composition -- force started |
| 78 | if ((err = skc_composition_seal(composition)) != SKC_ERR_SUCCESS) |
| 79 | return err; |
| 80 | |
| 81 | // |
| 82 | // FIXME -- at some point, we will want non-overlapping clips to be |
| 83 | // rendered simultaneously. There is plenty of compute for nominal |
| 84 | // size render tasks so it might not make much a performance |
| 85 | // improvement. |
| 86 | // |
| 87 | surface->render(surface->impl,clip,styling,composition,notify,data,fb); |
| 88 | |
| 89 | return SKC_ERR_SUCCESS; |
| 90 | } |
| 91 | |
| 92 | // |
| 93 | // |
| 94 | // |