[Libreoffice-commits] core.git: Branch 'feature/fixes8' - 3 commits - vcl/win
Tor Lillqvist
tml at collabora.com
Mon Aug 31 01:56:58 PDT 2015
vcl/win/source/gdi/winlayout.cxx | 48 +++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 24 deletions(-)
New commits:
commit 5a11de95b7c540beef85a90416bd9fc4640b8cdd
Author: Tor Lillqvist <tml at collabora.com>
Date: Sun Aug 30 08:31:27 2015 +0300
Don't check SAL_DETAIL_ENABLE_LOG_INFO, check SAL_LOG_INFO
SAL_DETAIL_ENABLE_LOG_INFO is always defined, as "true" or "false". It
is SAL_LOG_INFO that is defined or not, and can be used to avoid
unnecessary non-trivial code that the compiler might not be able to
optimise away.
Change-Id: I9903faab64b39fee86bff3b085cdce3614b0d921
(cherry picked from commit d23a1f4dabda939a216293c150c3679b0979d0bd)
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index ef27141..d36b265 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -104,7 +104,7 @@ public:
const OpenGLGlyphCacheChunk& GetCachedGlyphChunkFor(int nGlyphIndex) const;
};
-#ifdef SAL_DETAIL_ENABLE_LOG_INFO
+#ifdef SAL_LOG_INFO
namespace {
@@ -149,7 +149,7 @@ void DumpGlyphBitmap(OpenGLGlyphCacheChunk& rChunk, HDC hDC)
} // anonymous namespace
-#endif // SAL_DETAIL_ENABLE_LOG_INFO
+#endif // SAL_LOG_INFO
template< typename charT, typename traits >
inline std::basic_ostream<charT, traits> & operator <<(
@@ -427,7 +427,7 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
if (hNonAntialiasedFont != NULL)
DeleteObject(hNonAntialiasedFont);
-#ifdef SAL_DETAIL_ENABLE_LOG_INFO
+#ifdef SAL_LOG_INFO
SAL_INFO("vcl.gdi.opengl", "this=" << this << " now: " << maOpenGLGlyphCache);
DumpGlyphBitmap(aChunk, aDC.getCompatibleHDC());
#endif
commit ed084b0c3880a6e509271c134b052d4038cffd52
Author: Tor Lillqvist <tml at collabora.com>
Date: Sat Aug 29 09:02:31 2015 +0300
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
(cherry picked from commit 15943416240e29a052e3a6e4d338932e8c1ffb06)
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index d13f1b1..ef27141 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -104,6 +104,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))
@@ -114,47 +118,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 )
@@ -431,7 +427,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;
}
commit 6791acea1634f8f6e52a38fa3ffc9a6a0974ece3
Author: Tor Lillqvist <tml at collabora.com>
Date: Fri Aug 28 18:35:59 2015 +0300
Avoid accidental leftover unconditional debug printout
Change-Id: I67d2430aec782efa7916856584028f469d39355c
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index d341806..d13f1b1 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -276,9 +276,10 @@ bool ImplWinFontEntry::AddChunkOfGlyphs(int nGlyphIndex, const WinLayout& rLayou
return false;
}
+ std::ostringstream sLine;
for (int i = 0; i < nCount; i++)
- std::cerr << aABC[i].abcA << ":" << aABC[i].abcB << ":" << aABC[i].abcC << " ";
- std::cerr << std::endl;
+ sLine << aABC[i].abcA << ":" << aABC[i].abcB << ":" << aABC[i].abcC << " ";
+ SAL_INFO("vcl.gdi.opengl", "ABC widths: " << sLine.str());
// Try hard to avoid overlap as we want to be able to use
// individual rectangles for each glyph. The ABC widths don't
More information about the Libreoffice-commits
mailing list