[poppler] Implement Type 4, 5, 6, 7 shadings using cairo mesh gradients

Carlos Garcia Campos carlosgc at gnome.org
Wed Jan 26 00:15:01 PST 2011


Excerpts from Albert Astals Cid's message of mar ene 25 21:05:46 +0100 2011:
> A Dimarts, 25 de gener de 2011, Adrian Johnson va escriure:
> > On 25/01/11 00:56, Thomas Freitag wrote:
> > > I had a quick look at what Adrian has done in Gfc.cc, and think, that is
> > > a little bit misusing of out->gouraudTriangleShadedFill( state, shading)
> > > and out->patchMeshShadedFill( state, shading):
> > > 
> > > When these functions returns gTrue, this indicates that all work has
> > > already be done in the output device. How Adrian implements it is very
> > > special to Cairo. But it is quite ease to change it:
> > > Just move the lines
> > > 
> > > + double xMin, yMin, xMax, yMax;
> > > +
> > > + // get the clip region bbox
> > > + state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax);
> > > + state->moveTo(xMin, yMin);
> > > + state->lineTo(xMin, yMax);
> > > + state->lineTo(xMax, yMax);
> > > + state->lineTo(xMax, yMin);
> > > + state->closePath();
> > > + if (!contentIsHidden())
> > > + out->fill(state);
> > > + state->clearPath();
> > > 
> > > to CairoOutputDev::gouraudTriangleShadedFill respectively to
> > > CairoOutputDev::patchMeshShadedFill, i.e. if the actual implementation
> > > of gouraudTriangleShadedFill in CairoUtputDev would be renamed to
> > > formerGouraudTriangleShadedFill then do it like
> > > 
> > > GBool CairoOutputDev::gouraudTriangleShadedFill(GfxState *state,
> > > GfxGouraudTriangleShading *shading) {
> > > 
> > >         if (formerGouraudTriangleShadedFill(state, shading)) {
> > >         
> > >             double xMin, yMin, xMax, yMax;
> > >             
> > >              // get the clip region bbox
> > >              state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax);
> > >              state->moveTo(xMin, yMin);
> > >              state->lineTo(xMin, yMax);
> > >              state->lineTo(xMax, yMax);
> > >              state->lineTo(xMax, yMin);
> > >              state->closePath();
> > >              fill(state);
> > >              state->clearPath();
> > >              return gTrue;
> > >         
> > >         } else
> > >         
> > >             return gFalse;
> > > 
> > > }
> > > 
> > > patchMeshShadedFill simular. Then You don't need to change Gfx, and it
> > > fits to the other shading routines.
> > 
> > I'm attaching a new patch that moves the fill into the cairo backend.
> 
> Pending the discussion if we really need to do anything or not if content is 
> hidden (i'd vote for no but not really strong) this patch looks good to me.

Ok, I'll push the patch and change axial and radial gradients to also
return early when content is hidden. Ok?

> Albert
-- 
Carlos Garcia Campos
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20110126/cd42a6e3/attachment.pgp>


More information about the poppler mailing list