X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fimage.cpp;h=6e24d71b13a42df36a0f2f23b5442dc3406f28a1;hb=b59fab7e533ef96d72c92b224d4f24718bc6b0a1;hp=1da782d28a2579e66d4079d8ffb915f703627255;hpb=78e05360d70542d343401241ff9ddddfed18c5cd;p=libs%2Fgltk.git diff --git a/source/image.cpp b/source/image.cpp index 1da782d..6e24d71 100644 --- a/source/image.cpp +++ b/source/image.cpp @@ -11,10 +11,8 @@ namespace Msp { namespace GLtk { Image::Image(const GL::Texture2D *i): - image(i), - keep_aspect(true) -{ -} + image(i) +{ } void Image::autosize_special(const Part &part, Geometry &ageom) const { @@ -39,7 +37,7 @@ void Image::set_image(const GL::Texture2D *i) image = i; icon_name = string(); signal_autosize_changed.emit(); - rebuild(); + mark_rebuild(); } void Image::set_icon(const string &n) @@ -51,27 +49,23 @@ void Image::set_icon(const string &n) void Image::set_keep_aspect(bool ka) { keep_aspect = ka; - rebuild(); + mark_rebuild(); } void Image::update_icon() { - if(style) - { - Root *root = find_ancestor(); - if(root) - { - if(icon_name.empty()) - image = 0; - else - image = &root->get_resources().get(icon_name); - signal_autosize_changed.emit(); - rebuild(); - return; - } - } + image = nullptr; + if(!style) + return; + + Root *root = find_ancestor(); + if(!root) + return; - image = 0; + if(!icon_name.empty()) + image = &root->get_resources().get(icon_name); + signal_autosize_changed.emit(); + mark_rebuild(); } void Image::rebuild_special(const Part &part)