[Libreoffice-commits] core.git: vcl/coretext vcl/inc

Tor Lillqvist tml at iki.fi
Sat Apr 6 03:17:49 PDT 2013


 vcl/coretext/salcoretextlayout.cxx |   61 --------------------------
 vcl/inc/sallayout.hxx              |   85 +++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 61 deletions(-)

New commits:
commit beda8feececb22e46b6a2e0bac731e81daf5b4a4
Author: Tor Lillqvist <tml at iki.fi>
Date:   Sat Apr 6 13:15:19 2013 +0300

    Move the SAL_INFO operator<< for ImplLayoutArgs to sallayout.hxx for re-use
    
    Change-Id: I6497550e8f55f9ba08b0c4f20de0ea04be45d617

diff --git a/vcl/coretext/salcoretextlayout.cxx b/vcl/coretext/salcoretextlayout.cxx
index 98e2ae4..8aa3760 100644
--- a/vcl/coretext/salcoretextlayout.cxx
+++ b/vcl/coretext/salcoretextlayout.cxx
@@ -116,67 +116,6 @@ CoreTextLayout::~CoreTextLayout()
     SAL_INFO( "vcl.coretext.layout", "~CoreTextLayout(" << this << ")" );
 }
 
-std::ostream &operator <<(std::ostream& s, ImplLayoutArgs &rArgs)
-{
-#ifndef SAL_LOG_INFO
-    (void) rArgs;
-    return s;
-#else
-    s << "ImplLayoutArgs{";
-
-    s << "Flags=";
-    if (rArgs.mnFlags == 0)
-        s << 0;
-    else {
-        bool need_or = false;
-        s << "{";
-#define TEST(x) if (rArgs.mnFlags & SAL_LAYOUT_##x) { if (need_or) s << "|"; s << #x; need_or = true; }
-        TEST(BIDI_RTL);
-        TEST(BIDI_STRONG);
-        TEST(RIGHT_ALIGN);
-        TEST(KERNING_PAIRS);
-        TEST(KERNING_ASIAN);
-        TEST(VERTICAL);
-        TEST(COMPLEX_DISABLED);
-        TEST(ENABLE_LIGATURES);
-        TEST(SUBSTITUTE_DIGITS);
-        TEST(KASHIDA_JUSTIFICATON);
-        TEST(DISABLE_GLYPH_PROCESSING);
-        TEST(FOR_FALLBACK);
-#undef TEST
-        s << "}";
-    }
-
-    s << ",Length=" << rArgs.mnLength;
-    s << ",MinCharPos=" << rArgs.mnMinCharPos;
-    s << ",EndCharPos=" << rArgs.mnEndCharPos;
-
-    s << ",Str=\"";
-    int lim = rArgs.mnLength;
-    if (lim > 10)
-        lim = 7;
-    for (int i = 0; i < lim; i++) {
-        if (rArgs.mpStr[i] == '\n')
-            s << "\\n";
-        else if (rArgs.mpStr[i] < ' ' || (rArgs.mpStr[i] >= 0x7F && rArgs.mpStr[i] <= 0xFF))
-            s << "\\0x" << std::hex << std::setw(2) << std::setfill('0') << (int) rArgs.mpStr[i] << std::setfill(' ') << std::setw(1) << std::dec;
-        else if (rArgs.mpStr[i] < 0x7F)
-            s << (char) rArgs.mpStr[i];
-        else
-            s << "\\u" << std::hex << std::setw(4) << std::setfill('0') << (int) rArgs.mpStr[i] << std::setfill(' ') << std::setw(1) << std::dec;
-    }
-    if (rArgs.mnLength > lim)
-        s << "...";
-    s << "\"";
-
-    s << ",LayoutWidth=" << rArgs.mnLayoutWidth;
-
-    s << "}";
-
-    return s;
-#endif
-}
-
 void CoreTextLayout::AdjustLayout( ImplLayoutArgs& rArgs )
 {
     SAL_INFO( "vcl.coretext.layout", "AdjustLayout(" << this << ",rArgs=" << rArgs << ")" );
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 03bd010..dbf97b7 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -20,6 +20,9 @@
 #ifndef _SV_SALLAYOUT_HXX
 #define _SV_SALLAYOUT_HXX
 
+#include <iostream>
+#include <iomanip>
+
 #include <tools/gen.hxx>
 #include <basegfx/polygon/b2dpolypolygon.hxx>
 
@@ -123,6 +126,88 @@ protected:
     void        AddRun( int nMinCharPos, int nEndCharPos, bool bRTL );
 };
 
