blob: 61bfac3ee6cd60faead36444b80ffa0d176138cb [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
37skc_err
38skc_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
48skc_err
49skc_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
62skc_err
63skc_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//