diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2014-01-08 22:42:10 -0800 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2014-01-09 14:25:57 -0800 |
commit | cd84c92e68a7a3131895c469294235159ffab4dd (patch) | |
tree | c2f3b00708a583e8b6666f2131aab026b7f108e5 /platform/winrt/mupdfwinrt/mudocument.cpp | |
parent | 5249664dd8178e985b4ef47af6e1772b4c7665e7 (diff) | |
download | mupdf-cd84c92e68a7a3131895c469294235159ffab4dd.tar.xz |
Add tiling into the DirectX printing code.
The tiling in x and y is needed to ensure that we can print at high
resolutions with devices that have smaller bit map sizes (e.g. the surface).
Banding only in the y dimension like we often do is not sufficient.
Also fix an open with file association bug that must of occurred with the
transition to 8.1
And update WinRT solution for recent changes in mupdf code. This includes
the addition of a few new files and the document type registration.
Diffstat (limited to 'platform/winrt/mupdfwinrt/mudocument.cpp')
-rw-r--r-- | platform/winrt/mupdfwinrt/mudocument.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/platform/winrt/mupdfwinrt/mudocument.cpp b/platform/winrt/mupdfwinrt/mudocument.cpp index 48093780..b37b45aa 100644 --- a/platform/winrt/mupdfwinrt/mudocument.cpp +++ b/platform/winrt/mupdfwinrt/mudocument.cpp @@ -173,7 +173,9 @@ Windows::Foundation::IAsyncOperationWithProgress<int, double>^ thread to ensure that the thumbs are created in order and we don't create thousands of threads */ int mudocument::RenderPageBitmapSync(int page_num, int bmp_width, int bmp_height, - bool use_dlist, bool flipy, Array<unsigned char>^* bit_map) + float scale, bool use_dlist, bool flipy, bool tile, + Point top_left, Point bottom_right, + Array<unsigned char>^* bit_map) { status_t code; /* Allocate space for bmp */ @@ -206,14 +208,20 @@ int mudocument::RenderPageBitmapSync(int page_num, int bmp_width, int bmp_height } code = mu_object.RenderPageMT(dlist, page_width, page_height, &(bmp_data[0]), bmp_width, bmp_height, - flipy); + scale, flipy, tile, top_left, bottom_right); } else { + /* Not dealing with the case of tiling and no display list at this time. */ + if (tile) + { + *bit_map = nullptr; + return E_FAILURE; + } /* Rendering in immediate mode. Keep lock in place */ mutex_lock.lock(); code = mu_object.RenderPage(page_num, &(bmp_data[0]), bmp_width, - bmp_height, flipy); + bmp_height, scale, flipy); mutex_lock.unlock(); } if (code != S_ISOK) @@ -229,9 +237,9 @@ int mudocument::RenderPageBitmapSync(int page_num, int bmp_width, int bmp_height /* Pack the page into a bmp stream */ Windows::Foundation::IAsyncOperation<InMemoryRandomAccessStream^>^ mudocument::RenderPageAsync(int page_num, int bmp_width, int bmp_height, - bool use_dlist) + bool use_dlist, float scale) { - return create_async([this, bmp_width, bmp_height, page_num, use_dlist] + return create_async([this, bmp_width, bmp_height, page_num, use_dlist, scale] (cancellation_token ct) -> InMemoryRandomAccessStream^ { /* Allocate space for bmp */ @@ -270,14 +278,15 @@ Windows::Foundation::IAsyncOperation<InMemoryRandomAccessStream^>^ /* Rendering of display list can occur with other threads so unlock */ code = mu_object.RenderPageMT(dlist, page_width, page_height, &(bmp_data[0]), bmp_width, bmp_height, - true); + scale, true, false, { 0.0, 0.0 }, + { (float) bmp_width, (float) bmp_height }); } else - { + { /* Rendering in immediate mode. Keep lock in place */ mutex_lock.lock(); code = mu_object.RenderPage(page_num, &(bmp_data[0]), bmp_width, - bmp_height, true); + bmp_height, scale, true); mutex_lock.unlock(); } if (code != S_ISOK) |