diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2014-02-19 10:44:40 -0800 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2014-09-09 16:39:31 -0700 |
commit | 16c749eac751d6b87c8bc209234fb3ad2c9f0943 (patch) | |
tree | 4301bfd05d21ac5455595a07d9cf5808851c9c91 /platform/winrt/gsview/ghostsharp.cs | |
parent | 2a6a9416b0337113ff8646a1d85741fc286a6c3b (diff) | |
download | mupdf-16c749eac751d6b87c8bc209234fb3ad2c9f0943.tar.xz |
Fix issues related to canceling gs, opening new files, and gs errors.
Bug fixes that I have found as I attempt to beat on this in various ways
Diffstat (limited to 'platform/winrt/gsview/ghostsharp.cs')
-rw-r--r-- | platform/winrt/gsview/ghostsharp.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/platform/winrt/gsview/ghostsharp.cs b/platform/winrt/gsview/ghostsharp.cs index 905bf2b9..f945ee1f 100644 --- a/platform/winrt/gsview/ghostsharp.cs +++ b/platform/winrt/gsview/ghostsharp.cs @@ -133,7 +133,7 @@ namespace gsview static class gsConstants { public const int E_QUIT = -101; - public const int GS_READ_BUFFER = 2048; + public const int GS_READ_BUFFER = 32768; } @@ -409,6 +409,11 @@ namespace gsview while ((count = fs.Read(Buffer, 0, gsConstants.GS_READ_BUFFER)) > 0) { gsapi_run_string_continue(gsInstance, FeedPtr, count, 0, ref exitcode); + if (exitcode < 0) + { + code = exitcode; + break; + } total = total + count; perc = 100.0 * (double) total / (double) len; worker.ReportProgress((int)perc); @@ -419,6 +424,8 @@ namespace gsview } } gsapi_run_string_end(gsInstance, 0, ref exitcode); + if (code == 0) + code = exitcode; } /* All the pinned items need to be freed so the GC can do its job */ @@ -498,6 +505,14 @@ namespace gsview return RunGhostscript(Params); } + public gsStatus GetStatus() + { + if (m_worker != null && m_worker.IsBusy) + return gsStatus.GS_BUSY; + else + return gsStatus.GS_READY; + } + private gsStatus RunGhostscript(gsParams_t Params) { /* Create background task for rendering the thumbnails. Allow |