summaryrefslogtreecommitdiff
path: root/vcl/win/source/gdi/winlayout.cxx
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-08-29 09:02:31 +0300
committerTor Lillqvist <tml@collabora.com>2015-08-29 09:05:01 +0300
commit15943416240e29a052e3a6e4d338932e8c1ffb06 (patch)
tree6f6093f1be3bc6cdaf598a969e00c7857ee4fa69 /vcl/win/source/gdi/winlayout.cxx
parent091fde623d33a21162658d9f2338ab0b23e82a90 (diff)
Avoid unintended unconditional std::cerr debug output
Can't call a function that as a side effect prints to std::cerr in SAL_INFO. It will be called even if the log area doesn't match $SAL_LOG. Just use only SAL_INFO and no plain std::cerr output. It's fine to output a string with embedded newlines in SAL_INFO. Also drop the debug output line with the glyph start positions, it was less than useful. Change-Id: I9fb5ed068aae1b835e20cf1ec1097bcd55deb05d
Diffstat (limited to 'vcl/win/source/gdi/winlayout.cxx')
-rw-r--r--vcl/win/source/gdi/winlayout.cxx43
1 files changed, 21 insertions, 22 deletions
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 8d5d8bd50d63..7bf8a8f54023 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -105,6 +105,10 @@ public:
const OpenGLGlyphCacheChunk& GetCachedGlyphChunkFor(int nGlyphIndex) const;
};
+#ifdef SAL_DETAIL_ENABLE_LOG_INFO
+
+namespace {
+
char ColorFor(COLORREF aColor)
{
if (aColor == RGB(0xFF, 0xFF, 0xFF))
@@ -115,47 +119,39 @@ char ColorFor(COLORREF aColor)
return '0' + (10*(GetRValue(aColor) + GetGValue(aColor) + GetBValue(aColor))) / (0xFF*3);
}
-OUString DumpGlyphBitmap(OpenGLGlyphCacheChunk& rChunk, HDC hDC)
+void DumpGlyphBitmap(OpenGLGlyphCacheChunk& rChunk, HDC hDC)
{
HBITMAP hBitmap = static_cast<HBITMAP>(GetCurrentObject(hDC, OBJ_BITMAP));
if (hBitmap == NULL)
{
SAL_WARN("vcl.gdi", "GetCurrentObject failed: " << WindowsErrorString(GetLastError()));
- return "";
+ return;
}
BITMAP aBitmap;
if (!GetObjectW(hBitmap, sizeof(aBitmap), &aBitmap))
{
SAL_WARN("vcl.gdi", "GetObjectW failed: " << WindowsErrorString(GetLastError()));
- return "";
+ return;
}
- std::cerr << "Bitmap " << hBitmap << ": " << aBitmap.bmWidth << "x" << aBitmap.bmHeight << ":" << std::endl;
-
- // Print out start pos of each glyph only in the horizontal font case
- int nPos = 0;
- if (rChunk.mnGlyphCount > 1 && rChunk.maLocation[1].Left() > rChunk.maLocation[0].Left())
- {
- for (int i = 1; i < rChunk.mnGlyphCount && nPos < 75; i++)
- {
- for (int j = nPos; j < rChunk.maLocation[i].Left(); j++)
- std::cerr << " ";
- std::cerr << "!";
- nPos = rChunk.maLocation[i].Left() + 1;
- }
- }
- std::cerr << std::endl;
+ SAL_INFO("vcl.gdi.opengl", "Bitmap " << hBitmap << ": " << aBitmap.bmWidth << "x" << aBitmap.bmHeight << ":");
+ std::ostringstream sLine("\n");
for (long y = 0; y < aBitmap.bmHeight; y++)
{
for (long x = 0; x < std::min(75l, aBitmap.bmWidth); x++)
- std::cerr << ColorFor(GetPixel(hDC, x, y));
- std::cerr << std::endl;
+ sLine << ColorFor(GetPixel(hDC, x, y));
+ if (y < aBitmap.bmHeight - 1)
+ sLine << "\n";
}
- return "";
+ SAL_INFO("vcl.gdi.opengl", sLine.str());
}
+} // anonymous namespace
+
+#endif // SAL_DETAIL_ENABLE_LOG_INFO
+
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
std::basic_ostream<charT, traits> & stream, const std::vector<OpenGLGlyphCacheChunk>& rCache )
@@ -432,7 +428,10 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
if (hNonAntialiasedFont != NULL)
DeleteObject(hNonAntialiasedFont);
- SAL_INFO("vcl.gdi.opengl", "this=" << this << " now: " << maOpenGLGlyphCache << DumpGlyphBitmap(aChunk, aDC.getCompatibleHDC()));
+#ifdef SAL_DETAIL_ENABLE_LOG_INFO
+ SAL_INFO("vcl.gdi.opengl", "this=" << this << " now: " << maOpenGLGlyphCache);
+ DumpGlyphBitmap(aChunk, aDC.getCompatibleHDC());
+#endif
return true;
}