From 2c4ace897ee1355bddbc11ba079bd7f588d62d73 Mon Sep 17 00:00:00 2001 From: rachytski Date: Tue, 14 Dec 2010 21:42:28 +0200 Subject: [PATCH] eliminated "gray borders" on symbol mask boundaries when rendering texts. --- yg/glyph_cache.cpp | 1 + yg/glyph_cache.hpp | 2 ++ yg/skin_page.cpp | 18 +++++++++++------- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/yg/glyph_cache.cpp b/yg/glyph_cache.cpp index ee4f39dbf4..97a8260c74 100644 --- a/yg/glyph_cache.cpp +++ b/yg/glyph_cache.cpp @@ -153,6 +153,7 @@ namespace yg info->m_xOffset = bitmapGlyph->left; info->m_yOffset = bitmapGlyph->top - info->m_height; info->m_xAdvance = int(bitmapGlyph->root.advance.x >> 16); + info->m_color = key.m_isMask ? yg::Color(255, 255, 255, 0) : yg::Color(0, 0, 0, 0); if ((info->m_width != 0) && (info->m_height != 0)) { diff --git a/yg/glyph_cache.hpp b/yg/glyph_cache.hpp index 71fbdb6a34..05100b768b 100644 --- a/yg/glyph_cache.hpp +++ b/yg/glyph_cache.hpp @@ -1,6 +1,7 @@ #pragma once #include "../std/shared_ptr.hpp" +#include "color.hpp" namespace yg { @@ -11,6 +12,7 @@ namespace yg int m_yOffset; int m_width; int m_height; + yg::Color m_color; vector m_bitmap; diff --git a/yg/skin_page.cpp b/yg/skin_page.cpp index 6ac98dba46..6752e4ba16 100644 --- a/yg/skin_page.cpp +++ b/yg/skin_page.cpp @@ -358,22 +358,26 @@ namespace yg TDynamicTexture::view_t v = dynTexture->view(rect.SizeX(), rect.SizeY()); - TDynamicTexture::pixel_t penColorTranslucent(0, 0, 0, 0); + TDynamicTexture::pixel_t pxTranslucent; + gil::get_color(pxTranslucent, gil::red_t()) = gi->m_color.r / TDynamicTexture::channelScaleFactor; + gil::get_color(pxTranslucent, gil::green_t()) = gi->m_color.g / TDynamicTexture::channelScaleFactor; + gil::get_color(pxTranslucent, gil::blue_t()) = gi->m_color.b / TDynamicTexture::channelScaleFactor; + gil::get_color(pxTranslucent, gil::alpha_t()) = 0; for (size_t y = 0; y < 2; ++y) for (size_t x = 0; x < rect.SizeX(); ++x) - v(x, y) = penColorTranslucent; + v(x, y) = pxTranslucent; for (size_t y = rect.SizeY() - 2; y < rect.SizeY(); ++y) for (size_t x = 0; x < rect.SizeX(); ++x) - v(x, y) = penColorTranslucent; + v(x, y) = pxTranslucent; for (size_t y = 2; y < rect.SizeY() - 2; ++y) { - v(0, y) = penColorTranslucent; - v(1, y) = penColorTranslucent; - v(rect.SizeX() - 2, y) = penColorTranslucent; - v(rect.SizeX() - 1, y) = penColorTranslucent; + v(0, y) = pxTranslucent; + v(1, y) = pxTranslucent; + v(rect.SizeX() - 2, y) = pxTranslucent; + v(rect.SizeX() - 1, y) = pxTranslucent; } if ((gi->m_width != 0) && (gi->m_height != 0))