summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/default_theme/default_theme.cpp8
-rw-r--r--scene/resources/font.cpp6
-rw-r--r--scene/resources/font.h1
-rw-r--r--scene/resources/theme.cpp15
4 files changed, 28 insertions, 2 deletions
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index ffc5232e8f..499cf0a169 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -54,8 +54,10 @@ static Ref<StyleBoxTexture> make_stylebox(T p_src,float p_left, float p_top, flo
texture = Ref<ImageTexture>( memnew( ImageTexture ) );
Image img(p_src);
- if (scale>1)
+ if (scale>1) {
+ img.convert(Image::FORMAT_RGBA);
img.expand_x2_hq2x();
+ }
texture->create_from_image( img,ImageTexture::FLAG_FILTER );
(*tex_cache)[p_src]=texture;
}
@@ -92,8 +94,10 @@ static Ref<Texture> make_icon(T p_src) {
Ref<ImageTexture> texture( memnew( ImageTexture ) );
Image img = Image(p_src);
- if (scale>1)
+ if (scale>1) {
+ img.convert(Image::FORMAT_RGBA);
img.expand_x2_hq2x();
+ }
texture->create_from_image( img,ImageTexture::FLAG_FILTER );
return texture;
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 6ad8a95565..1afa3fec19 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -71,6 +71,11 @@ void Font::draw(RID p_canvas_item, const Point2& p_pos, const String& p_text, co
}
}
+void Font::update_changes() {
+
+ emit_changed();
+}
+
void Font::_bind_methods() {
ObjectTypeDB::bind_method(_MD("draw","canvas_item","pos","string","modulate","clip_w"),&Font::draw,DEFVAL(Color(1,1,1)),DEFVAL(-1));
@@ -80,6 +85,7 @@ void Font::_bind_methods() {
ObjectTypeDB::bind_method(_MD("is_distance_field_hint"),&Font::is_distance_field_hint);
ObjectTypeDB::bind_method(_MD("get_string_size","string"),&Font::get_string_size);
ObjectTypeDB::bind_method(_MD("draw_char","canvas_item","pos","char","next","modulate"),&Font::draw_char,DEFVAL(-1),DEFVAL(Color(1,1,1)));
+ ObjectTypeDB::bind_method(_MD("update_changes"),&Font::update_changes);
}
diff --git a/scene/resources/font.h b/scene/resources/font.h
index 67836564cd..fe4558f9e3 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -61,6 +61,7 @@ public:
void draw_halign(RID p_canvas_item, const Point2& p_pos, HAlign p_align,float p_width,const String& p_text,const Color& p_modulate=Color(1,1,1)) const;
virtual float draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char, CharType p_next=0,const Color& p_modulate=Color(1,1,1)) const=0;
+ void update_changes();
Font();
};
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 92a6f0c0b9..b351167e10 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -219,7 +219,22 @@ Ref<Theme> Theme::get_default() {
void Theme::set_default_theme_font( const Ref<Font>& p_default_font ) {
+ if (default_theme_font==p_default_font)
+ return;
+
+ if (default_theme_font.is_valid()) {
+ _unref_font(default_theme_font);
+ }
+
default_theme_font=p_default_font;
+
+ if (default_theme_font.is_valid()) {
+ _ref_font(default_theme_font);
+ }
+
+ _change_notify();
+ emit_changed();;
+
}
Ref<Font> Theme::get_default_theme_font() const {