project: Fix various warnings

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-03-01 11:33:19 +01:00
parent 133978bbca
commit c0f951d855
7 changed files with 28 additions and 30 deletions

View file

@ -132,7 +132,7 @@ filter::blur::blur_factory::blur_factory()
P_LOG_INFO("<filter-blur> Precalculating Gaussian Blur Kernel...");
this->gaussian_widths.resize(max_kernel_size + 1);
for (size_t w = 1.; w <= max_kernel_size; w++) {
for (size_t w = 1; w <= max_kernel_size; w++) {
for (double_t h = FLT_EPSILON; h <= w; h += search_density) {
if (util::math::gaussian<double_t>(w, h) > search_threshold) {
this->gaussian_widths[w] = h;
@ -203,11 +203,10 @@ void filter::blur::blur_factory::generate_gaussian_kernels()
std::shared_ptr<std::vector<float_t>> kernel_data;
for (size_t width = 1; width <= max_kernel_size; width++) {
size_t v = (width - 1) * size_power_of_two;
kernel_data = std::make_shared<std::vector<float_t>>(size_power_of_two);
// Calculate and normalize
float_t sum = 0;
double_t sum = 0;
for (size_t p = 0; p <= width; p++) {
math_data[p] = float_t(Gaussian1D(double_t(p), double_t(gaussian_widths[width])));
sum += math_data[p] * (p > 0 ? 2 : 1);
@ -216,7 +215,7 @@ void filter::blur::blur_factory::generate_gaussian_kernels()
// Normalize to Texture Buffer
double_t inverse_sum = 1.0 / sum;
for (size_t p = 0; p <= width; p++) {
kernel_data->at(p) = math_data[p] * inverse_sum;
kernel_data->at(p) = float_t(math_data[p] * inverse_sum);
}
gaussian_kernels.insert({uint8_t(width), kernel_data});
@ -228,7 +227,7 @@ void filter::blur::blur_factory::generate_kernel_textures()
generate_gaussian_kernels();
}
std::string& const filter::blur::blur_factory::get_translation(std::string const key)
std::string const& filter::blur::blur_factory::get_translation(std::string const key)
{
static std::string none("");
auto found = translation_map.find(key);
@ -639,13 +638,13 @@ obs_properties_t* filter::blur::blur_instance::get_properties()
OBS_COMBO_FORMAT_STRING);
obs_property_set_long_description(p, P_TRANSLATE(P_DESC(P_MASK_SOURCE)));
obs::source_tracker::get()->enumerate(
[this, &p](std::string name, obs_source_t* source) {
[this, &p](std::string name, obs_source_t*) {
obs_property_list_add_string(p, std::string(name + " (Source)").c_str(), name.c_str());
return false;
},
obs::source_tracker::filter_video_sources);
obs::source_tracker::get()->enumerate(
[this, &p](std::string name, obs_source_t* source) {
[this, &p](std::string name, obs_source_t*) {
obs_property_list_add_string(p, std::string(name + " (Scene)").c_str(), name.c_str());
return false;
},
@ -942,15 +941,15 @@ void filter::blur::blur_instance::video_render(gs_effect_t* effect)
double_t c0 = cos(rad);
double_t s0 = sin(rad);
kvs[0].first *= c0;
kvs[0].second *= s0;
kvs[0].first *= float_t(c0);
kvs[0].second *= float_t(s0);
if (!this->m_blur_step_scaling) {
kvs[1].first *= 0.0;
kvs[1].second *= 0.0;
kvs[1].first *= 0.0f;
kvs[1].second *= 0.0f;
} else {
kvs[1].first *= s0;
kvs[1].second *= c0;
kvs[1].first *= float_t(s0);
kvs[1].second *= float_t(c0);
}
}

View file

@ -87,7 +87,7 @@ namespace filter {
void generate_gaussian_kernels();
void generate_kernel_textures();
std::string& const get_translation(std::string const key);
std::string const& get_translation(std::string const key);
static void* create(obs_data_t* settings, obs_source_t* self);
static void destroy(void* source);

View file

@ -240,8 +240,8 @@ bool filter::sdf_effects::sdf_effects_instance::cb_modified_outside(void*, obs_p
return true;
}
bool filter::sdf_effects::sdf_effects_instance::cb_modified_advanced(void* ptr, obs_properties_t* props,
obs_property* prop, obs_data_t* settings)
bool filter::sdf_effects::sdf_effects_instance::cb_modified_advanced(void* , obs_properties_t* props,
obs_property* , obs_data_t* settings)
{
bool show_advanced = obs_data_get_bool(settings, S_ADVANCED);
obs_property_set_visible(obs_properties_get(props, P_SDF_SCALE), show_advanced);
@ -369,7 +369,7 @@ void filter::sdf_effects::sdf_effects_instance::activate() {}
void filter::sdf_effects::sdf_effects_instance::deactivate() {}
void filter::sdf_effects::sdf_effects_instance::video_tick(float time)
void filter::sdf_effects::sdf_effects_instance::video_tick(float )
{
m_source_rendered = false;
}
@ -447,7 +447,7 @@ void filter::sdf_effects::sdf_effects_instance::video_render(gs_effect_t*)
}
{
auto op = m_sdf_write->render(sdfW, sdfH);
auto op = m_sdf_write->render(uint32_t(sdfW), uint32_t(sdfH));
gs_ortho(0, (float)sdfW, 0, (float)sdfH, -1, 1);
gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH, &color_transparent, 0, 0);
@ -457,7 +457,7 @@ void filter::sdf_effects::sdf_effects_instance::video_render(gs_effect_t*)
sdf_effect->get_parameter("_threshold").set_float(0.5);
while (gs_effect_loop(sdf_effect->get_object(), "Draw")) {
gs_draw_sprite(this->m_sdf_texture->get_object(), 0, sdfW, sdfH);
gs_draw_sprite(this->m_sdf_texture->get_object(), 0, uint32_t(sdfW), uint32_t(sdfH));
}
}
this->m_sdf_write.swap(this->m_sdf_read);

View file

@ -70,7 +70,6 @@ gs::effect::effect(std::string file)
std::vector<char> shader_buf(length+1);
filestream.read(shader_buf.data(), length);
const char* buf = shader_buf.data();
obs_enter_graphics();
char* errorMessage = nullptr;

View file

@ -187,8 +187,8 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
if (source->get_type() == gs::texture::type::Normal) {
size_t texture_width = source->get_width();
size_t texture_height = source->get_height();
float_t texel_width = 1.0 / texture_width;
float_t texel_height = 1.0 / texture_height;
float_t texel_width = 1.0f / texture_width;
float_t texel_height = 1.0f / texture_height;
size_t mip_levels = 1;
#if defined(WIN32) || defined(WIN64)
@ -224,12 +224,12 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
texture_height = 1;
}
texel_width = 1.0 / texture_width;
texel_height = 1.0 / texture_height;
texel_width = 1.0f / texture_width;
texel_height = 1.0f / texture_height;
// Draw mipmap layer
try {
auto op = render_target->render(texture_width, texture_height);
auto op = render_target->render(uint32_t(texture_width), uint32_t(texture_height));
gs_set_cull_mode(GS_NEITHER);
gs_reset_blend_state();
@ -246,7 +246,7 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH, &black, 0, 0);
effect->get_parameter("image").set_texture(target);
effect->get_parameter("level").set_int(mip - 1);
effect->get_parameter("level").set_int(uint32_t(mip - 1));
effect->get_parameter("imageTexel").set_float2(texel_width, texel_height);
effect->get_parameter("strength").set_float(strength);
@ -262,7 +262,7 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
// Copy
ID3D11Texture2D* rt =
reinterpret_cast<ID3D11Texture2D*>(gs_texture_get_obj(render_target->get_object()));
uint32_t level = D3D11CalcSubresource(mip, 0, mip_levels);
uint32_t level = uint32_t(D3D11CalcSubresource(UINT(mip), 0, UINT(mip_levels)));
dev->context->CopySubresourceRegion(target_t2, level, 0, 0, 0, rt, 0, NULL);
}
#endif

View file

@ -28,13 +28,13 @@ struct scs_searchdata {
static bool scs_contains(scs_searchdata& sd, obs_source_t* source);
static void scs_enum_active_cb(obs_source_t* parent, obs_source_t* child, void* searchdata)
static void scs_enum_active_cb(obs_source_t* , obs_source_t* child, void* searchdata)
{
scs_searchdata& sd = reinterpret_cast<scs_searchdata&>(*reinterpret_cast<scs_searchdata*>(searchdata));
scs_contains(sd, child);
}
static bool scs_enum_items_cb(obs_scene_t* scene, obs_sceneitem_t* item, void* searchdata)
static bool scs_enum_items_cb(obs_scene_t* , obs_sceneitem_t* item, void* searchdata)
{
scs_searchdata& sd = reinterpret_cast<scs_searchdata&>(*reinterpret_cast<scs_searchdata*>(searchdata));
obs_source_t* source = obs_sceneitem_get_source(item);

View file

@ -362,7 +362,7 @@ void source::mirror::mirror_instance::acquire_input(std::string source_name)
}
}
source::mirror::mirror_instance::mirror_instance(obs_data_t* data, obs_source_t* src)
source::mirror::mirror_instance::mirror_instance(obs_data_t*, obs_source_t* src)
: m_self(src), m_active(true), m_tick(0), m_scene_rendered(false), m_rescale_enabled(false),
m_rescale_keep_orig_size(false), m_rescale_width(1), m_rescale_height(1),
m_rescale_type(obs_scale_type::OBS_SCALE_BICUBIC), m_rescale_bounds(obs_bounds_type::OBS_BOUNDS_STRETCH),