|
@@ -58,9 +58,8 @@ ColorRange::ColorRange(Color color, unsigned int rangeStart, unsigned int rangeE
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-Label::Label(Font *font, const String& text, int size, int antiAliasMode, bool premultiplyAlpha) : Image() {
|
|
|
|
|
|
|
+Label::Label(Font *font, const String& text, int size, int antiAliasMode, bool premultiplyAlpha) : Image(), _colorsChanged(false) {
|
|
|
setPixelType(Image::IMAGE_RGBA);
|
|
setPixelType(Image::IMAGE_RGBA);
|
|
|
-
|
|
|
|
|
this->font = font;
|
|
this->font = font;
|
|
|
this->size = size;
|
|
this->size = size;
|
|
|
this->premultiplyAlpha = premultiplyAlpha;
|
|
this->premultiplyAlpha = premultiplyAlpha;
|
|
@@ -194,10 +193,12 @@ const String& Label::getText() const {
|
|
|
|
|
|
|
|
void Label::clearColors() {
|
|
void Label::clearColors() {
|
|
|
colorRanges.clear();
|
|
colorRanges.clear();
|
|
|
|
|
+ _colorsChanged = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void Label::setColorForRange(Color color, unsigned int rangeStart, unsigned int rangeEnd) {
|
|
void Label::setColorForRange(Color color, unsigned int rangeStart, unsigned int rangeEnd) {
|
|
|
colorRanges.push_back(ColorRange(color, rangeStart, rangeEnd));
|
|
colorRanges.push_back(ColorRange(color, rangeStart, rangeEnd));
|
|
|
|
|
+ _colorsChanged = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Color Label::getColorForIndex(unsigned int index) {
|
|
Color Label::getColorForIndex(unsigned int index) {
|
|
@@ -395,8 +396,12 @@ void Label::renderGlyphs(GlyphData *glyphData) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void Label::setText(const String& text) {
|
|
|
|
|
|
|
+bool Label::colorsChanged() {
|
|
|
|
|
+ return _colorsChanged;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+void Label::setText(const String& text) {
|
|
|
|
|
+
|
|
|
if(!font)
|
|
if(!font)
|
|
|
return;
|
|
return;
|
|
|
if(!font->isValid())
|
|
if(!font->isValid())
|
|
@@ -418,4 +423,5 @@ void Label::setText(const String& text) {
|
|
|
|
|
|
|
|
createEmpty(textWidth,textHeight);
|
|
createEmpty(textWidth,textHeight);
|
|
|
renderGlyphs(&labelData);
|
|
renderGlyphs(&labelData);
|
|
|
|
|
+ _colorsChanged = false;
|
|
|
}
|
|
}
|