blob: 107c02dd84b773896ea114282c190ba31d610282 [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],
Allan MacKinnon9e0d7e42018-07-16 15:57:05 -070047 int32_t const txty[2],
Allan MacKinnonebf160f2018-06-24 08:31:14 -070048 skc_surface_render_notify notify,
49 void * data)
Allan MacKinnon4359d522018-06-19 13:57:04 -070050{
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 MacKinnonebf160f2018-06-24 08:31:14 -070057 // seal composition -- force starts any dependent paths or rasters
Allan MacKinnon4359d522018-06-19 13:57:04 -070058 if ((err = skc_composition_seal(composition)) != SKC_ERR_SUCCESS)
59 return err;
60
61 //
Allan MacKinnonebf160f2018-06-24 08:31:14 -070062 // NOTE: there is purposefully no guard against any of the following
63 // use cases:
Allan MacKinnon4359d522018-06-19 13:57:04 -070064 //
Allan MacKinnonebf160f2018-06-24 08:31:14 -070065 // - 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 MacKinnon9e0d7e42018-07-16 15:57:05 -070074 surface->render(surface->impl,
75 styling,composition,
76 fb,clip,txty,
77 notify,data);
Allan MacKinnon4359d522018-06-19 13:57:04 -070078
79 return SKC_ERR_SUCCESS;
80}
81
82//
83//
84//