diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2013-10-23 21:31:51 -0700 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2013-10-23 21:33:33 -0700 |
commit | 52dd8a3e321bb965f8f02494026d545fddf54c01 (patch) | |
tree | ee9433ab5977e2ecec88f10197d16fd5b5d758e2 /platform/winrt/mupdfwinrt/Cache.cpp | |
parent | 3379beab77726c2be11e369113f4ca795ff883d9 (diff) | |
download | mupdf-52dd8a3e321bb965f8f02494026d545fddf54c01.tar.xz |
Fix so that multi-threaded rendering of display list works.
Proper use of mutex lock in areas where we multiple threads can
not be accessing the document or page level objects at the same
time. With this fix, multiple threads can be rendering different
display lists at the same time.
Also fix for use of page selection scroll bar so that it does not
render the page until the user lifts off the bar. This is the
same as the Android app and avoids smaller devices getting overloaded
if you do rapid scrolling in a document.
Diffstat (limited to 'platform/winrt/mupdfwinrt/Cache.cpp')
-rw-r--r-- | platform/winrt/mupdfwinrt/Cache.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/winrt/mupdfwinrt/Cache.cpp b/platform/winrt/mupdfwinrt/Cache.cpp index 77e253f0..b129710f 100644 --- a/platform/winrt/mupdfwinrt/Cache.cpp +++ b/platform/winrt/mupdfwinrt/Cache.cpp @@ -22,6 +22,7 @@ void Cache::Empty(fz_context *mu_ctx) cache_entry_t *old_entry = curr_entry; curr_entry = old_entry->next; fz_drop_display_list(mu_ctx, old_entry->dlist); + delete old_entry; } this->size = 0; @@ -30,7 +31,8 @@ void Cache::Empty(fz_context *mu_ctx) } } -void Cache::AddEntry(int value, fz_display_list *dlist, fz_context *mu_ctx) +void Cache::Add(int value, int width_in, int height_in, fz_display_list *dlist, + fz_context *mu_ctx) { std::lock_guard<std::mutex> lock(cache_lock); @@ -58,6 +60,8 @@ void Cache::AddEntry(int value, fz_display_list *dlist, fz_context *mu_ctx) new_entry->dlist = dlist; new_entry->index = value; + new_entry->width = width_in; + new_entry->height = height_in; new_entry->prev = NULL; if (head == NULL) { @@ -76,7 +80,7 @@ void Cache::AddEntry(int value, fz_display_list *dlist, fz_context *mu_ctx) fz_keep_display_list(mu_ctx, new_entry->dlist); } -fz_display_list* Cache::UseEntry(int value, fz_context *mu_ctx) +fz_display_list* Cache::Use(int value, int *width_out, int *height_out, fz_context *mu_ctx) { std::lock_guard<std::mutex> lock(cache_lock); cache_entry_t *curr_entry = this->head; @@ -107,6 +111,8 @@ fz_display_list* Cache::UseEntry(int value, fz_context *mu_ctx) head->prev = curr_entry; head = curr_entry; } + *width_out = curr_entry->width; + *height_out = curr_entry->height; return curr_entry->dlist; } else |