summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2022-04-24 03:42:26 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2022-04-24 03:42:26 +0000
commitd743821ec3b71e00af5dc5541d4e7bf5b003c55e (patch)
tree8145068541ec45af3c223f5a35891d02e4adf273 /Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc
parentd0ce904282bf50ad444cf1ff7df7edd12a3b5a70 (diff)
xpdf 4.04
git-svn-id: svn://tug.org/texlive/trunk@63119 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc')
-rw-r--r--Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc33
1 files changed, 24 insertions, 9 deletions
diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc
index 877bcb88255..b833d5dabf0 100644
--- a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc
+++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc
@@ -421,7 +421,15 @@ void PDFCore::finishUpdate(GBool addToHist, GBool checkForChangedFile) {
}
// redraw
- invalidateWholeWindow();
+ // - if the bitmap is available (e.g., we just scrolled), we want to
+ // redraw immediately; if not, postpone the redraw until a
+ // tileDone or tick (incremental update) to avoid "flashing" the
+ // screen (drawing a blank background, followed by the actual
+ // content slightly later)
+ getWindowBitmap(gTrue);
+ if (bitmapFinished) {
+ invalidateWholeWindow();
+ }
updateScrollbars();
// add to history
@@ -436,21 +444,28 @@ void PDFCore::addToHistory() {
cur = &history[historyCur];
h.page = tileMap->getMidPage();
+ h.fileName = NULL;
#ifdef _WIN32
if (doc->getFileNameU()) {
- h.fileName = (wchar_t *)gmallocn(MAX_PATH + 1, sizeof(wchar_t));
- if (GetFullPathNameW(doc->getFileNameU(), MAX_PATH + 1,
- h.fileName, NULL) == 0) {
- h.fileName = NULL;
+ wchar_t dummy;
+ // NB: if the buffer is too small, GetFullPathNameW returns a
+ // *maximum* required buffer size, which may be larger than the
+ // size actually used by the second call (it looks like it just
+ // adds the size of the current directory and the sizef of the
+ // input path)
+ DWORD nChars = GetFullPathNameW(doc->getFileNameU(), 1, &dummy, NULL);
+ if (nChars > 0) {
+ h.fileName = (wchar_t *)gmallocn(nChars, sizeof(wchar_t));
+ if (GetFullPathNameW(doc->getFileNameU(), nChars,
+ h.fileName, NULL) == 0) {
+ gfree(h.fileName);
+ h.fileName = NULL;
+ }
}
- } else {
- h.fileName = NULL;
}
#else
if (doc->getFileName()) {
h.fileName = doc->getFileName()->copy();
- } else {
- h.fileName = NULL;
}
#endif
if (historyBLen > 0 && h.page == cur->page) {