mirror of https://github.com/stella-emu/stella.git
Merge branch 'master' of https://github.com/stella-emu/stella
This commit is contained in:
commit
337375a2b2
|
@ -24,6 +24,8 @@
|
|||
* The Linux builds now use the system-installed PNG and ZLIB libraries
|
||||
by default.
|
||||
|
||||
* Fixed configure/build scripts to work natively under OpenBSD.
|
||||
|
||||
-Have fun!
|
||||
|
||||
|
||||
|
|
4
Makefile
4
Makefile
|
@ -147,7 +147,7 @@ CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2"
|
|||
|
||||
.c.o:
|
||||
$(MKDIR) $(*D)/$(DEPDIR)
|
||||
$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
||||
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
||||
$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
|
||||
$(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
|
||||
$(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
|
||||
|
@ -162,7 +162,7 @@ else
|
|||
|
||||
.c.o:
|
||||
$(MKDIR) $(*D)/$(DEPDIR)
|
||||
$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
||||
$(CC) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
||||
endif
|
||||
|
||||
# Include the dependency tracking files. We add /dev/null at the end
|
||||
|
|
|
@ -578,7 +578,7 @@ if test "$_libpng" = auto ; then
|
|||
#include <png.h>
|
||||
int main(void) { return printf("%s\n", PNG_HEADER_VERSION_STRING); }
|
||||
EOF
|
||||
cc_check $LDFLAGS $CXXFLAGS $LIBPNG_CFLAGS $LIBPNG_LIBS -lpng && _libpng=yes
|
||||
cc_check $LDFLAGS $CXXFLAGS $LIBPNG_CFLAGS $LIBPNG_LIBS `pkg-config --libs libpng` && _libpng=yes
|
||||
fi
|
||||
if test "$_libpng" = yes ; then
|
||||
_zlib=auto
|
||||
|
|
|
@ -28,8 +28,7 @@ FBSurfaceSDL2::FBSurfaceSDL2(FrameBufferSDL2& buffer,
|
|||
myTexAccess(SDL_TEXTUREACCESS_STREAMING),
|
||||
myInterpolate(false),
|
||||
myBlendEnabled(false),
|
||||
myBlendAlpha(255),
|
||||
myStaticData(nullptr)
|
||||
myBlendAlpha(255)
|
||||
{
|
||||
createSurface(width, height, data);
|
||||
}
|
||||
|
@ -38,15 +37,12 @@ FBSurfaceSDL2::FBSurfaceSDL2(FrameBufferSDL2& buffer,
|
|||
FBSurfaceSDL2::~FBSurfaceSDL2()
|
||||
{
|
||||
if(mySurface)
|
||||
{
|
||||
SDL_FreeSurface(mySurface);
|
||||
mySurface = nullptr;
|
||||
}
|
||||
|
||||
free();
|
||||
|
||||
if(myStaticData)
|
||||
{
|
||||
delete[] myStaticData;
|
||||
myStaticData = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -173,7 +169,7 @@ void FBSurfaceSDL2::reload()
|
|||
|
||||
// If the data is static, we only upload it once
|
||||
if(myTexAccess == SDL_TEXTUREACCESS_STATIC)
|
||||
SDL_UpdateTexture(myTexture, nullptr, myStaticData, myStaticPitch);
|
||||
SDL_UpdateTexture(myTexture, nullptr, myStaticData.get(), myStaticPitch);
|
||||
|
||||
// Blending enabled?
|
||||
if(myBlendEnabled)
|
||||
|
@ -225,8 +221,8 @@ void FBSurfaceSDL2::createSurface(uInt32 width, uInt32 height,
|
|||
{
|
||||
myTexAccess = SDL_TEXTUREACCESS_STATIC;
|
||||
myStaticPitch = mySurface->w * 4; // we need pitch in 'bytes'
|
||||
myStaticData = new uInt32[mySurface->w * mySurface->h];
|
||||
SDL_memcpy(myStaticData, data, mySurface->w * mySurface->h * 4);
|
||||
myStaticData = make_unique<uInt32[]>(mySurface->w * mySurface->h);
|
||||
SDL_memcpy(myStaticData.get(), data, mySurface->w * mySurface->h * 4);
|
||||
}
|
||||
|
||||
applyAttributes(false);
|
||||
|
|
|
@ -88,8 +88,8 @@ class FBSurfaceSDL2 : public FBSurface
|
|||
bool myBlendEnabled; // Blending is enabled
|
||||
uInt8 myBlendAlpha; // Alpha to use in blending mode
|
||||
|
||||
uInt32* myStaticData; // The data to use when the buffer contents are static
|
||||
uInt32 myStaticPitch; // The number of bytes in a row of static data
|
||||
unique_ptr<uInt32[]> myStaticData; // The data to use when the buffer contents are static
|
||||
uInt32 myStaticPitch; // The number of bytes in a row of static data
|
||||
|
||||
GUI::Rect mySrcGUIR, myDstGUIR;
|
||||
};
|
||||
|
|
|
@ -59,6 +59,12 @@ FrameBufferSDL2::~FrameBufferSDL2()
|
|||
|
||||
if(myRenderer)
|
||||
{
|
||||
// Make sure to free surfaces/textures before destroying the renderer itself
|
||||
// Most platforms are fine with doing this in either order, but it seems
|
||||
// that OpenBSD in particular crashes when attempting to destroy textures
|
||||
// *after* the renderer is already destroyed
|
||||
freeSurfaces();
|
||||
|
||||
SDL_DestroyRenderer(myRenderer);
|
||||
myRenderer = nullptr;
|
||||
}
|
||||
|
@ -317,8 +323,8 @@ void FrameBufferSDL2::setWindowIcon()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
unique_ptr<FBSurface> FrameBufferSDL2::createSurface(uInt32 w, uInt32 h,
|
||||
const uInt32* data) const
|
||||
unique_ptr<FBSurface>
|
||||
FrameBufferSDL2::createSurface(uInt32 w, uInt32 h, const uInt32* data) const
|
||||
{
|
||||
return make_unique<FBSurfaceSDL2>(const_cast<FrameBufferSDL2&>(*this), w, h, data);
|
||||
}
|
||||
|
|
|
@ -145,8 +145,8 @@ class FrameBufferSDL2 : public FrameBuffer
|
|||
@param h The requested height of the new surface.
|
||||
@param data If non-null, use the given data values as a static surface
|
||||
*/
|
||||
unique_ptr<FBSurface> createSurface(uInt32 w, uInt32 h, const uInt32* data)
|
||||
const override;
|
||||
unique_ptr<FBSurface>
|
||||
createSurface(uInt32 w, uInt32 h, const uInt32* data) const override;
|
||||
|
||||
/**
|
||||
Grabs or ungrabs the mouse based on the given boolean value.
|
||||
|
|
|
@ -552,6 +552,20 @@ shared_ptr<FBSurface> FrameBuffer::allocateSurface(int w, int h, const uInt32* d
|
|||
return mySurfaceList.at(mySurfaceList.size() - 1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::freeSurfaces()
|
||||
{
|
||||
for(auto& s: mySurfaceList)
|
||||
s->free();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::reloadSurfaces()
|
||||
{
|
||||
for(auto& s: mySurfaceList)
|
||||
s->reload();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::resetSurfaces()
|
||||
{
|
||||
|
@ -561,10 +575,8 @@ void FrameBuffer::resetSurfaces()
|
|||
// Any derived FrameBuffer classes that call this method should be
|
||||
// aware of these restrictions, and act accordingly
|
||||
|
||||
for(auto& s: mySurfaceList)
|
||||
s->free();
|
||||
for(auto& s: mySurfaceList)
|
||||
s->reload();
|
||||
freeSurfaces();
|
||||
reloadSurfaces();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -349,8 +349,18 @@ class FrameBuffer
|
|||
@param h The requested height of the new surface.
|
||||
@param data If non-null, use the given data values as a static surface
|
||||
*/
|
||||
virtual unique_ptr<FBSurface> createSurface(uInt32 w, uInt32 h,
|
||||
const uInt32* data) const = 0;
|
||||
virtual unique_ptr<FBSurface>
|
||||
createSurface(uInt32 w, uInt32 h, const uInt32* data) const = 0;
|
||||
|
||||
/**
|
||||
Calls 'free()' on all surfaces that the framebuffer knows about.
|
||||
*/
|
||||
void freeSurfaces();
|
||||
|
||||
/**
|
||||
Calls 'reload()' on all surfaces that the framebuffer knows about.
|
||||
*/
|
||||
void reloadSurfaces();
|
||||
|
||||
/**
|
||||
Grabs or ungrabs the mouse based on the given boolean value.
|
||||
|
@ -386,8 +396,7 @@ class FrameBuffer
|
|||
void drawMessage();
|
||||
|
||||
/**
|
||||
Issues a 'free' and 'reload' instruction to all surfaces that the
|
||||
framebuffer knows about.
|
||||
Frees and reloads all surfaces that the framebuffer knows about.
|
||||
*/
|
||||
void resetSurfaces();
|
||||
|
||||
|
|
Loading…
Reference in New Issue