Fix some compile errors, not sure if all(nw)

This commit is contained in:
therealmogminer@gmail.com 2016-02-21 03:52:22 +01:00
parent bf033cfe00
commit c13089a065
50 changed files with 454 additions and 41 deletions

View File

@ -7,10 +7,12 @@
//============================================================ //============================================================
// standard windows headers // standard windows headers
#ifdef OSD_WINDOWS
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include <mmsystem.h> #include <mmsystem.h>
#endif
#include "osdwindow.h" #include "osdwindow.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// blendreader.cpp - BGFX blend state JSON reader
//
//============================================================
#include <bgfx/bgfx.h> #include <bgfx/bgfx.h>
#include "blendreader.h" #include "blendreader.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// blendreader.h - BGFX blend state JSON reader
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_BLEND_READER__ #ifndef __DRAWBGFX_BLEND_READER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// chain.cpp - BGFX screen-space post-effect chain
//
//============================================================
#include "slider.h" #include "slider.h"
#include "parameter.h" #include "parameter.h"
#include "chainentry.h" #include "chainentry.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// chain.h - BGFX screen-space post-effect chain
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_CHAIN__ #ifndef __DRAWBGFX_CHAIN__

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// chainentry.cpp - BGFX shader post-processing node
//
// Represents a single entry in a list of post-processing
// passes to be applied to a screen quad or buffer.
//
//============================================================
#include "emu.h" #include "emu.h"
#include <bgfx/bgfx.h> #include <bgfx/bgfx.h>

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// chainentry.h - BGFX shader post-processing node
//
// Represents a single entry in a list of post-processing
// passes to be applied to a screen quad or buffer.
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_CHAIN_ENTRY__ #ifndef __DRAWBGFX_CHAIN_ENTRY__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// chainentryreader.cpp - BGFX chain entry JSON reader
//
//============================================================
#include <string> #include <string>
#include "emu.h" #include "emu.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// chainentryreader.h - BGFX chain entry JSON reader
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_CHAIN_ENTRY_READER__ #ifndef __DRAWBGFX_CHAIN_ENTRY_READER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// chainreader.cpp - BGFX chain JSON reader
//
//============================================================
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// chainreader.h - BGFX chain JSON reader
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_CHAIN_READER__ #ifndef __DRAWBGFX_CHAIN_READER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// cullreader.cpp - BGFX cull state JSON reader
//
//============================================================
#include <bgfx/bgfx.h> #include <bgfx/bgfx.h>
#include "cullreader.h" #include "cullreader.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// cullreader.h - BGFX cull state JSON reader
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_CULL_READER__ #ifndef __DRAWBGFX_CULL_READER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// depthreader.cpp - BGFX depth state JSON reader
//
//============================================================
#include <bgfx/bgfx.h> #include <bgfx/bgfx.h>
#include "depthreader.h" #include "depthreader.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// depthreader.h - BGFX depth state JSON reader
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_DEPTH_READER__ #ifndef __DRAWBGFX_DEPTH_READER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// effect.cpp - BGFX shader material to be applied to a mesh
//
//============================================================
#include "effect.h" #include "effect.h"
bgfx_effect::bgfx_effect(uint64_t state, bgfx::ShaderHandle vertex_shader, bgfx::ShaderHandle fragment_shader, std::vector<bgfx_uniform*> uniforms) bgfx_effect::bgfx_effect(uint64_t state, bgfx::ShaderHandle vertex_shader, bgfx::ShaderHandle fragment_shader, std::vector<bgfx_uniform*> uniforms)

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// effect.h - BGFX shader material to be applied to a mesh
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_EFFECT__ #ifndef __DRAWBGFX_EFFECT__

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// effectmanager.cpp - BGFX shader effect manager
//
// Maintains a string-to-entry lookup of BGFX shader
// effects, defined by effect.h and read by effectreader.h
//
//============================================================
#include "emu.h" #include "emu.h"
#include <rapidjson/document.h> #include <rapidjson/document.h>

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// effectmanager.h - BGFX shader effect manager
//
// Maintains a string-to-entry lookup of BGFX shader
// effects, defined by effect.h and read by effectreader.h
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_EFFECT_MANAGER__ #ifndef __DRAWBGFX_EFFECT_MANAGER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// effectreader.cpp - BGFX effect JSON reader
//
//============================================================
#include <string> #include <string>
#include <bgfx/bgfx.h> #include <bgfx/bgfx.h>

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// effectreader.h - BGFX effect JSON reader
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_EFFECT_READER__ #ifndef __DRAWBGFX_EFFECT_READER__

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// inputpair.h - BGFX sampler-and-texture pair
//
// Keeps track of the texture which is bound to the sampler
// which is bound to the specified stage index.
//
//============================================================
#include "inputpair.h" #include "inputpair.h"
#include "texture.h" #include "texture.h"
#include "effect.h" #include "effect.h"

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// inputpair.h - BGFX sampler-and-texture pair
//
// Keeps track of the texture which is bound to the sampler
// which is bound to the specified stage index.
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_INPUT_PAIR__ #ifndef __DRAWBGFX_INPUT_PAIR__

