[haiku-commits] haiku: hrev48384 - src/apps/icon-o-matic/import_export/svg

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 26 Nov 2014 14:52:44 +0100 (CET)

hrev48384 adds 1 changeset to branch 'master'
old head: 42272d23426442e0463c33d26d0f90ac11e94608
new head: 7b5ea03f20098299103283304e0b38f9420e89cd
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=7b5ea03+%5E42272d2

----------------------------------------------------------------------------

7b5ea03: Icon-O-Matic: import SVG gradient names.
  
  The names are often program generated, but better than no name at all.

                                 [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev48384
Commit:      7b5ea03f20098299103283304e0b38f9420e89cd
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7b5ea03
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Wed Nov 26 13:51:59 2014 UTC

----------------------------------------------------------------------------

1 file changed, 6 insertions(+), 3 deletions(-)
src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp | 9 ++++++---

----------------------------------------------------------------------------

diff --git a/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp 
b/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp
index f0ca0a5..34f712f 100644
--- a/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp
+++ b/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp
@@ -792,11 +792,12 @@ DocumentBuilder::_AddShape(path_attributes& attributes, 
bool outline,
 
 
        Gradient* gradient = NULL;
+       SVGGradient* g = NULL;
        const char* url = outline ? attributes.stroke_url : attributes.fill_url;
        if (url[0] != 0) {
-               if (SVGGradient* g = _FindGradient(url)) {
+               g = _FindGradient(url);
+               if (g != NULL)
                        gradient = g->GetGradient(shape->Bounds());
-               }
        }
 
        ObjectDeleter<Gradient> gradientDeleter(gradient);
@@ -845,8 +846,10 @@ DocumentBuilder::_AddShape(path_attributes& attributes, 
bool outline,
                shape->Reset();
 //     }
 
-       if (gradient)
+       if (gradient) {
                style->SetGradient(gradient);
+               style->SetName(g->ID());
+       }
 
        shape->SetStyle(style);
 


Other related posts: