Author: fejj
Date: 2007-09-28 13:29:41 -0400 (Fri, 28 Sep 2007)
New Revision: 86592

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/font.cpp
   trunk/moon/src/font.h
   trunk/moon/src/text.cpp
Log:
2007-09-28  Jeffrey Stedfast  <[EMAIL PROTECTED]>

        * text.cpp (LayoutSilverlight): LineBreaks don't really care about
        TextDecorations or Foreground properties.

        * font.cpp (TextRun::~TextRun): unref the font.
        (TextSegment): now references the original TextRun instead of
        copying pointers/values.
        (TextLayout::Render): Updated for above change.



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-09-28 17:09:02 UTC (rev 86591)
+++ trunk/moon/src/ChangeLog    2007-09-28 17:29:41 UTC (rev 86592)
@@ -1,3 +1,13 @@
+2007-09-28  Jeffrey Stedfast  <[EMAIL PROTECTED]>
+
+       * text.cpp (LayoutSilverlight): LineBreaks don't really care about
+       TextDecorations or Foreground properties.
+
+       * font.cpp (TextRun::~TextRun): unref the font.
+       (TextSegment): now references the original TextRun instead of
+       copying pointers/values.
+       (TextLayout::Render): Updated for above change.
+
 2007-09-28  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * xaml.cpp (SetNameAttribute): New callback to enable managed code to 
process

Modified: trunk/moon/src/font.cpp
===================================================================
--- trunk/moon/src/font.cpp     2007-09-28 17:09:02 UTC (rev 86591)
+++ trunk/moon/src/font.cpp     2007-09-28 17:29:41 UTC (rev 86592)
@@ -1026,22 +1026,24 @@
 
 TextRun::TextRun (const char *utf8, int len, TextDecorations deco, 
TextFontDescription *font, Brush *fg)
 {
-       text = g_utf8_to_ucs4_fast (utf8, len, NULL);
+       this->text = g_utf8_to_ucs4_fast (utf8, len, NULL);
        this->font = font->GetFont ();
        this->deco = deco;
        this->fg = fg;
 }
 
-TextRun::TextRun (TextDecorations deco, TextFontDescription *font, Brush *fg)
+TextRun::TextRun (TextFontDescription *font)
 {
+       // This TextRun will represent a LineBreak
+       this->deco = TextDecorationsNone;
        this->font = font->GetFont ();
        this->text = NULL;
-       this->deco = deco;
-       this->fg = fg;
+       this->fg = NULL;
 }
 
 TextRun::~TextRun ()
 {
+       font->unref ();
        g_free (text);
 }
 
@@ -1049,22 +1051,15 @@
 
 class TextSegment : public List::Node {
 public:
-       TextDecorations deco;
-       const uint32_t *text;
        int start, end;
-       TextFont *font;
-       Brush *fg;
+       TextRun *run;
        
        TextSegment (TextRun *run, int start);
 };
 
 TextSegment::TextSegment (TextRun *run, int start)
 {
-       deco = run->deco;
-       text = run->text;
-       font = run->font;
-       fg = run->fg;
-       
+       this->run = run;
        this->start = start;
        this->end = start;
 }
@@ -1446,6 +1441,7 @@
        TextSegment *segment;
        TextDecorations deco;
        TextFont *font = NULL;
+       const uint32_t *text;
        uint32_t prev = 0;
        GlyphInfo *glyph;
        Brush *fg = NULL;
@@ -1463,18 +1459,19 @@
        while (line) {
                segment = (TextSegment *) line->segments->First ();
                while (segment) {
-                       deco = segment->deco;
-                       font = segment->font;
+                       text = segment->run->text;
+                       deco = segment->run->deco;
+                       font = segment->run->font;
                        
                        height = font->Height ();
                        
-                       if (segment->fg != fg) {
-                               fg = segment->fg;
+                       if (segment->run->fg != fg) {
+                               fg = segment->run->fg;
                                fg->SetupBrush (cr, element);
                        }
                        
                        for (i = segment->start, prev = 0; i < segment->end; 
i++) {
-                               if (!(glyph = font->GetGlyphInfo 
(segment->text[i])))
+                               if (!(glyph = font->GetGlyphInfo (text[i])))
                                        continue;
                                
                                if (glyph->index > 0) {

Modified: trunk/moon/src/font.h
===================================================================
--- trunk/moon/src/font.h       2007-09-28 17:09:02 UTC (rev 86591)
+++ trunk/moon/src/font.h       2007-09-28 17:29:41 UTC (rev 86592)
@@ -187,7 +187,7 @@
        Brush *fg;
        
        TextRun (const char *utf8, int len, TextDecorations deco, 
TextFontDescription *font, Brush *fg);
-       TextRun (TextDecorations deco, TextFontDescription *font, Brush *fg);
+       TextRun (TextFontDescription *font);
        ~TextRun ();
 };
 

Modified: trunk/moon/src/text.cpp
===================================================================
--- trunk/moon/src/text.cpp     2007-09-28 17:09:02 UTC (rev 86591)
+++ trunk/moon/src/text.cpp     2007-09-28 17:29:41 UTC (rev 86592)
@@ -570,10 +570,7 @@
                                }
                                break;
                        case Type::LINEBREAK:
-                               if (item->foreground)
-                                       runs->Append (new TextRun (deco, ifont, 
item->foreground));
-                               else
-                                       runs->Append (new TextRun (deco, ifont, 
fg));
+                               runs->Append (new TextRun (ifont));
                                break;
                        default:
                                break;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to