View File

@ -1,5 +1,19 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// parameter.cpp - BGFX shader parameter
//
// A value that represents some form of parametric
// operation, which can be fed to the input of a BGFX
// shader uniform.
//
//============================================================
#include "emu.h" #include "emu.h"
// NB: NOT FINISHED!
#include "parameter.h" #include "parameter.h"
bgfx_parameter::bgfx_parameter(std::string name, parameter_type type, int period) bgfx_parameter::bgfx_parameter(std::string name, parameter_type type, int period)
@ -16,14 +30,27 @@ bgfx_parameter::~bgfx_parameter()
void bgfx_parameter::frame() void bgfx_parameter::frame()
{ {
m_frame++; switch(m_type)
if (m_frame == m_period)
{ {
m_frame = 0; case PARAM_FRAME_MASK:
m_frame++;
if (m_frame == m_period)
{
m_frame = 0;
}
break;
default:
break;
} }
} }
bool bgfx_parameter::active() bool bgfx_parameter::active()
{ {
return (m_frame % m_period == 0); switch (m_type)
{
case PARAM_FRAME_MASK:
return (m_frame % m_period == 0);
default:
return false;
}
} }

View File

@ -1,3 +1,15 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// parameter.h - BGFX shader parameter
//
// A value that represents some form of parametric
// operation, which can be fed to the input of a BGFX
// shader uniform.
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_PARAMETER__ #ifndef __DRAWBGFX_PARAMETER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// paramreader.cpp - BGFX shader parameter JSON reader
//
//============================================================
#include <string> #include <string>
#include "paramreader.h" #include "paramreader.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// paramreader.h - BGFX shader parameter JSON reader
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_PARAM_READER__ #ifndef __DRAWBGFX_PARAM_READER__

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// shadermanager.cpp - BGFX shader manager
//
// Maintains a mapping between strings and BGFX shaders,
// either vertex or pixel/fragment.
//
//============================================================
#include "emu.h" #include "emu.h"
#include <bgfx/bgfxplatform.h> #include <bgfx/bgfxplatform.h>

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// shadermanager.h - BGFX shader manager
//
// Maintains a mapping between strings and BGFX shaders,
// either vertex or pixel/fragment.
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_SHADER_MANAGER__ #ifndef __DRAWBGFX_SHADER_MANAGER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// slider.cpp - BGFX shader parameter slider
//
//============================================================
#include "emu.h" #include "emu.h"
#include "slider.h" #include "slider.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// slider.h - BGFX shader parameter slider
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_SLIDER__ #ifndef __DRAWBGFX_SLIDER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//==============================================================
//
// sliderreader.cpp - BGFX shader parameter slider JSON reader
//
//==============================================================
#include "emu.h" #include "emu.h"
#include "sliderreader.h" #include "sliderreader.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// sliderreader.h - BGFX shader parameter slider JSON reader
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_SLIDER_READER__ #ifndef __DRAWBGFX_SLIDER_READER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// target.cpp - Render target abstraction for BGFX layer
//
//============================================================
#include "target.h" #include "target.h"
bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, bool filter) bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, bool filter)

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// target.h - Render target abstraction for BGFX layer
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_TARGET__ #ifndef __DRAWBGFX_TARGET__

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// targetmanager.cpp - BGFX render target manager
//
// Maintains a string-to-entry mapping for any registered
// render targets.
//
//============================================================
#include <bgfx/bgfx.h> #include <bgfx/bgfx.h>
#include "targetmanager.h" #include "targetmanager.h"

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// targetmanager.h - BGFX render target manager
//
// Maintains a string-to-entry mapping for any registered
// render targets.
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_TARGET_MANAGER__ #ifndef __DRAWBGFX_TARGET_MANAGER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// texture.cpp - Texture abstraction for BGFX layer
//
//============================================================
#include "emu.h" #include "emu.h"
#include "texture.h" #include "texture.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// texture.h - Texture abstraction for BGFX layer
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_TEXTURE__ #ifndef __DRAWBGFX_TEXTURE__

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// texturemanager.cpp - BGFX texture manager
//
// Maintains a string-to-entry mapping for any registered
// textures.
//
//============================================================
#include <bgfx/bgfx.h> #include <bgfx/bgfx.h>
#include "texturemanager.h" #include "texturemanager.h"

