From 858ac10caae93ffad55ae0b8bdc8189924504bc8 Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor.andersson@artifex.com>
Date: Wed, 2 Nov 2016 14:02:02 +0100
Subject: android: Don't bound twice in update_changed_rects.

---
 platform/android/viewer/jni/mupdf.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

(limited to 'platform/android')

diff --git a/platform/android/viewer/jni/mupdf.c b/platform/android/viewer/jni/mupdf.c
index c50d5a89..aa14a8f6 100644
--- a/platform/android/viewer/jni/mupdf.c
+++ b/platform/android/viewer/jni/mupdf.c
@@ -678,15 +678,18 @@ static void update_changed_rects(globals *glo, page_cache *pc, pdf_document *ido
 		if (pannot->changed)
 		{
 			fz_annot *annot = (fz_annot*)pannot;
+			fz_rect bounds;
+			rect_node *node;
 
-			/* FIXME: We bound the annot twice here */
-			rect_node *node = fz_malloc_struct(ctx, rect_node);
-			fz_bound_annot(ctx, annot, &node->rect);
+			fz_bound_annot(ctx, annot, &bounds);
+
+			node = fz_malloc_struct(ctx, rect_node);
+			node->rect = bounds;
 			node->next = pc->changed_rects;
 			pc->changed_rects = node;
 
 			node = fz_malloc_struct(ctx, rect_node);
-			fz_bound_annot(ctx, annot, &node->rect);
+			node->rect = bounds;
 			node->next = pc->hq_changed_rects;
 			pc->hq_changed_rects = node;
 
@@ -699,18 +702,21 @@ static void update_changed_rects_all_page(globals *glo, page_cache *pc, pdf_docu
 {
 	fz_context *ctx = glo->ctx;
 	fz_page *page = pc->page;
+	fz_rect bounds;
 	rect_node *node;
 
+	fz_bound_page(ctx, page, &node->rect);
+
 	drop_changed_rects(ctx, &pc->hq_changed_rects);
 	drop_changed_rects(ctx, &pc->changed_rects);
 
 	node = fz_malloc_struct(ctx, rect_node);
-	fz_bound_page(ctx, page, &node->rect);
+	node->rect = bounds;
 	node->next = pc->changed_rects;
 	pc->changed_rects = node;
 
 	node = fz_malloc_struct(ctx, rect_node);
-	fz_bound_page(ctx, page, &node->rect);
+	node->rect = bounds;
 	node->next = pc->hq_changed_rects;
 	pc->hq_changed_rects = node;
 }
-- 
cgit v1.2.3