From 133653c7e0ae64112ffd350116cf3fa9644346b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 28 Aug 2017 10:52:07 +0200 Subject: [PATCH] [kandinsky] Change name to avoid confusion: blend -> transparentBackground Change-Id: I90327e71699e5ec4b349544e537e04327ec2bd7c --- kandinsky/include/kandinsky/context.h | 4 ++-- kandinsky/src/context_text.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kandinsky/include/kandinsky/context.h b/kandinsky/include/kandinsky/context.h index c33944512..f4fab108f 100644 --- a/kandinsky/include/kandinsky/context.h +++ b/kandinsky/include/kandinsky/context.h @@ -33,8 +33,8 @@ protected: virtual void pullRect(KDRect rect, KDColor * pixels) = 0; private: KDRect absoluteFillRect(KDRect rect); - KDPoint writeString(const char * text, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor, int maxLength, bool blend); - void writeChar(char character, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor, bool blend); + KDPoint writeString(const char * text, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor, int maxLength, bool transparentBackground); + void writeChar(char character, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor, bool transparentBackground); KDPoint m_origin; KDRect m_clippingRect; }; diff --git a/kandinsky/src/context_text.cpp b/kandinsky/src/context_text.cpp index 4a98e60a7..48c143722 100644 --- a/kandinsky/src/context_text.cpp +++ b/kandinsky/src/context_text.cpp @@ -14,7 +14,7 @@ KDPoint KDContext::blendString(const char * text, KDPoint p, KDText::FontSize si return writeString(text, p, size, textColor, KDColorWhite, -1, true); } -KDPoint KDContext::writeString(const char * text, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor, int maxLength, bool blend) { +KDPoint KDContext::writeString(const char * text, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor, int maxLength, bool transparentBackground) { KDPoint position = p; int characterWidth = size == KDText::FontSize::Large ? BITMAP_LargeFont_CHARACTER_WIDTH : BITMAP_SmallFont_CHARACTER_WIDTH; int characterHeight = size == KDText::FontSize::Large ? BITMAP_LargeFont_CHARACTER_HEIGHT: BITMAP_SmallFont_CHARACTER_HEIGHT; @@ -22,7 +22,7 @@ KDPoint KDContext::writeString(const char * text, KDPoint p, KDText::FontSize si const char * end = text+maxLength; while(*text != 0 && text != end) { - writeChar(*text, position, size, textColor, backgroundColor, blend); + writeChar(*text, position, size, textColor, backgroundColor, transparentBackground); if (*text == '\n') { position = KDPoint(0, position.y()+characterHeight); } else if (*text == '\t') { @@ -35,7 +35,7 @@ KDPoint KDContext::writeString(const char * text, KDPoint p, KDText::FontSize si return position; } -void KDContext::writeChar(char character, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor, bool blend) { +void KDContext::writeChar(char character, KDPoint p, KDText::FontSize size, KDColor textColor, KDColor backgroundColor, bool transparentBackground) { if (character == '\n' || character == '\t') { return; } @@ -46,7 +46,7 @@ void KDContext::writeChar(char character, KDPoint p, KDText::FontSize size, KDCo KDColor * characterBuffer = size == KDText::FontSize::Large ? largeCharacterBuffer : smallCharacterBuffer; KDRect absoluteRect = absoluteFillRect(KDRect(p, characterWidth, characterHeight)); - if (blend) { + if (transparentBackground) { pullRect(absoluteRect, characterBuffer); } KDCoordinate startingI = m_clippingRect.x() - p.translatedBy(m_origin).x(); @@ -62,7 +62,7 @@ void KDContext::writeChar(char character, KDPoint p, KDText::FontSize size, KDCo } else { intensity = bitmapSmallFont[(uint8_t)character-(uint8_t)firstCharacter][j + startingJ][i +startingI]; } - KDColor backColor = blend ? *currentPixelAdress : backgroundColor; + KDColor backColor = transparentBackground ? *currentPixelAdress : backgroundColor; *currentPixelAdress = KDColor::blend(textColor, backColor, intensity); } }