View File

@ -1,3 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// texturemanager.h - BGFX texture manager
//
// Maintains a string-to-entry mapping for any registered
// textures.
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_TEXTURE_MANAGER__ #ifndef __DRAWBGFX_TEXTURE_MANAGER__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// uniform.cpp - Shader uniform abstraction for BGFX layer
//
//============================================================
#include "uniform.h" #include "uniform.h"
bgfx_uniform::bgfx_uniform(std::string name, bgfx::UniformType::Enum type) bgfx_uniform::bgfx_uniform(std::string name, bgfx::UniformType::Enum type)

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// uniform.h - Shader uniform abstraction for BGFX layer
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_UNIFORM__ #ifndef __DRAWBGFX_UNIFORM__

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// uniformreader.cpp - BGFX shader uniform JSON reader
//
//============================================================
#include "uniformreader.h" #include "uniformreader.h"
#include "uniform.h" #include "uniform.h"

View File

@ -1,3 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// uniformreader.h - BGFX shader uniform JSON reader
//
//============================================================
#pragma once #pragma once
#ifndef __DRAWBGFX_UNIFORM_READER__ #ifndef __DRAWBGFX_UNIFORM_READER__

View File

@ -62,7 +62,7 @@ static inline bool is_transparent(const float &a)
renderer_sdl1::renderer_sdl1(osd_window *window, int extra_flags) renderer_sdl1::renderer_sdl1(osd_window *window, int extra_flags)
: osd_renderer(window, extra_flags) : osd_renderer(window, extra_flags)
, m_sdl_renderer(NULL) , m_sdl_renderer(nullptr)
, m_blittimer(0) , m_blittimer(0)
, m_last_hofs(0) , m_last_hofs(0)
, m_last_vofs(0) , m_last_vofs(0)
@ -180,7 +180,7 @@ const copy_info_t renderer_sdl1::s_blit_info_default[] =
{ -1 }, { -1 },
}; };
copy_info_t* renderer_sdl1::s_blit_info[SDL_TEXFORMAT_LAST+1] = { NULL }; copy_info_t* renderer_sdl1::s_blit_info[SDL_TEXFORMAT_LAST+1] = { nullptr };
bool renderer_sdl1::s_blit_info_initialized = false; bool renderer_sdl1::s_blit_info_initialized = false;
//============================================================ //============================================================
@ -261,9 +261,9 @@ void texture_info::render_quad(const render_primitive *prim, const int x, const
set_coloralphamode(m_texture_id, &prim->color); set_coloralphamode(m_texture_id, &prim->color);
//printf("%d %d %d %d\n", target_rect.x, target_rect.y, target_rect.w, target_rect.h); //printf("%d %d %d %d\n", target_rect.x, target_rect.y, target_rect.w, target_rect.h);
// Arghhh .. Just another bug. SDL_RenderCopy has severe issues with scaling ... // Arghhh .. Just another bug. SDL_RenderCopy has severe issues with scaling ...
SDL_RenderCopy(m_renderer->m_sdl_renderer, m_texture_id, NULL, &target_rect); SDL_RenderCopy(m_renderer->m_sdl_renderer, m_texture_id, nullptr, &target_rect);
//SDL_RenderCopyEx(m_renderer->m_sdl_renderer, m_texture_id, NULL, &target_rect, 0, NULL, SDL_FLIP_NONE); //SDL_RenderCopyEx(m_renderer->m_sdl_renderer, m_texture_id, nullptr, &target_rect, 0, nullptr, SDL_FLIP_NONE);
//SDL_RenderCopyEx(m_renderer->m_sdl_renderer, m_texture_id, NULL, NULL, 0, NULL, SDL_FLIP_NONE); //SDL_RenderCopyEx(m_renderer->m_sdl_renderer, m_texture_id, nullptr, nullptr, 0, nullptr, SDL_FLIP_NONE);
} }
void renderer_sdl1::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y) void renderer_sdl1::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y)
@ -370,13 +370,13 @@ bool renderer_sdl1::init(running_machine &machine)
// Load the GL library now - else MT will fail // Load the GL library now - else MT will fail
const char *stemp = downcast<sdl_options &>(machine.options()).gl_lib(); const char *stemp = downcast<sdl_options &>(machine.options()).gl_lib();
#else #else
const char *stemp = NULL; const char *stemp = nullptr;
#endif #endif
if (stemp != NULL && strcmp(stemp, OSDOPTVAL_AUTO) == 0) if (stemp != nullptr && strcmp(stemp, OSDOPTVAL_AUTO) == 0)
stemp = NULL; stemp = nullptr;
// No fatalerror here since not all video drivers support GL ! // No fatalerror here since not all video drivers support GL !
if (SDL_GL_LoadLibrary(stemp) != 0) // Load library (default for e==NULL if (SDL_GL_LoadLibrary(stemp) != 0) // Load library (default for e==nullptr
osd_printf_warning("Warning: Unable to load opengl library: %s\n", stemp ? stemp : "<default>"); osd_printf_warning("Warning: Unable to load opengl library: %s\n", stemp ? stemp : "<default>");
else else
osd_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>"); osd_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>");
@ -408,12 +408,12 @@ static void drawsdl_show_info(struct SDL_RendererInfo *render_info)
RF_ENTRY(SDL_RENDERER_PRESENTVSYNC), RF_ENTRY(SDL_RENDERER_PRESENTVSYNC),
RF_ENTRY(SDL_RENDERER_ACCELERATED), RF_ENTRY(SDL_RENDERER_ACCELERATED),
RF_ENTRY(SDL_RENDERER_TARGETTEXTURE), RF_ENTRY(SDL_RENDERER_TARGETTEXTURE),
{-1, NULL} {-1, nullptr}
}; };
int i; int i;
osd_printf_verbose("window: using renderer %s\n", render_info->name ? render_info->name : "<unknown>"); osd_printf_verbose("window: using renderer %s\n", render_info->name ? render_info->name : "<unknown>");
for (i = 0; rflist[i].name != NULL; i++) for (i = 0; rflist[i].name != nullptr; i++)
if (render_info->flags & rflist[i].flag) if (render_info->flags & rflist[i].flag)
osd_printf_verbose("renderer: flag %s\n", rflist[i].name); osd_printf_verbose("renderer: flag %s\n", rflist[i].name);
} }
@ -500,7 +500,7 @@ void renderer_sdl1::destroy_all_textures()
int renderer_sdl1::draw(int update) int renderer_sdl1::draw(int update)
{ {
render_primitive *prim; render_primitive *prim;
texture_info *texture=NULL; texture_info *texture=nullptr;
float vofs, hofs; float vofs, hofs;
int blit_pixels = 0; int blit_pixels = 0;
@ -516,7 +516,7 @@ int renderer_sdl1::draw(int update)
destroy_all_textures(); destroy_all_textures();
m_width = wdim.width(); m_width = wdim.width();
m_height = wdim.height(); m_height = wdim.height();
SDL_RenderSetViewport(m_sdl_renderer, NULL); SDL_RenderSetViewport(m_sdl_renderer, nullptr);
m_blittimer = 3; m_blittimer = 3;
clear_flags(FI_CHANGED); clear_flags(FI_CHANGED);
} }
@ -529,7 +529,7 @@ int renderer_sdl1::draw(int update)
SDL_SetRenderDrawBlendMode(m_sdl_renderer, SDL_BLENDMODE_NONE); SDL_SetRenderDrawBlendMode(m_sdl_renderer, SDL_BLENDMODE_NONE);
//SDL_SetRenderDrawColor(0,0,0,255); //SDL_SetRenderDrawColor(0,0,0,255);
SDL_SetRenderDrawColor(m_sdl_renderer, 0,0,0,0); SDL_SetRenderDrawColor(m_sdl_renderer, 0,0,0,0);
SDL_RenderFillRect(m_sdl_renderer, NULL); SDL_RenderFillRect(m_sdl_renderer, nullptr);
m_blittimer--; m_blittimer--;
} }
@ -559,7 +559,7 @@ int renderer_sdl1::draw(int update)
window().m_primlist->acquire_lock(); window().m_primlist->acquire_lock();
// now draw // now draw
for (prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) for (prim = window().m_primlist->first(); prim != nullptr; prim = prim->next())
{ {
Uint8 sr, sg, sb, sa; Uint8 sr, sg, sb, sa;
@ -610,10 +610,10 @@ int renderer_sdl1::draw(int update)
copy_info_t *texture_info::compute_size_type() copy_info_t *texture_info::compute_size_type()
{ {
copy_info_t *result = NULL; copy_info_t *result = nullptr;
int maxperf = 0; int maxperf = 0;
for (copy_info_t *bi = renderer_sdl1::s_blit_info[m_format]; bi != NULL; bi = bi->next) for (copy_info_t *bi = renderer_sdl1::s_blit_info[m_format]; bi != nullptr; bi = bi->next)
{ {
if ((m_is_rotated == bi->blitter->m_is_rot) if ((m_is_rotated == bi->blitter->m_is_rot)
&& (m_sdl_blendmode == bi->bm_mask)) && (m_sdl_blendmode == bi->bm_mask))
@ -636,7 +636,7 @@ copy_info_t *texture_info::compute_size_type()
return result; return result;
/* try last resort handlers */ /* try last resort handlers */
for (copy_info_t *bi = renderer_sdl1::s_blit_info[m_format]; bi != NULL; bi = bi->next) for (copy_info_t *bi = renderer_sdl1::s_blit_info[m_format]; bi != nullptr; bi = bi->next)
{ {
if ((m_is_rotated == bi->blitter->m_is_rot) if ((m_is_rotated == bi->blitter->m_is_rot)
&& (m_sdl_blendmode == bi->bm_mask)) && (m_sdl_blendmode == bi->bm_mask))
@ -644,7 +644,7 @@ copy_info_t *texture_info::compute_size_type()
return bi; return bi;
} }
//FIXME: crash implement a -do nothing handler */ //FIXME: crash implement a -do nothing handler */
return NULL; return nullptr;
} }
// FIXME: // FIXME:
@ -739,7 +739,7 @@ texture_info::texture_info(renderer_sdl1 *renderer, const render_texinfo &texsou
if (m_sdl_access == SDL_TEXTUREACCESS_STATIC) if (m_sdl_access == SDL_TEXTUREACCESS_STATIC)
{ {
if (m_copyinfo->blitter->m_is_passthrough) if (m_copyinfo->blitter->m_is_passthrough)
m_pixels = NULL; m_pixels = nullptr;
else else
m_pixels = malloc(m_setup.rotwidth * m_setup.rotheight * m_copyinfo->blitter->m_dest_bpp); m_pixels = malloc(m_setup.rotwidth * m_setup.rotheight * m_copyinfo->blitter->m_dest_bpp);
} }
@ -749,7 +749,7 @@ texture_info::texture_info(renderer_sdl1 *renderer, const render_texinfo &texsou
texture_info::~texture_info() texture_info::~texture_info()
{ {
if ( is_pixels_owned() && (m_pixels != NULL) ) if ( is_pixels_owned() && (m_pixels != nullptr) )
free(m_pixels); free(m_pixels);
SDL_DestroyTexture(m_texture_id); SDL_DestroyTexture(m_texture_id);
} }
@ -773,11 +773,11 @@ void texture_info::set_data(const render_texinfo &texsource, const UINT32 flags)
m_pitch = m_setup.rotwidth * m_copyinfo->blitter->m_dest_bpp; m_pitch = m_setup.rotwidth * m_copyinfo->blitter->m_dest_bpp;
m_copyinfo->blitter->texop(this, &texsource); m_copyinfo->blitter->texop(this, &texsource);
} }
SDL_UpdateTexture(m_texture_id, NULL, m_pixels, m_pitch); SDL_UpdateTexture(m_texture_id, nullptr, m_pixels, m_pitch);
} }
else else
{ {
SDL_LockTexture(m_texture_id, NULL, (void **) &m_pixels, &m_pitch); SDL_LockTexture(m_texture_id, nullptr, (void **) &m_pixels, &m_pitch);
if ( m_copyinfo->blitter->m_is_passthrough ) if ( m_copyinfo->blitter->m_is_passthrough )
{ {
UINT8 *src = (UINT8 *) texsource.base; UINT8 *src = (UINT8 *) texsource.base;
@ -872,7 +872,7 @@ texture_info *renderer_sdl1::texture_find(const render_primitive &prim, const qu
osd_ticks_t now = osd_ticks(); osd_ticks_t now = osd_ticks();
// find a match // find a match
for (texture = m_texlist.first(); texture != NULL; ) for (texture = m_texlist.first(); texture != nullptr; )
if (texture->hash() == texhash && if (texture->hash() == texhash &&
texture->matches(prim, setup)) texture->matches(prim, setup))
{ {
@ -880,7 +880,7 @@ texture_info *renderer_sdl1::texture_find(const render_primitive &prim, const qu
if ((texture->m_copyinfo->samples & 0x7f) == 0x7f) if ((texture->m_copyinfo->samples & 0x7f) == 0x7f)
{ {
if (texture->m_copyinfo != texture->compute_size_type()) if (texture->m_copyinfo != texture->compute_size_type())
return NULL; return nullptr;
} }
texture->m_last_access = now; texture->m_last_access = now;
return texture; return texture;
@ -895,7 +895,7 @@ texture_info *renderer_sdl1::texture_find(const render_primitive &prim, const qu
} }
// nothing found // nothing found
return NULL; return nullptr;
} }
//============================================================ //============================================================
@ -912,16 +912,16 @@ texture_info * renderer_sdl1::texture_update(const render_primitive &prim)
texture = texture_find(prim, setup); texture = texture_find(prim, setup);
// if we didn't find one, create a new texture // if we didn't find one, create a new texture
if (texture == NULL && prim.texture.base != NULL) if (texture == nullptr && prim.texture.base != nullptr)
{ {
texture = global_alloc(texture_info(this, prim.texture, setup, prim.flags)); texture = global_alloc(texture_info(this, prim.texture, setup, prim.flags));
/* add us to the texture list */ /* add us to the texture list */
m_texlist.prepend(*texture); m_texlist.prepend(*texture);
} }
if (texture != NULL) if (texture != nullptr)
{ {
if (prim.texture.base != NULL && texture->texinfo().seqid != prim.texture.seqid) if (prim.texture.base != nullptr && texture->texinfo().seqid != prim.texture.seqid)
{ {
texture->texinfo().seqid = prim.texture.seqid; texture->texinfo().seqid = prim.texture.seqid;
// if we found it, but with a different seqid, copy the data // if we found it, but with a different seqid, copy the data

View File

@ -161,7 +161,7 @@ public:
{ {
for (int i = 0; i <= SDL_TEXFORMAT_LAST; i++) for (int i = 0; i <= SDL_TEXFORMAT_LAST; i++)
{ {
for (copy_info_t *bi = s_blit_info[i]; bi != NULL; ) for (copy_info_t *bi = s_blit_info[i]; bi != nullptr; )
{ {
if (bi->pixel_count) if (bi->pixel_count)
osd_printf_verbose("%s -> %s %s blendmode 0x%02x, %d samples: %d KPixel/sec\n", bi->srcname, bi->dstname, osd_printf_verbose("%s -> %s %s blendmode 0x%02x, %d samples: %d KPixel/sec\n", bi->srcname, bi->dstname,
@ -171,7 +171,7 @@ public:
bi = bi->next; bi = bi->next;
global_free(freeme); global_free(freeme);
} }
s_blit_info[i] = NULL; s_blit_info[i] = nullptr;
} }
s_blit_info_initialized = false; s_blit_info_initialized = false;
} }

View File

@ -16,7 +16,7 @@
renderer_gdi::~renderer_gdi() renderer_gdi::~renderer_gdi()
{ {
// free the bitmap memory // free the bitmap memory
if (m_bmdata != NULL) if (m_bmdata != nullptr)
global_free_array(m_bmdata); global_free_array(m_bmdata);
} }

View File

@ -31,7 +31,7 @@ class renderer_gdi : public osd_renderer
public: public:
renderer_gdi(osd_window *window) renderer_gdi(osd_window *window)
: osd_renderer(window, FLAG_NONE) : osd_renderer(window, FLAG_NONE)
, m_bmdata(NULL) , m_bmdata(nullptr)
, m_bmsize(0) , m_bmsize(0)
{ {
} }

View File

@ -22,10 +22,10 @@ public:
renderer_sdl2(osd_window *w, int extra_flags) renderer_sdl2(osd_window *w, int extra_flags)
: osd_renderer(w, extra_flags) : osd_renderer(w, extra_flags)
, m_sdl_renderer(NULL) , m_sdl_renderer(nullptr)
, m_texture_id(NULL) , m_texture_id(nullptr)
, m_yuv_lookup(NULL) , m_yuv_lookup(nullptr)
, m_yuv_bitmap(NULL) , m_yuv_bitmap(nullptr)
//, m_hw_scale_width(0) //, m_hw_scale_width(0)
//, m_hw_scale_height(0) //, m_hw_scale_height(0)
, m_last_hofs(0) , m_last_hofs(0)