summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2014-07-24 10:46:17 +0200
committerCarlos Garcia Campos <carlosgc@gnome.org>2014-07-24 12:03:31 +0200
commit02c127b355bb8a98684a5d0af063c60b8bfd09dd (patch)
tree8be1b439bfcd7e67e2c0523cee6125b7b99783dd
parentc841a703c4c1750fd7ac0d04c6c3e7d4af80b8fa (diff)
cairo: Make sure we always push a transparency group in setSoftMaskFromImageMask()
Because that's what unsetSoftMaskFromImageMask() assumes. https://bugs.freedesktop.org/show_bug.cgi?id=81624
-rw-r--r--poppler/CairoOutputDev.cc64
1 files changed, 31 insertions, 33 deletions
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index f31b46bd..c2827c6a 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1880,46 +1880,44 @@ void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stre
1880 delete imgStr; 1880 delete imgStr;
1881 1881
1882 invert_bit = invert ? 1 : 0; 1882 invert_bit = invert ? 1 : 0;
1883 if (pix ^ invert_bit) 1883 if (!(pix ^ invert_bit)) {
1884 return; 1884 cairo_save (cairo);
1885 1885 cairo_rectangle (cairo, 0., 0., width, height);
1886 cairo_save (cairo); 1886 cairo_fill (cairo);
1887 cairo_rectangle (cairo, 0., 0., width, height); 1887 cairo_restore (cairo);
1888 cairo_fill (cairo); 1888 if (cairo_shape) {
1889 cairo_restore (cairo); 1889 cairo_save (cairo_shape);
1890 if (cairo_shape) { 1890 cairo_rectangle (cairo_shape, 0., 0., width, height);
1891 cairo_save (cairo_shape); 1891 cairo_fill (cairo_shape);
1892 cairo_rectangle (cairo_shape, 0., 0., width, height); 1892 cairo_restore (cairo_shape);
1893 cairo_fill (cairo_shape); 1893 }
1894 cairo_restore (cairo_shape);
1895 } 1894 }
1896 return; 1895 } else {
1897 } 1896 cairo_push_group_with_content (cairo, CAIRO_CONTENT_ALPHA);
1898 1897
1899 cairo_push_group_with_content (cairo, CAIRO_CONTENT_ALPHA); 1898 /* shape is 1.0 for painted areas, 0.0 for unpainted ones */
1900 1899
1901 /* shape is 1.0 for painted areas, 0.0 for unpainted ones */ 1900 cairo_matrix_t matrix;
1901 cairo_get_matrix (cairo, &matrix);
1902 //XXX: it is possible that we should only do sub pixel positioning if
1903 // we are rendering fonts */
1904 if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) {
1905 drawImageMaskPrescaled(state, ref, str, width, height, invert, gFalse, inlineImg);
1906 } else {
1907 drawImageMaskRegular(state, ref, str, width, height, invert, gFalse, inlineImg);
1908 }
1902 1909
1903 cairo_matrix_t matrix; 1910 if (state->getFillColorSpace()->getMode() == csPattern) {
1904 cairo_get_matrix (cairo, &matrix); 1911 cairo_set_source_rgb (cairo, 1, 1, 1);
1905 //XXX: it is possible that we should only do sub pixel positioning if 1912 cairo_set_matrix (cairo, &mask_matrix);
1906 // we are rendering fonts */ 1913 cairo_mask (cairo, mask);
1907 if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) { 1914 }
1908 drawImageMaskPrescaled(state, ref, str, width, height, invert, gFalse, inlineImg);
1909 } else {
1910 drawImageMaskRegular(state, ref, str, width, height, invert, gFalse, inlineImg);
1911 }
1912 1915
1913 if (state->getFillColorSpace()->getMode() == csPattern) { 1916 if (mask)
1914 cairo_set_source_rgb (cairo, 1, 1, 1); 1917 cairo_pattern_destroy (mask);
1915 cairo_set_matrix (cairo, &mask_matrix); 1918 mask = cairo_pop_group (cairo);
1916 cairo_mask (cairo, mask);
1917 } 1919 }
1918 1920
1919 if (mask)
1920 cairo_pattern_destroy (mask);
1921 mask = cairo_pop_group (cairo);
1922
1923 saveState(state); 1921 saveState(state);
1924 double bbox[4] = {0,0,1,1}; // dummy 1922 double bbox[4] = {0,0,1,1}; // dummy
1925 beginTransparencyGroup(state, bbox, state->getFillColorSpace(), 1923 beginTransparencyGroup(state, bbox, state->getFillColorSpace(),