[Poppler-bugs] [Bug 19670] Colorizing text in pattern colorspace solved

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon May 4 05:46:48 PDT 2009


http://bugs.freedesktop.org/show_bug.cgi?id=19670





--- Comment #35 from thomasf <Thomas.Freitag at alfa.de>  2009-05-04 05:46:47 PST ---
Created an attachment (id=25412)
 --> (http://bugs.freedesktop.org/attachment.cgi?id=25412)
changes in Gfx.cc

To solve the regressions, I made two changes, to show the only differences here
the two changed methods:

In opSetFillGray I removed my changes. I definitely need this changes in
opSetFillCMYKColor, but they are wrong in opSetFillGray:

void Gfx::opSetFillGray(Object args[], int numArgs) {
  GfxColor color;

  state->setFillPattern(NULL);
  state->setFillColorSpace(new GfxDeviceGrayColorSpace());
  out->updateFillColorSpace(state);
  color.c[0] = dblToCol(args[0].getNum());
  state->setFillColor(&color);
  out->updateFillColor(state);
}

In opSetFillColorSpace I need to recognize if I'm in text drawing and, if so,
the colorspace change from / to csPattern:

void Gfx::opSetFillColorSpace(Object args[], int numArgs) {
  Object obj;
  GfxColorSpace *colorSpace;
  GfxColor color;

  state->setFillPattern(NULL);
  res->lookupColorSpace(args[0].getName(), &obj);
  if (obj.isNull()) {
    colorSpace = GfxColorSpace::parse(&args[0]);
  } else {
    colorSpace = GfxColorSpace::parse(&obj);
  }
  obj.free();
  if (colorSpace) {
    state->setFillColorSpace(colorSpace);
    out->updateFillColorSpace(state);
    colorSpace->getDefaultColor(&color);
    state->setFillColor(&color);
    out->updateFillColor(state);
        if (drawText) {
                if (colorSpace->getMode() == csPattern) {
                        colorSpaceText = NULL;
                        textHaveCSPattern = gTrue;
                        out->beginTextObject(state);
                } else if (textHaveCSPattern) {
                        out->endTextObject(state);
                        doPatternFill(gTrue);
                        out->restoreState(state);
                        textHaveCSPattern = gFalse;
                        out->beginTextObject(state);
                }
        }
  } else {
    error(getPos(), "Bad color space (fill)");
  }
}

I attach a new diff for Gfx.cc. I tested Your found regressions (also the speed
should be okay now again) and my PDFs where I need the changes. These PDFs are
working now!


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Poppler-bugs mailing list