Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions projects/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ SDL2AUDIODIRS := \

BEAGLEBOARDDIRS := $(LINUXDIRS) $(DUMMYMIDIDIRS) $(RTAUDIODIRS) $(SDLDIRS)
DEBDIRS := $(DBDIRS) $(JACKDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
RASPIDIRS := $(DBDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
RG35XXPLUSDIRS := $(LINUXDIRS) $(DUMMYMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
DIRS := $(DBDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
RG35XXPLUSDIRS := $(LINUXDIRS) $(RTMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
STEAMDIRS := $(LINUXDIRS) $(JACKDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
X64DIRS := $(LINUXDIRS) $(RTMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
X86DIRS := $(LINUXDIRS) $(RTMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
Expand Down Expand Up @@ -326,7 +326,7 @@ SDLAUDIOFILES := \
DEBFILES := $(DBFILES) $(RTAUDIOFILES) $(RTMIDIFILES) $(JACKFILES)
BEAGLEBOARDFILES := $(LINUXFILES) $(DUMMYMIDIFILES)
RASPIFILES := $(DBFILES) $(RTAUDIOFILES) $(RTMIDIFILES)
RG35XXPLUSFILES := $(LINUXFILES) $(SDLAUDIOFILES) $(DUMMYMIDIFILES)
RG35XXPLUSFILES := $(LINUXFILES) $(SDLAUDIOFILES) $(RTMIDIFILES)
STEAMFILES := $(LINUXFILES) $(RTAUDIOFILES) $(RTMIDIFILES) $(JACKFILES)
X64FILES := $(LINUXFILES) $(RTMIDIFILES) $(SDLAUDIOFILES)
X86FILES := $(LINUXFILES) $(RTMIDIFILES) $(SDLAUDIOFILES)
Expand Down
13 changes: 8 additions & 5 deletions projects/Makefile.RG35XXPLUS
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ DEFINES := \
-DHAVE_STDINT_H \
-D_NDEBUG \
-D_NO_JACK_ \
-D__LINUX_ALSA__ \
-D__LINUX_ALSASEQ__ \
-DSDL2 \
-DSDLAUDIO \
-DDUMMYMIDI \
-DFFMPEG_ENABLED
-DSDLAUDIO \
-DRTMIDI \
-DFFMPEG_ENABLED \
-D_FEAT_MIDI_MULTITHREAD

DEVKIT := /opt/rg35xx-plus-aarch64-SDL2-SDK-0.1.0/
CROSS_COMPILE:=$(DEVKIT)bin/aarch64-none-linux-gnu-
Expand All @@ -27,8 +30,8 @@ SDL_LIBS := -lSDL2
OPT_FLAGS = -O3 -mlittle-endian -mabi=lp64 -march=armv8-a+crypto+crc -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -dumpbase
INCLUDES = -Iinclude $(SDL_CFLAGS) -I$(DEVKIT)/$(TRIPLET)/include -I$(DEVKIT)/$(TRIPLET)/include/c++/11/ -I$(PWD)/../sources
CFLAGS := $(DEFINES) $(INCLUDES) $(OPT_FLAGS) -Wall
CXXFLAGS:= $(CFLAGS) -std=gnu++03
LIBS := -Wl,-rpath-link,$(DEVKIT)/$(TRIPLET)/lib -Wl,-rpath-link,$(DEVKIT)/$(TRIPLET)/lib/pulseaudio $(SDL_LIBS) -lpthread
CXXFLAGS:= $(CFLAGS) -std=gnu++11
LIBS := -Wl,-rpath-link,$(DEVKIT)/$(TRIPLET)/lib -Wl,-rpath-link,$(DEVKIT)/$(TRIPLET)/lib/pulseaudio $(SDL_LIBS) -lpthread -lasound
OUTPUT = ../lgpt-rg35xxplus
EXTENSION:= elf

Expand Down
43 changes: 33 additions & 10 deletions sources/Adapters/SDL2/GUI/SDLGUIWindowImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ SDLGUIWindowImp::SDLGUIWindowImp(GUICreateWindowParams &p)
instance_=this ;
currentColor_=0;
backgroundColor_=0 ;
foregroundColor_=0 ;
SDL_ShowCursor(SDL_DISABLE);
FontConfig();

Expand Down Expand Up @@ -176,11 +177,17 @@ void SDLGUIWindowImp::prepareFullFonts()
for (int i=0;i<FONT_COUNT;i++)
{

fonts[i] = SDL_CreateRGBSurface(
if (fonts[i] == NULL)
{
fonts[i] = SDL_CreateRGBSurface(
SDL_SWSURFACE,
8*mult_, 8*mult_,
bitDepth_,
0, 0, 0, 0);
surface_->format->BitsPerPixel,
surface_->format->Rmask,
surface_->format->Gmask,
surface_->format->Bmask,
surface_->format->Amask);
}
if (fonts[i]==NULL)
{
Trace::Error("[DISPLAY] Failed to create font surface %d",i) ;
Expand Down Expand Up @@ -275,7 +282,12 @@ void SDLGUIWindowImp::DrawChar(const char c, GUIPoint &pos, GUITextProperties &p
area->w=8*mult_ ;
}

if (((cacheFonts_)&&(currentColor_==foregroundColor_)&&(!p.invert_))) {
bool useCache = false;
if (cacheFonts_ && (currentColor_ == foregroundColor_) && (!p.invert_)) {
useCache = true;
}

if (useCache) {

SDL_Rect srcRect ;
srcRect.x=0 ;
Expand All @@ -296,15 +308,15 @@ void SDLGUIWindowImp::DrawChar(const char c, GUIPoint &pos, GUITextProperties &p

} else {
// prepare bg & fg pixel ptr
int pixelSize=surface_->format->BytesPerPixel ;
int pixelSize=surface_->format->BytesPerPixel ;
unsigned char *bgPtr=(unsigned char *)&backgroundColor_ ;
unsigned char *fgPtr=(unsigned char *)&currentColor_ ;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
bgPtr+=(4-pixelSize) ;
fgPtr+=(4-pixelSize) ;
#endif
const unsigned char *src=font+c*8 ;
unsigned char *dest=((unsigned char *)surface_->pixels) + (yy*surface_->pitch) + xx*pixelSize;
unsigned char *dest=((unsigned char *)surface_->pixels) + (yy*surface_->pitch) + xx*pixelSize;

for (int y = 0; y < 8; y++) {
for (int n=0;n<mult_;n++) {
Expand Down Expand Up @@ -355,7 +367,12 @@ void SDLGUIWindowImp::DrawString(const char *string,GUIPoint &pos,GUITextPropert

for (int l=0;l<len;l++)
{
if (((cacheFonts_)&&(currentColor_==foregroundColor_)&&(!p.invert_)))
bool useCache = false;
if (cacheFonts_ && (currentColor_ == foregroundColor_) && (!p.invert_)) {
useCache = true;
}

if (useCache)
{
SDL_Rect srcRect ;
srcRect.x=0 ;
Expand All @@ -378,15 +395,15 @@ void SDLGUIWindowImp::DrawString(const char *string,GUIPoint &pos,GUITextPropert
else
{
// prepare bg & fg pixel ptr
int pixelSize=surface_->format->BytesPerPixel ;
int pixelSize=surface_->format->BytesPerPixel ;
unsigned char *bgPtr=(unsigned char *)&backgroundColor_ ;
unsigned char *fgPtr=(unsigned char *)&currentColor_ ;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
bgPtr+=(4-pixelSize) ;
fgPtr+=(4-pixelSize) ;
#endif
const unsigned char *src=font+(string[l]*8) ;
unsigned char *dest=((unsigned char *)surface_->pixels) + (yy*surface_->pitch) + xx*pixelSize;
unsigned char *dest=((unsigned char *)surface_->pixels) + (yy*surface_->pitch) + xx*pixelSize;

for (int y = 0; y < 8; y++) {
for (int n=0;n<mult_;n++) {
Expand Down Expand Up @@ -422,7 +439,13 @@ void SDLGUIWindowImp::Clear(GUIColor &c,bool overlay)
rect.w = screenRect_.Width();
rect.h = screenRect_.Height();

backgroundColor_=SDL_MapRGB(surface_->format,c._r&0xFF,c._g&0xFF,c._b&0xFF);
Uint32 newBg = SDL_MapRGB(surface_->format,c._r&0xFF,c._g&0xFF,c._b&0xFF);
if (newBg != backgroundColor_) {
backgroundColor_ = newBg;
if (cacheFonts_) {
prepareFullFonts();
}
}
SDL_FillRect(surface_, &rect,backgroundColor_) ;

if (!framebuffer_)
Expand Down
Loading