summaryrefslogtreecommitdiff
path: root/winrt/mupdfwinrt/mudocument.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'winrt/mupdfwinrt/mudocument.cpp')
-rw-r--r--winrt/mupdfwinrt/mudocument.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/winrt/mupdfwinrt/mudocument.cpp b/winrt/mupdfwinrt/mudocument.cpp
index fb227412..8688d520 100644
--- a/winrt/mupdfwinrt/mudocument.cpp
+++ b/winrt/mupdfwinrt/mudocument.cpp
@@ -162,11 +162,33 @@ Windows::Foundation::IAsyncOperationWithProgress<int, double>^
});
}
+/* Create the display list for this page */
+Windows::Foundation::IAsyncOperation<int>^ mudocument::CreateDisplayList(int page_num)
+{
+ return create_async([this, page_num](cancellation_token ct) -> int
+ {
+ if (mu_object.GetDisplayListPage() == page_num)
+ return S_ISOK;
+ std::lock_guard<std::mutex> lock(mutex_lock);
+ status_t code = mu_object.CreateDisplayList(page_num);
+ if (code != S_ISOK)
+ {
+ throw ref new FailureException("Display List Creation Failed");
+ }
+ return code;
+ });
+}
+
+int mudocument::GetDisplayListPage(void)
+{
+ return mu_object.GetDisplayListPage();
+}
+
/* Pack the page into a bmp stream */
Windows::Foundation::IAsyncOperation<InMemoryRandomAccessStream^>^
- mudocument::RenderPageAsync(int page_num, int width, int height)
+ mudocument::RenderPageAsync(int page_num, int width, int height, bool use_dlist)
{
- return create_async([this, width, height, page_num](cancellation_token ct) -> InMemoryRandomAccessStream^
+ return create_async([this, width, height, page_num, use_dlist](cancellation_token ct) -> InMemoryRandomAccessStream^
{
/* Allocate space for bmp */
Array<unsigned char>^ bmp_data = ref new Array<unsigned char>(height * 4 * width);
@@ -180,7 +202,8 @@ Windows::Foundation::IAsyncOperation<InMemoryRandomAccessStream^>^
std::lock_guard<std::mutex> lock(mutex_lock);
/* Get raster bitmap stream */
- status_t code = mu_object.RenderPage(page_num, width, height, &(bmp_data[0]));
+ status_t code = mu_object.RenderPage(page_num, width, height, &(bmp_data[0]),
+ use_dlist);
if (code != S_ISOK)
{
throw ref new FailureException("Page Rendering Failed");