+// For nice SAL_INFO logging of ImplLayoutArgs values
+inline std::ostream &operator <<(std::ostream& s, ImplLayoutArgs &rArgs)
+{
+#ifndef SAL_LOG_INFO
+    (void) rArgs;
+#else
+    s << "ImplLayoutArgs{";
+
+    s << "Flags=";
+    if (rArgs.mnFlags == 0)
+        s << 0;
+    else {
+        bool need_or = false;
+        s << "{";
+#define TEST(x) if (rArgs.mnFlags & SAL_LAYOUT_##x) { if (need_or) s << "|"; s << #x; need_or = true; }
+        TEST(BIDI_RTL);
+        TEST(BIDI_STRONG);
+        TEST(RIGHT_ALIGN);
+        TEST(KERNING_PAIRS);
+        TEST(KERNING_ASIAN);
+        TEST(VERTICAL);
+        TEST(COMPLEX_DISABLED);
+        TEST(ENABLE_LIGATURES);
+        TEST(SUBSTITUTE_DIGITS);
+        TEST(KASHIDA_JUSTIFICATON);
+        TEST(DISABLE_GLYPH_PROCESSING);
+        TEST(FOR_FALLBACK);
+#undef TEST
+        s << "}";
+    }
+
+    s << ",Length=" << rArgs.mnLength;
+    s << ",MinCharPos=" << rArgs.mnMinCharPos;
+    s << ",EndCharPos=" << rArgs.mnEndCharPos;
+
+    s << ",Str=\"";
+    int lim = rArgs.mnLength;
+    if (lim > 10)
+        lim = 7;
+    for (int i = 0; i < lim; i++) {
+        if (rArgs.mpStr[i] == '\n')
+            s << "\\n";
+        else if (rArgs.mpStr[i] < ' ' || (rArgs.mpStr[i] >= 0x7F && rArgs.mpStr[i] <= 0xFF))
+            s << "\\0x" << std::hex << std::setw(2) << std::setfill('0') << (int) rArgs.mpStr[i] << std::setfill(' ') << std::setw(1) << std::dec;
+        else if (rArgs.mpStr[i] < 0x7F)
+            s << (char) rArgs.mpStr[i];
+        else
+            s << "\\u" << std::hex << std::setw(4) << std::setfill('0') << (int) rArgs.mpStr[i] << std::setfill(' ') << std::setw(1) << std::dec;
+    }
+    if (rArgs.mnLength > lim)
+        s << "...";
+    s << "\"";
+
+    s << ",DXArray=";
+    if (rArgs.mpDXArray) {
+        s << "[";
+        int count = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
+        lim = count;
+        if (lim > 10)
+            lim = 7;
+        for (int i = 0; i < lim; i++) {
+            s << rArgs.mpDXArray[i];
+            if (i < lim-1)
+                s << ",";
+        }
+        if (count > lim) {
+            if (count > lim + 1)
+                s << "...";
+            s << rArgs.mpDXArray[count-1];
+        }
+        s << "]";
+    } else
+        s << "NULL";
+
+    s << ",LayoutWidth=" << rArgs.mnLayoutWidth;
+
+    s << "}";
+
+#endif
+    return s;
+}
+
 // helper functions often used with ImplLayoutArgs
 bool IsDiacritic( sal_UCS4 );
 int GetVerticalFlags( sal_UCS4 );


More information about the Libreoffice-commits mailing list