aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layer.cpp5
-rw-r--r--layer.h3
-rw-r--r--layer_image.cpp9
-rw-r--r--layer_video.cpp6
-rw-r--r--osc_server.h10
5 files changed, 14 insertions, 19 deletions
diff --git a/layer.cpp b/layer.cpp
index 8820834..6dbfa71 100644
--- a/layer.cpp
+++ b/layer.cpp
@@ -7,11 +7,8 @@
#include "osc_server.h"
#include "layer.h"
-Layer::Layer(const char *name)
+Layer::Layer(const char *_name) : mutex(SDL_CreateMutex()), name(strdup(_name))
{
- mutex = SDL_CreateMutex();
- Layer::name = strdup(name);
-
geo_osc_id = register_method("geo", GEO_TYPES, geo_osc);
alpha_osc_id = register_method("alpha", "f", alpha_osc);
}
diff --git a/layer.h b/layer.h
index 109535a..d06707c 100644
--- a/layer.h
+++ b/layer.h
@@ -108,10 +108,9 @@ class LayerList {
}
public:
- LayerList()
+ LayerList() : mutex(SDL_CreateMutex())
{
SLIST_INIT(&head);
- mutex = SDL_CreateMutex();
}
~LayerList()
{
diff --git a/layer_image.cpp b/layer_image.cpp
index 897175a..0a8b508 100644
--- a/layer_image.cpp
+++ b/layer_image.cpp
@@ -17,7 +17,7 @@ rgba_blit_with_alpha(SDL_Surface *src_surf, SDL_Surface *dst_surf, Uint8 alpha)
{
SDL_FillRect(dst_surf, NULL,
SDL_MapRGBA(dst_surf->format,
- 0, 0, 0, SDL_ALPHA_TRANSPARENT));
+ 0, 0, 0, SDL_ALPHA_TRANSPARENT));
SDL_gfxBlitRGBA(src_surf, NULL, dst_surf, NULL);
SDL_gfxMultiplyAlpha(dst_surf, alpha);
}
@@ -60,8 +60,9 @@ rgba_blit_with_alpha(SDL_Surface *src_surf, SDL_Surface *dst_surf, Uint8 alpha)
#endif
LayerImage::LayerImage(const char *name, SDL_Rect geo, float opacity,
- const char *file) : Layer(name), surf_alpha(NULL),
- surf_scaled(NULL), surf(NULL)
+ const char *file) :
+ Layer(name),
+ surf_alpha(NULL), surf_scaled(NULL), surf(NULL)
{
file_osc_id = register_method("file", "s",
(OSCServer::MethodHandlerCb)file_osc);
@@ -137,7 +138,7 @@ LayerImage::alpha(float opacity)
if (alpha == SDL_ALPHA_TRANSPARENT) {
SDL_FillRect(surf_alpha, NULL,
SDL_MapRGBA(surf_alpha->format,
- 0, 0, 0, SDL_ALPHA_TRANSPARENT));
+ 0, 0, 0, SDL_ALPHA_TRANSPARENT));
} else {
rgba_blit_with_alpha(use_surf, surf_alpha, alpha);
}
diff --git a/layer_video.cpp b/layer_video.cpp
index eb179cb..eafe67a 100644
--- a/layer_video.cpp
+++ b/layer_video.cpp
@@ -27,7 +27,9 @@ static void display_cb(void *data, void *id);
}
LayerVideo::LayerVideo(const char *name, SDL_Rect geo, float opacity,
- const char *url) : Layer(name), mp(NULL), surf(NULL)
+ const char *url) :
+ Layer(name), mp(NULL), surf(NULL),
+ mutex(SDL_CreateMutex())
{
/* static initialization */
if (!vlcinst) {
@@ -54,8 +56,6 @@ LayerVideo::LayerVideo(const char *name, SDL_Rect geo, float opacity,
LayerVideo::rate(1.);
LayerVideo::paused(true);
- mutex = SDL_CreateMutex();
-
LayerVideo::url(url);
}
diff --git a/osc_server.h b/osc_server.h
index 3244096..f6d0c51 100644
--- a/osc_server.h
+++ b/osc_server.h
@@ -21,12 +21,10 @@ public:
char *path;
void *data;
- MethodHandlerId(const char *types, const char *path,
- void *d = NULL) : data(d)
- {
- MethodHandlerId::types = strdup(types);
- MethodHandlerId::path = strdup(path);
- }
+ MethodHandlerId(const char *_types, const char *_path,
+ void *_data = NULL) :
+ types(strdup(_types)), path(strdup(_path)),
+ data(_data) {}
~MethodHandlerId()
{
free(types);