blob: 3d96bb65ac1dc746065d4485213213e1dc2d9c30 [file] [log] [blame]
Allan MacKinnon4359d522018-06-19 13:57:04 -07001/*
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
21skc_err
22skc_surface_retain(skc_surface_t surface)
23{
24 surface->ref_count += 1;
25
26 return SKC_ERR_SUCCESS;
27}
28
29skc_err
30skc_surface_release(skc_surface_t surface)
31{
32 surface->release(surface->impl);
33
34 return SKC_ERR_SUCCESS;
35}
36
Allan MacKinnon4359d522018-06-19 13:57:04 -070037//
38//
39//
40
41skc_err
Allan MacKinnonebf160f2018-06-24 08:31:14 -070042skc_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 skc_surface_render_notify notify,
48 void * data)
Allan MacKinnon4359d522018-06-19 13:57:04 -070049{
50 skc_err err;
51
52 // seal styling -- no dependencies so this will start immediately
53 if ((err = skc_styling_seal(styling)) != SKC_ERR_SUCCESS)
54 return err;
55
Allan MacKinnonebf160f2018-06-24 08:31:14 -070056 // seal composition -- force starts any dependent paths or rasters
Allan MacKinnon4359d522018-06-19 13:57:04 -070057 if ((err = skc_composition_seal(composition)) != SKC_ERR_SUCCESS)
58 return err;
59
60 //
Allan MacKinnonebf160f2018-06-24 08:31:14 -070061 // NOTE: there is purposefully no guard against any of the following
62 // use cases:
Allan MacKinnon4359d522018-06-19 13:57:04 -070063 //
Allan MacKinnonebf160f2018-06-24 08:31:14 -070064 // - Simultaneous renders to different frambuffers.
65 //
66 // - Simultaneous renders with potentially overlapping clips to
67 // the same framebuffer.
68 //
69 // NOTE: we may want to support concurrent rendering of
70 // non-overlapping clips. This is fairly easy but at this point
71 // doesn't seem like a common use case.
72 //
73 surface->render(surface->impl,styling,composition,fb,clip,notify,data);
Allan MacKinnon4359d522018-06-19 13:57:04 -070074
75 return SKC_ERR_SUCCESS;
76}
77
78//
79//
80//