Skip to content

Commit 175d79f

Browse files
committed
Updated base backend implementation
1 parent da155f9 commit 175d79f

File tree

2 files changed

+44
-38
lines changed

2 files changed

+44
-38
lines changed

include/lsp-plug.in/r3d/base/backend.h

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,32 @@ namespace lsp
3232
{
3333
typedef struct base_backend_t: public backend_t
3434
{
35-
mat4_t matProjection;
36-
mat4_t matView;
37-
mat4_t matWorld;
35+
mat4_t matProjection;
36+
mat4_t matView;
37+
mat4_t matWorld;
3838

39-
color_t colBackground;
39+
color_t colBackground;
4040

41-
ssize_t viewLeft;
42-
ssize_t viewTop;
43-
ssize_t viewWidth;
44-
ssize_t viewHeight;
41+
ssize_t viewLeft;
42+
ssize_t viewTop;
43+
ssize_t viewWidth;
44+
ssize_t viewHeight;
4545

46-
static void init_matrix_identity(mat4_t *m);
47-
static void matrix_mul(mat4_t *r, const mat4_t *s, const mat4_t *m);
46+
static void init_matrix_identity(mat4_t *m);
47+
static void matrix_mul(mat4_t *r, const mat4_t *s, const mat4_t *m);
4848

49-
explicit base_backend_t();
49+
explicit base_backend_t();
50+
void construct();
5051

51-
static status_t init(backend_t *handle);
52-
static void destroy(backend_t *handle);
52+
static status_t init(backend_t *handle);
53+
static void destroy(backend_t *handle);
5354

54-
static status_t locate(backend_t *handle, ssize_t left, ssize_t top, ssize_t width, ssize_t height);
55-
static status_t set_matrix(backend_t *handle, matrix_type_t type, const mat4_t *m);
56-
static status_t get_matrix(backend_t *handle, matrix_type_t type, mat4_t *m);
57-
static status_t set_bg_color(backend_t *handle, const color_t *color);
58-
static status_t get_bg_color(backend_t *handle, color_t *color);
59-
static status_t get_location(backend_t *handle, ssize_t *left, ssize_t *top, ssize_t *width, ssize_t *height);
55+
static status_t locate(backend_t *handle, ssize_t left, ssize_t top, ssize_t width, ssize_t height);
56+
static status_t set_matrix(backend_t *handle, matrix_type_t type, const mat4_t *m);
57+
static status_t get_matrix(backend_t *handle, matrix_type_t type, mat4_t *m);
58+
static status_t set_bg_color(backend_t *handle, const color_t *color);
59+
static status_t get_bg_color(backend_t *handle, color_t *color);
60+
static status_t get_location(backend_t *handle, ssize_t *left, ssize_t *top, ssize_t *width, ssize_t *height);
6061

6162
} base_backend_t;
6263
}

src/main/base_backend.cpp

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,30 @@ namespace lsp
2626
{
2727
namespace r3d
2828
{
29+
void base_backend_t::construct()
30+
{
31+
viewLeft = 0;
32+
viewTop = 0;
33+
viewWidth = 0;
34+
viewHeight = 0;
35+
36+
// Initialize vtable
37+
#define R3D_BASE_BACKEND_EXP(func) backend_t::func = base_backend_t::func;
38+
R3D_BASE_BACKEND_EXP(destroy);
39+
R3D_BASE_BACKEND_EXP(locate);
40+
R3D_BASE_BACKEND_EXP(set_matrix);
41+
R3D_BASE_BACKEND_EXP(get_matrix);
42+
R3D_BASE_BACKEND_EXP(get_location);
43+
R3D_BASE_BACKEND_EXP(get_bg_color);
44+
R3D_BASE_BACKEND_EXP(set_bg_color);
45+
#undef R3D_BASE_BACKEND_EXP
46+
}
47+
48+
base_backend_t::base_backend_t()
49+
{
50+
construct();
51+
}
52+
2953
void base_backend_t::init_matrix_identity(mat4_t *m)
3054
{
3155
::bzero(m, sizeof(mat4_t));
@@ -166,24 +190,5 @@ namespace lsp
166190

167191
return STATUS_OK;
168192
}
169-
170-
base_backend_t::base_backend_t()
171-
{
172-
viewLeft = 0;
173-
viewTop = 0;
174-
viewWidth = 0;
175-
viewHeight = 0;
176-
177-
// Initialize vtable
178-
#define R3D_BASE_BACKEND_EXP(func) backend_t::func = base_backend_t::func;
179-
R3D_BASE_BACKEND_EXP(destroy);
180-
R3D_BASE_BACKEND_EXP(locate);
181-
R3D_BASE_BACKEND_EXP(set_matrix);
182-
R3D_BASE_BACKEND_EXP(get_matrix);
183-
R3D_BASE_BACKEND_EXP(get_location);
184-
R3D_BASE_BACKEND_EXP(get_bg_color);
185-
R3D_BASE_BACKEND_EXP(set_bg_color);
186-
#undef R3D_BASE_BACKEND_EXP
187-
}
188193
}
189194
}

0 commit comments

Comments
 (0)