summaryrefslogtreecommitdiff
path: root/vcl/ios
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2013-01-19 10:44:33 +0200
committerTor Lillqvist <tml@iki.fi>2013-01-19 11:41:33 +0200
commitfcf7f3596054f24bebf767f9cabfc96dfa577480 (patch)
treecc4c62869d611c6f99a6e35accaa96db4b9d28f9 /vcl/ios
parentc228103ce6a5efe60de553073a9b20d977478bf5 (diff)
Use SAL_INFO instead of home-grown msgs_debug
If there is a need to optionally get a thread identifier or the function name into logging output (as msgs_debug did), we should figure out a way to do that in some elegant fashion in the sal logging macros instead of using some local solution in just one place in the code. Yes, the iOS and OS X CoreText code should be de-duplicated. Will happen soon.
Diffstat (limited to 'vcl/ios')
-rw-r--r--vcl/ios/source/gdi/salcoretextfontutils.cxx6
-rw-r--r--vcl/ios/source/gdi/salcoretextlayout.cxx55
-rw-r--r--vcl/ios/source/gdi/salcoretextstyle.cxx16
-rw-r--r--vcl/ios/source/gdi/salgdi.cxx30
4 files changed, 50 insertions, 57 deletions
diff --git a/vcl/ios/source/gdi/salcoretextfontutils.cxx b/vcl/ios/source/gdi/salcoretextfontutils.cxx
index 06e2cfcfb5f2..3175d0816d23 100644
--- a/vcl/ios/source/gdi/salcoretextfontutils.cxx
+++ b/vcl/ios/source/gdi/salcoretextfontutils.cxx
@@ -262,7 +262,7 @@ CoreTextPhysicalFontFace::CoreTextPhysicalFontFace( const ImplDevFontAttributes&
, m_bHasCJKSupport( false )
, m_bFontCapabilitiesRead( false )
{
- msgs_debug(font,"retain %p as %p",font, m_CTFontRef);
+ SAL_INFO( "vcl.coretext.font", "retain " << font << " as " << m_CTFontRef );
}
CoreTextPhysicalFontFace::~CoreTextPhysicalFontFace()
@@ -271,7 +271,7 @@ CoreTextPhysicalFontFace::~CoreTextPhysicalFontFace()
{
m_pCharMap->DeReference();
}
- msgs_debug(font,"release font %p", m_CTFontRef);
+ SAL_INFO( "vcl.coretext.font", "release " << m_CTFontRef );
SafeCFRelease(m_CTFontRef);
}
@@ -285,7 +285,7 @@ PhysicalFontFace* CoreTextPhysicalFontFace::Clone() const
if( m_CTFontRef )
{
pClone->m_CTFontRef = (CTFontRef)CFRetain(m_CTFontRef);
- msgs_debug(font,"clone ref %p into %p", m_CTFontRef, pClone->m_CTFontRef);
+ SAL_INFO( "vcl.coretext.font", "clone " << m_CTFontRef << " into " << pClone->m_CTFontRef );
}
return pClone;
}
diff --git a/vcl/ios/source/gdi/salcoretextlayout.cxx b/vcl/ios/source/gdi/salcoretextlayout.cxx
index 8774d2e0a7cd..8f9d550c0513 100644
--- a/vcl/ios/source/gdi/salcoretextlayout.cxx
+++ b/vcl/ios/source/gdi/salcoretextlayout.cxx
@@ -53,14 +53,14 @@ CoreTextLayout::~CoreTextLayout()
void CoreTextLayout::AdjustLayout( ImplLayoutArgs& /*rArgs*/ )
{
- msgs_debug(layout,"-->");
- msgs_debug(layout,"<--");
+ SAL_INFO( "vcl.coretext.layout", "-->" );
+ SAL_INFO( "vcl.coretext.layout", "<--" );
/* TODO */
}
void CoreTextLayout::Clean()
{
- msgs_debug(layout,"-->");
+ SAL_INFO( "vcl.coretext.layout", "-->" );
if(m_glyphs)
{
delete[] m_glyphs;
@@ -94,12 +94,12 @@ void CoreTextLayout::Clean()
SafeCFRelease(m_typesetter);
SafeCFRelease(m_line);
m_has_bound_rec = false;
- msgs_debug(layout,"<--");
+ SAL_INFO( "vcl.coretext.layout", "<--" );
}
void CoreTextLayout::DrawText( SalGraphics& rGraphics ) const
{
- msgs_debug(layout,"-->");
+ SAL_INFO( "vcl.coretext.layout", "-->" );
IosSalGraphics& gr = static_cast<IosSalGraphics&>(rGraphics);
if(m_chars_count <= 0 || !gr.CheckContext())
{
@@ -108,19 +108,18 @@ void CoreTextLayout::DrawText( SalGraphics& rGraphics ) const
CGContextSaveGState( gr.mrContext );
Point pos = GetDrawPosition(Point(0,0));
#if 0
- msgs_debug(layout,"at pos (%ld, %ld)", pos.X(), pos.Y());
+ SAL_INFO( "vcl.coretext.layout", "at pos (" << pos.X() << "," << pos.Y() << ")" );
CGContextSetTextMatrix(gr.mrContext, CGAffineTransformMakeScale(1.0, -1.0));
CGContextSetShouldAntialias( gr.mrContext, !gr.mbNonAntialiasedText );
CGContextSetTextPosition(gr.mrContext, pos.X(), pos.Y());
CTLineDraw(m_line, gr.mrContext);
#else
InitGIA();
- msgs_debug(layout,"at- pos (%ld, %ld) ctfont=%p", pos.X(), pos.Y(),
- m_style->GetFont());
+ SAL_INFO( "vcl.coretext.layout", "at pos (" << pos.X() << "," << pos.Y() <<") ctfont=" << m_style->GetFont() );
CGFontRef cg_font = CTFontCopyGraphicsFont(m_style->GetFont(), NULL);
if(!cg_font)
{
- msgs_debug(layout, "Error cg_font is %s", "NULL");
+ SAL_INFO( "vcl.coretext.layout", "Error cg_font is NULL" );
return;
}
CGContextSetFont(gr.mrContext, cg_font);
@@ -144,7 +143,7 @@ void CoreTextLayout::DrawText( SalGraphics& rGraphics ) const
#endif
// restore the original graphic context transformations
CGContextRestoreGState( gr.mrContext );
- msgs_debug(layout,"<--");
+ SAL_INFO( "vcl.coretext.layout", "<--" );
}
@@ -153,7 +152,7 @@ void CoreTextLayout::DropGlyph( int /*nStart*/ ) {}
long CoreTextLayout::FillDXArray( long* pDXArray ) const
{
- msgs_debug(layout,"-->");
+ SAL_INFO( "vcl.coretext.layout", "-->" );
// short circuit requests which don't need full details
if( !pDXArray )
{
@@ -176,14 +175,14 @@ long CoreTextLayout::FillDXArray( long* pDXArray ) const
width = round_to_long(m_cached_width * scale);
pDXArray[i] = width - old_width;
}
- msgs_debug(layout," w=%ld <--", width);
+ SAL_INFO( "vcl.coretext.layout", " width=" << width << " <--" );
return width;
}
bool CoreTextLayout::GetBoundRect( SalGraphics &rGraphics, Rectangle& rVCLRect ) const
{
- msgs_debug(layout,"-->");
+ SAL_INFO( "vcl.coretext.layout", "-->" );
if ( !m_has_bound_rec )
{
IosSalGraphics& gr = static_cast<IosSalGraphics&>(rGraphics);
@@ -199,13 +198,13 @@ bool CoreTextLayout::GetBoundRect( SalGraphics &rGraphics, Rectangle& rVCLRect )
m_has_bound_rec = true;
}
rVCLRect = m_bound_rect;
- msgs_debug(layout,"<--");
+ SAL_INFO( "vcl.coretext.layout", "<--" );
return true;
}
void CoreTextLayout::GetCaretPositions( int max_index, long* caret_position) const
{
- msgs_debug(layout,"max_index %d -->", max_index);
+ SAL_INFO( "vcl.coretext.layout", "max_index " << max_index << " -->" );
int local_max = max_index < m_chars_count * 2 ? max_index : m_chars_count;
for(int i = 0 ; i < max_index - 1; i+=2)
{
@@ -219,7 +218,7 @@ void CoreTextLayout::GetCaretPositions( int max_index, long* caret_position) con
{
caret_position[i] = -1;
}
- msgs_debug(layout,"<--");
+ SAL_INFO( "vcl.coretext.layout", "<--" );
}
bool CoreTextLayout::GetGlyphOutlines( SalGraphics&, PolyPolyVector& ) const { return false; }
@@ -227,7 +226,7 @@ bool CoreTextLayout::GetGlyphOutlines( SalGraphics&, PolyPolyVector& ) const { r
int CoreTextLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int& nStart,
sal_Int32* pGlyphAdvances, int* pCharIndexes ) const
{
- msgs_debug(layout,"nLen=%d nStart=%d-->", nLen, nStart);
+ SAL_INFO( "vcl.coretext.layout", "nLen=" << nLen << " nStart=" << nStart << " -->");
// get glyph measurements
InitGIA();
@@ -274,7 +273,7 @@ int CoreTextLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos
CTRunGetPositions(run, CFRangeMake(m_current_glyphrun_index,1), &first_pos);
Point pos(first_pos.x, first_pos.y);
rPos = GetDrawPosition(pos);
- msgs_debug(layout,"rPos(%ld, %ld)", rPos.X(),rPos.Y());
+ SAL_INFO( "vcl.coretext.layout", "rPos(" << rPos.X() << "," << rPos.Y() << ")" );
first = false;
}
pGlyphIDs[i] = m_glyphs[m_current_glyph_index];
@@ -291,7 +290,7 @@ int CoreTextLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos
i += 1;
nStart += 1;
}
- msgs_debug(layout,"i=%d <--", i);
+ SAL_INFO( "vcl.coretext.layout", "i=" << i << " <--" );
return i;
}
@@ -303,23 +302,23 @@ int CoreTextLayout::GetTextBreak( long /*nMaxWidth*/, long /*nCharExtra*/, int /
long CoreTextLayout::GetTextWidth() const
{
- msgs_debug(layout,"-->");
+ SAL_INFO( "vcl.coretext.layout", "-->" );
CGRect bound_rect = CTLineGetImageBounds(m_line, m_graphics->GetContext());
long w = round_to_long(bound_rect.size.width * m_style->GetFontStretchFactor());
- msgs_debug(layout,"w=%ld <--", w);
+ SAL_INFO( "vcl.coretext.layout", "w=" << w << " <--" );
return w;
}
// not needed. CoreText manage fallback directly
void CoreTextLayout::InitFont() const
{
- msgs_debug(layout,"<-->");
+ SAL_INFO( "vcl.coretext.layout", "<-->" );
}
bool CoreTextLayout::InitGIA() const
{
- msgs_debug(layout,"count=%d <--", m_chars_count);
+ SAL_INFO( "vcl.coretext.layout", "count=" << m_chars_count << "-->" );
if( m_chars_count <= 0)
{
@@ -373,8 +372,7 @@ bool CoreTextLayout::InitGIA() const
for (CFIndex j = 0 ; j < nb_glyphs; ++p, ++j )
{
m_glyphs[ p ] = glyphs[ j ];
- msgs_debug(layout,"m_glyphys[%d]=glyphs[%d] run %d : 0x%x\n",
- p,(int)j, (int)i, glyphs[j]);
+ SAL_INFO( "vcl.coretext.layout", "m_glyphys[" << p << "]=glyphs[" << j << "] run " << i << " : 0x" << std::hex << glyphs[j] << std::dec );
CFIndex k = indices[ j ];
m_glyphs2chars[p] = k;
m_chars2glyphs[k] = p;
@@ -392,14 +390,13 @@ bool CoreTextLayout::InitGIA() const
}
}
}
- msgs_debug(layout,"<--");
+ SAL_INFO( "vcl.coretext.layout", "<--" );
return true;
}
bool CoreTextLayout::LayoutText(ImplLayoutArgs& args)
{
- msgs_debug(layout,"-->(m_style=%p font=%p",
- m_style, m_style->GetFont());
+ SAL_INFO( "vcl.coretext.layout", "m_style=" << m_style << " font=" << m_style->GetFont() << " -->" );
Clean();
m_style->SetColor();
/* retreive MinCharPos EndCharPos Flags and Orientation */
@@ -471,7 +468,7 @@ bool CoreTextLayout::LayoutText(ImplLayoutArgs& args)
}
m_glyphs_count = CTLineGetGlyphCount(m_line);
- msgs_debug(layout,"glyph_count=%d <--", m_glyphs_count);
+ SAL_INFO( "vcl.coretext.layout", "glyph_count=" << m_glyphs_count << " <--" );
return true;
}
diff --git a/vcl/ios/source/gdi/salcoretextstyle.cxx b/vcl/ios/source/gdi/salcoretextstyle.cxx
index c0ef66b49e6c..baa4a7debea0 100644
--- a/vcl/ios/source/gdi/salcoretextstyle.cxx
+++ b/vcl/ios/source/gdi/salcoretextstyle.cxx
@@ -32,12 +32,12 @@ CoreTextStyleInfo::CoreTextStyleInfo() :
m_color(NULL),
m_font_face(NULL)
{
- msgs_debug(style,"create <-->");
+ SAL_INFO( "vcl.coretext.style", "create <-->" );
}
CoreTextStyleInfo::~CoreTextStyleInfo()
{
- msgs_debug(style,"destroy (font:%p) <-->", m_CTFont);
+ SAL_INFO( "vcl.coretext.style", "destroy (font:" << m_CTFont << ") <-->" );
SafeCFRelease(m_CTFont);
SafeCFRelease(m_CTParagraphStyle);
SafeCFRelease(m_color);
@@ -51,7 +51,7 @@ long CoreTextStyleInfo::GetFontStretchedSize() const
void CoreTextStyleInfo::SetFont(FontSelectPattern* requested_font)
{
- msgs_debug(style,"req(%p) release font %p -->", requested_font, m_CTFont);
+ SAL_INFO( "vcl.coretext.style", "req(" << requested_font << ") release font " << m_CTFont << " -->" );
if(!requested_font)
{
@@ -92,12 +92,12 @@ void CoreTextStyleInfo::SetFont(FontSelectPattern* requested_font)
/* FIXME: pass attribute to take into accout 'VerticalStyle' */
/* FIXME: how to deal with 'rendering options' i.e anti-aliasing, does it even matter in CoreText ? */
m_CTFont = CTFontCreateCopyWithAttributes(m_font_face->GetCTFont(), font_size, &m_matrix, NULL);
- msgs_debug(style,"font %p <--", m_CTFont);
+ SAL_INFO( "vcl.coretext.style", "font " << m_CTFont << " <--" );
}
void CoreTextStyleInfo::SetColor(SalColor color)
{
- msgs_debug(style, "r:%d g:%d b:%d -->", SALCOLOR_RED(color), SALCOLOR_GREEN(color), SALCOLOR_BLUE(color));
+ SAL_INFO( "vcl.coretext.style", "r:" << SALCOLOR_RED(color) << ",g:" << SALCOLOR_GREEN(color) << ",b:" << SALCOLOR_BLUE(color) );
SafeCFRelease(m_color);
#ifdef IOS
// No CGColorCreateGenericRGB on iOS
@@ -108,13 +108,13 @@ void CoreTextStyleInfo::SetColor(SalColor color)
#else
m_color = CGColorCreateGenericRGB(SALCOLOR_RED(color) / 255.0, SALCOLOR_GREEN(color) / 255.0, SALCOLOR_BLUE(color) / 255.0, 1.0);
#endif
- msgs_debug(style,"color=%p <--", m_color);
+ SAL_INFO( "vcl.coretext.style", "color=" << m_color << " <--" );
}
void CoreTextStyleInfo::SetColor(void)
{
- msgs_debug(style, "null -->");
+ SAL_INFO( "vcl.coretext.style", "null -->" );
SafeCFRelease(m_color);
- msgs_debug(style,"color=%p <--", m_color);
+ SAL_INFO( "vcl.coretext.style", "color=" << m_color << " <--" );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/ios/source/gdi/salgdi.cxx b/vcl/ios/source/gdi/salgdi.cxx
index fad782c483ae..766412f006bc 100644
--- a/vcl/ios/source/gdi/salgdi.cxx
+++ b/vcl/ios/source/gdi/salgdi.cxx
@@ -45,20 +45,20 @@ IosSalGraphics::IosSalGraphics()
, mbVirDev( false )
, mbWindow( false )
{
- msgs_debug(gr,"-->");
+ SAL_INFO( "vcl.coretext.gr", "-->" );
m_style = new CoreTextStyleInfo();
- msgs_debug(gr,"m_style=%p <--", m_style);
+ SAL_INFO( "vcl.coretext.gr", "m_style=" << m_style << " <--" );
}
IosSalGraphics::~IosSalGraphics()
{
- msgs_debug(gr,"-->");
+ SAL_INFO( "vcl.coretext.gr", "-->" );
if(m_style)
{
delete m_style;
m_style = NULL;
}
- msgs_debug(gr,"<--");
+ SAL_INFO( "vcl.coretext.gr", "<--" );
}
inline bool IosSalGraphics::AddTempDevFont( ImplDevFontList*,
@@ -137,11 +137,7 @@ void IosSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe
pMetric->mnExtLeading = nExtDescent + pMetric->mnDescent;
pMetric->mnIntLeading = 0;
pMetric->mnWidth = m_style->GetFontStretchedSize();
- msgs_debug(gr,"ascent=%ld, descent=%ld, extleading=%ld, intleading=%ld,w=%ld",
- pMetric->mnAscent, pMetric->mnDescent,
- pMetric->mnExtLeading,
- pMetric->mnIntLeading,
- pMetric->mnWidth);
+ SAL_INFO( "vcl.coretext.gr", "ascent=" << pMetric->mnAscent<< ", descent=" << pMetric->mnDescent << ", extleading=" << pMetric->mnExtLeading << ", intleading=" << pMetric->mnIntLeading << ", w=" << pMetric->mnWidth );
}
sal_Bool IosSalGraphics::GetGlyphBoundRect( sal_GlyphId /*nGlyphId*/, Rectangle& /*rRect*/ )
@@ -204,7 +200,7 @@ bool IosSalGraphics::GetRawFontData( const PhysicalFontFace* pFontFace,
SystemFontData IosSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
{
- msgs_debug(gr,"-->");
+ SAL_INFO( "vcl.coretext.gr", "-->" );
SystemFontData aSysFontData;
aSysFontData.nSize = sizeof( SystemFontData );
aSysFontData.bAntialias = true;
@@ -237,31 +233,31 @@ SystemFontData IosSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
aSysFontData.bVerticalCharacterType = vertical_font ? true : false;
SafeCFRelease(vertical_font);
- msgs_debug(gr,"<--");
+ SAL_INFO( "vcl.coretext.gr", "<--" );
return aSysFontData;
}
SalLayout* IosSalGraphics::GetTextLayout( ImplLayoutArgs&, int /*nFallbackLevel*/ )
{
- msgs_debug(gr,"-->");
+ SAL_INFO( "vcl.coretext.gr", "-->" );
CoreTextLayout* layout = new CoreTextLayout( this, m_style );
- msgs_debug(gr,"layout:%p <--", layout);
+ SAL_INFO( "vcl.coretext.gr", "layout:" << layout << " <--" );
return layout;
}
sal_uInt16 IosSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbackLevel*/ )
{
- msgs_debug(gr,"m_style=%p -->", m_style);
+ SAL_INFO( "vcl.coretext.gr", "m_style=" << m_style << " -->" );
m_style->SetFont(pReqFont);
- msgs_debug(gr,"<--");
+ SAL_INFO( "vcl.coretext.gr", "<--" );
return 0;
}
void IosSalGraphics::SetTextColor( SalColor nSalColor )
{
- msgs_debug(gr,"m_style=%p -->", m_style);
+ SAL_INFO( "vcl.coretext.gr", "m_style=" << m_style << " -->" );
m_style->SetColor(nSalColor);
- msgs_debug(gr,"<--");
+ SAL_INFO( "vcl.coretext.gr", "<--" );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */