[webkit-help] cairo error with latest wincairo build on Windows XP only

Thomas Brodt thomas.brodt.lists at porabo.ch
Tue Apr 16 06:19:17 PDT 2013


I got a step further with this issue, that some content can be displayed 
on Win7, but not on XP.

The actual error happens in drawGlyphsToContext(cr, font, glyphs, 
numGlyphs), when 0 is passed as the cr argument.
in FontCairo.cpp, there is a statement in  Font::drawGlyphs that says:

        cairo_t* cr = platformContext->cr();

I assume that this should return a valid context (m_cr), but in my case 
it returns a null pointer. And as this context is used in further calls, 
all these cairo calls fail, some gracefully, the last one with the 
access violation in pixman called from the cairo,dll.

Does anybody know why the cr is 0x00, when the platformContext.m_cr 
seems to be a valid context? And this only on Windows XP?

Any comments are welcome

Thomas

=================================================================

void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* 
font, const GlyphBuffer& glyphBuffer,
                       int from, int numGlyphs, const FloatPoint& point) 
const
{
     if (!font->platformData().size())
         return;

     GlyphBufferGlyph* glyphs = 
const_cast<GlyphBufferGlyph*>(glyphBuffer.glyphs(from));

     float offset = point.x();
     for (int i = 0; i < numGlyphs; i++) {
         glyphs[i].x = offset;
         glyphs[i].y = point.y();
         offset += glyphBuffer.advanceAt(from + i);
     }

     PlatformContextCairo* platformContext = context->platformContext();
     drawGlyphsShadow(context, point, font, glyphs, numGlyphs);

     cairo_t* cr = platformContext->cr();

/*** here cr is 0x00000000  ***/

     cairo_save(cr);

     if (context->textDrawingMode() & TextModeFill) {
         platformContext->prepareForFilling(context->state(), 
PlatformContextCairo::AdjustPatternForGlobalAlpha);
         drawGlyphsToContext(cr, font, glyphs, numGlyphs);
     }

     // Prevent running into a long computation within cairo. If the 
stroke width is
     // twice the size of the width of the text we will not ask cairo to 
stroke
     // the text as even one single stroke would cover the full wdth of 
the text.
     //  See https://bugs.webkit.org/show_bug.cgi?id=33759.
     if (context->textDrawingMode() & TextModeStroke && 
context->strokeThickness() < 2 * offset) {
platformContext->prepareForStroking(context->state());
         cairo_set_line_width(cr, context->strokeThickness());

         // This may disturb the CTM, but we are going to call 
cairo_restore soon after.
         cairo_set_scaled_font(cr, font->platformData().scaledFont());
         cairo_glyph_path(cr, glyphs, numGlyphs);
         cairo_stroke(cr);
     }

     cairo_restore(cr);
}



More information about the webkit-help mailing list