From 9762d021a951907966ad80c4f3647051f8e75ae9 Mon Sep 17 00:00:00 2001 From: Hironori Fujimoto Date: Sat, 25 Feb 2017 16:57:59 +0900 Subject: [PATCH 1/3] make multi chunk sentences visible in help pages adjust_surface_alpha with SDL_ALPHA_TRANSPARENT makes the surface transparent completely, so fix it --- src/font/sdl_ttf.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/font/sdl_ttf.cpp b/src/font/sdl_ttf.cpp index 0c0f84bbfc87..f12e7d571be7 100644 --- a/src/font/sdl_ttf.cpp +++ b/src/font/sdl_ttf.cpp @@ -306,7 +306,6 @@ static surface render_text(const std::string& text, int fontsize, const color_t& adjust_surface_alpha(surf, SDL_ALPHA_OPAQUE); return surf; } else { - surface res(create_compatible_surface(surfaces.front().front(),width,height)); if (res.null()) return res; @@ -319,7 +318,7 @@ static surface render_text(const std::string& text, int fontsize, const color_t& for(std::vector::iterator j = i->begin(), j_end = i->end(); j != j_end; ++j) { - adjust_surface_alpha(*j, SDL_ALPHA_TRANSPARENT); // direct blit without alpha blending + adjust_surface_alpha(*j, SDL_ALPHA_OPAQUE); // direct blit without alpha blending SDL_Rect dstrect = sdl::create_rect(xpos, ypos, 0, 0); sdl_blit(*j, nullptr, res, &dstrect); xpos += (*j)->w; From 7544b139b664c5a6883aced4ddb99881309dab4f Mon Sep 17 00:00:00 2001 From: Hironori Fujimoto Date: Sat, 25 Feb 2017 17:06:31 +0900 Subject: [PATCH 2/3] change sdl_blit to blit_surface, in order to prevent alpha blending --- src/font/sdl_ttf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/font/sdl_ttf.cpp b/src/font/sdl_ttf.cpp index f12e7d571be7..1725d96d5b22 100644 --- a/src/font/sdl_ttf.cpp +++ b/src/font/sdl_ttf.cpp @@ -320,7 +320,7 @@ static surface render_text(const std::string& text, int fontsize, const color_t& j_end = i->end(); j != j_end; ++j) { adjust_surface_alpha(*j, SDL_ALPHA_OPAQUE); // direct blit without alpha blending SDL_Rect dstrect = sdl::create_rect(xpos, ypos, 0, 0); - sdl_blit(*j, nullptr, res, &dstrect); + blit_surface(*j, nullptr, res, &dstrect); xpos += (*j)->w; height = std::max((*j)->h, height); } From b8456fead58b9144b24fc5631b19a056e5c5ebf5 Mon Sep 17 00:00:00 2001 From: Hironori Fujimoto Date: Tue, 28 Feb 2017 11:25:58 +0900 Subject: [PATCH 3/3] remove useless adjust_surface_alpha() --- src/font/sdl_ttf.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/font/sdl_ttf.cpp b/src/font/sdl_ttf.cpp index 1725d96d5b22..a112bdcd7052 100644 --- a/src/font/sdl_ttf.cpp +++ b/src/font/sdl_ttf.cpp @@ -303,7 +303,6 @@ static surface render_text(const std::string& text, int fontsize, const color_t& return surface(); } else if (surfaces.size() == 1 && surfaces.front().size() == 1) { surface surf = surfaces.front().front(); - adjust_surface_alpha(surf, SDL_ALPHA_OPAQUE); return surf; } else { surface res(create_compatible_surface(surfaces.front().front(),width,height)); @@ -318,7 +317,6 @@ static surface render_text(const std::string& text, int fontsize, const color_t& for(std::vector::iterator j = i->begin(), j_end = i->end(); j != j_end; ++j) { - adjust_surface_alpha(*j, SDL_ALPHA_OPAQUE); // direct blit without alpha blending SDL_Rect dstrect = sdl::create_rect(xpos, ypos, 0, 0); blit_surface(*j, nullptr, res, &dstrect); xpos += (*j)->w;