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 | |
Allan MacKinnon | 4359d52 | 2018-06-19 13:57:04 -0700 | [diff] [blame] | 37 | // |
| 38 | // |
| 39 | // |
| 40 | |
| 41 | skc_err |
Allan MacKinnon | ebf160f | 2018-06-24 08:31:14 -0700 | [diff] [blame] | 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], |
Allan MacKinnon | 9e0d7e4 | 2018-07-16 15:57:05 -0700 | [diff] [blame] | 47 | int32_t const txty[2], |
Allan MacKinnon | ebf160f | 2018-06-24 08:31:14 -0700 | [diff] [blame] | 48 | skc_surface_render_notify notify, |
| 49 | void * data) |
Allan MacKinnon | 4359d52 | 2018-06-19 13:57:04 -0700 | [diff] [blame] | 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 | |
Allan MacKinnon | ebf160f | 2018-06-24 08:31:14 -0700 | [diff] [blame] | 57 | // seal composition -- force starts any dependent paths or rasters |
Allan MacKinnon | 4359d52 | 2018-06-19 13:57:04 -0700 | [diff] [blame] | 58 | if ((err = skc_composition_seal(composition)) != SKC_ERR_SUCCESS) |
| 59 | return err; |
| 60 | |
| 61 | // |
Allan MacKinnon | ebf160f | 2018-06-24 08:31:14 -0700 | [diff] [blame] | 62 | // NOTE: there is purposefully no guard against any of the following |
| 63 | // use cases: |
Allan MacKinnon | 4359d52 | 2018-06-19 13:57:04 -0700 | [diff] [blame] | 64 | // |
Allan MacKinnon | ebf160f | 2018-06-24 08:31:14 -0700 | [diff] [blame] | 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 | // |
Allan MacKinnon | 9e0d7e4 | 2018-07-16 15:57:05 -0700 | [diff] [blame] | 74 | surface->render(surface->impl, |
| 75 | styling,composition, |
| 76 | fb,clip,txty, |
| 77 | notify,data); |
Allan MacKinnon | 4359d52 | 2018-06-19 13:57:04 -0700 | [diff] [blame] | 78 | |
| 79 | return SKC_ERR_SUCCESS; |
| 80 | } |
| 81 | |
| 82 | // |
| 83 | // |
| 84 | // |