From 0368adfcba149c17a25eaf1ab2291ec89d303506 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Wed, 13 Jul 2016 15:04:53 +0900 Subject: [PATCH] pdf: Tentative implementation of mono support No idea if it's correct, since I have no sample. Also, simplify ARGB code. --- src/generic/evas/pdf/main.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/generic/evas/pdf/main.cpp b/src/generic/evas/pdf/main.cpp index 097f057b05..8623179b71 100644 --- a/src/generic/evas/pdf/main.cpp +++ b/src/generic/evas/pdf/main.cpp @@ -154,7 +154,21 @@ void poppler_load_image(int size_w EINA_UNUSED, int size_h EINA_UNUSED) if (out.format() == image::format_mono) { - //FIXME no idea what this format is like + // Looks like this is 1 bit per pixel, padded to a single byte. + // The problem is testing. I have no sample (and no doc). + + uint8_t *src; + for (y = 0; y < crop_height; y++) + { + src = (uint8_t *) out.data() + y * crop_width; + for (x = 0; x < crop_width; x++) + { + int bit = x & 0x7; + int c = (*src & (1 << bit)) ? 0xFF : 0x00; + *dst++ = ARGB_JOIN(0xFF, c, c, c); + if (x & 0x7 == 0x7) src++; + } + } } if (out.format() == image::format_rgb24) { @@ -172,11 +186,7 @@ void poppler_load_image(int size_w EINA_UNUSED, int size_h EINA_UNUSED) src = (DATA32*) out.data(); IMAGE_PIXEL_ITERATOR - { - int pos = x+y*crop_width; - - dst[pos] = src[pos]; - } + *dst++ = *src++; } end: