diff options
-rw-r--r-- | platform/winrt/libmupdf_winRT.vcxproj | 9 | ||||
-rw-r--r-- | platform/winrt/libmupdf_winRT.vcxproj.filters | 30 | ||||
-rw-r--r-- | platform/winrt/mupdfwinrt/muctx.cpp | 38 | ||||
-rw-r--r-- | platform/winrt/mupdfwinrt/muctx.h | 1 |
4 files changed, 67 insertions, 11 deletions
diff --git a/platform/winrt/libmupdf_winRT.vcxproj b/platform/winrt/libmupdf_winRT.vcxproj index 756a2b5a..9b12992b 100644 --- a/platform/winrt/libmupdf_winRT.vcxproj +++ b/platform/winrt/libmupdf_winRT.vcxproj @@ -70,6 +70,7 @@ <ClCompile Include="..\..\source\fitz\filter-fax.c" /> <ClCompile Include="..\..\source\fitz\filter-flate.c" /> <ClCompile Include="..\..\source\fitz\filter-jbig2.c" /> + <ClCompile Include="..\..\source\fitz\filter-leech.c" /> <ClCompile Include="..\..\source\fitz\filter-lzw.c" /> <ClCompile Include="..\..\source\fitz\filter-predict.c" /> <ClCompile Include="..\..\source\fitz\font.c" /> @@ -95,6 +96,7 @@ <ClCompile Include="..\..\source\fitz\output.c" /> <ClCompile Include="..\..\source\fitz\path.c" /> <ClCompile Include="..\..\source\fitz\pixmap.c" /> + <ClCompile Include="..\..\source\fitz\printf.c" /> <ClCompile Include="..\..\source\fitz\shade.c" /> <ClCompile Include="..\..\source\fitz\stext-device.c" /> <ClCompile Include="..\..\source\fitz\stext-output.c" /> @@ -114,6 +116,7 @@ <ClCompile Include="..\..\source\img\muimage.c" /> <ClCompile Include="..\..\source\pdf\pdf-annot.c" /> <ClCompile Include="..\..\source\pdf\pdf-appearance.c" /> + <ClCompile Include="..\..\source\pdf\pdf-clean.c" /> <ClCompile Include="..\..\source\pdf\pdf-cmap-load.c" /> <ClCompile Include="..\..\source\pdf\pdf-cmap-parse.c" /> <ClCompile Include="..\..\source\pdf\pdf-cmap-table.c" /> @@ -134,12 +137,16 @@ <ClCompile Include="..\..\source\pdf\pdf-metrics.c" /> <ClCompile Include="..\..\source\pdf\pdf-nametree.c" /> <ClCompile Include="..\..\source\pdf\pdf-object.c" /> + <ClCompile Include="..\..\source\pdf\pdf-op-buffer.c" /> + <ClCompile Include="..\..\source\pdf\pdf-op-filter.c" /> + <ClCompile Include="..\..\source\pdf\pdf-op-run.c" /> <ClCompile Include="..\..\source\pdf\pdf-outline.c" /> <ClCompile Include="..\..\source\pdf\pdf-page.c" /> <ClCompile Include="..\..\source\pdf\pdf-parse.c" /> <ClCompile Include="..\..\source\pdf\pdf-pattern.c" /> <ClCompile Include="..\..\source\pdf\pdf-pkcs7.c" /> <ClCompile Include="..\..\source\pdf\pdf-repair.c" /> + <ClCompile Include="..\..\source\pdf\pdf-run.c" /> <ClCompile Include="..\..\source\pdf\pdf-shade.c" /> <ClCompile Include="..\..\source\pdf\pdf-store.c" /> <ClCompile Include="..\..\source\pdf\pdf-stream.c" /> @@ -149,6 +156,7 @@ <ClCompile Include="..\..\source\pdf\pdf-xobject.c" /> <ClCompile Include="..\..\source\pdf\pdf-xref-aux.c" /> <ClCompile Include="..\..\source\pdf\pdf-xref.c" /> + <ClCompile Include="..\..\source\tiff\mutiff.c" /> <ClCompile Include="..\..\source\xps\xps-common.c" /> <ClCompile Include="..\..\source\xps\xps-doc.c" /> <ClCompile Include="..\..\source\xps\xps-glyphs.c" /> @@ -228,6 +236,7 @@ <ClInclude Include="..\..\source\fitz\unicodedata_db.h" /> <ClInclude Include="..\..\source\pdf\pdf-encodings.h" /> <ClInclude Include="..\..\source\pdf\pdf-glyphlist.h" /> + <ClInclude Include="..\..\source\pdf\pdf-interpret-imp.h" /> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{0715f3cf-5d1b-4617-a331-6527371365b7}</ProjectGuid> diff --git a/platform/winrt/libmupdf_winRT.vcxproj.filters b/platform/winrt/libmupdf_winRT.vcxproj.filters index be80fd15..841edf9d 100644 --- a/platform/winrt/libmupdf_winRT.vcxproj.filters +++ b/platform/winrt/libmupdf_winRT.vcxproj.filters @@ -25,6 +25,9 @@ <Filter Include="!include\pdf"> <UniqueIdentifier>{7b0f7938-a977-4cd9-a8bc-aeef816ae84c}</UniqueIdentifier> </Filter> + <Filter Include="tiff"> + <UniqueIdentifier>{90cc5056-84ea-40ea-9d8a-66a753c2e637}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="..\..\source\cbz\mucbz.c"> @@ -390,6 +393,30 @@ <ClCompile Include="..\..\source\fitz\load-jxr.c"> <Filter>fitz</Filter> </ClCompile> + <ClCompile Include="..\..\source\fitz\printf.c"> + <Filter>fitz</Filter> + </ClCompile> + <ClCompile Include="..\..\source\fitz\filter-leech.c"> + <Filter>fitz</Filter> + </ClCompile> + <ClCompile Include="..\..\source\pdf\pdf-op-filter.c"> + <Filter>pdf</Filter> + </ClCompile> + <ClCompile Include="..\..\source\pdf\pdf-op-buffer.c"> + <Filter>pdf</Filter> + </ClCompile> + <ClCompile Include="..\..\source\pdf\pdf-run.c"> + <Filter>pdf</Filter> + </ClCompile> + <ClCompile Include="..\..\source\pdf\pdf-op-run.c"> + <Filter>pdf</Filter> + </ClCompile> + <ClCompile Include="..\..\source\tiff\mutiff.c"> + <Filter>tiff</Filter> + </ClCompile> + <ClCompile Include="..\..\source\pdf\pdf-clean.c"> + <Filter>pdf</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\source\fitz\ucdn.h"> @@ -590,5 +617,8 @@ <ClInclude Include="..\..\include\mupdf\pdf\appearance.h"> <Filter>!include\pdf</Filter> </ClInclude> + <ClInclude Include="..\..\source\pdf\pdf-interpret-imp.h"> + <Filter>pdf</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/platform/winrt/mupdfwinrt/muctx.cpp b/platform/winrt/mupdfwinrt/muctx.cpp index cc3feff3..59f41204 100644 --- a/platform/winrt/mupdfwinrt/muctx.cpp +++ b/platform/winrt/mupdfwinrt/muctx.cpp @@ -7,28 +7,40 @@ * (other than the file streaming stuff) */ #ifdef _WINRT_DLL +// Attempt to use t.wait() +//#include <ppltasks.h> +//using namespace concurrency; /* File streaming set up for WinRT */ -static int win_read_file(fz_stream *stm, unsigned char *buf, int len) +static int win_next_file(fz_stream *stm, int len) { void *temp = stm->state; - win_stream_struct *stream = reinterpret_cast <win_stream_struct*> (temp); - IRandomAccessStream^ Stream = stream->stream; + win_stream_struct *state = reinterpret_cast <win_stream_struct*> (temp); + IRandomAccessStream^ Stream = state->stream; + unsigned char *buf = state->public_buffer; unsigned long long curr_pos = Stream->Position; unsigned long long length = Stream->Size; DataReader^ local_reader = ref new DataReader(Stream); if (local_reader == nullptr) return 0; - DataReaderLoadOperation^ result = local_reader->LoadAsync(len); - - /* Block on the Async call. This is not on the UI thread. */ - while(result->Status != AsyncStatus::Completed) { + // This does not work here. mupdf is not set up to wait for win_next_file + // to complete in an ansyn manner + //auto t = create_task(local_reader->LoadAsync(len)); + //t.wait(); + DataReaderLoadOperation^ result = local_reader->LoadAsync(len); + while (result->Status != AsyncStatus::Completed) { } result->GetResults(); + + /* First see what is available */ int curr_len2 = local_reader->UnconsumedBufferLength; if (curr_len2 < len) len = curr_len2; + /* And make sure that we have enough room */ + if (len > sizeof(state->public_buffer)) + len = sizeof(state->public_buffer); + Platform::Array<unsigned char>^ arrByte = ref new Platform::Array<unsigned char>(len); if (arrByte == nullptr) return 0; @@ -37,7 +49,12 @@ static int win_read_file(fz_stream *stm, unsigned char *buf, int len) memcpy(buf, arrByte->Data, len); local_reader->DetachStream(); - return len; + stm->rp = buf; + stm->wp = buf + len; + stm->pos += len; + if (len == 0) + return EOF; + return *stm->rp++; } static void win_seek_file(fz_stream *stm, int offset, int whence) @@ -64,8 +81,7 @@ static void win_seek_file(fz_stream *stm, int offset, int whence) Stream->Seek(n); curr_pos = Stream->Position; stm->pos = n; - stm->rp = stm->bp; - stm->wp = stm->bp; + stm->wp = stm->rp; } static void win_close_file(fz_context *ctx, void *state) @@ -78,7 +94,7 @@ static void win_close_file(fz_context *ctx, void *state) status_t muctx::InitializeStream(IRandomAccessStream^ readStream, char *ext) { win_stream.stream = readStream; - fz_stream *mu_stream = fz_new_stream(mu_ctx, 0, win_read_file, win_close_file, NULL); + fz_stream *mu_stream = fz_new_stream(mu_ctx, 0, win_next_file, win_close_file, NULL); mu_stream->seek = win_seek_file; mu_stream->state = reinterpret_cast <void*> (&win_stream); diff --git a/platform/winrt/mupdfwinrt/muctx.h b/platform/winrt/mupdfwinrt/muctx.h index 0a27af52..90ef90e2 100644 --- a/platform/winrt/mupdfwinrt/muctx.h +++ b/platform/winrt/mupdfwinrt/muctx.h @@ -58,6 +58,7 @@ using namespace Windows::Foundation; typedef struct win_stream_struct_s { IRandomAccessStream^ stream; + unsigned char public_buffer[4096]; } win_stream_struct; #endif |