[haiku-webkit-commits] Re: r312 - webkit/trunk/WebCore/platform/graphics/haiku

  • From: Maxime Simon <simon.maxime@xxxxxxxxx>
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Wed, 17 Mar 2010 10:51:11 +0100

On Mon, Mar 15, 2010 at 17:49, <webkit@xxxxxxxxxxxxxxx> wrote:

> Author: stippi
> Date: Mon Mar 15 16:49:35 2010
> New Revision: 312
> URL: http://mmlr.dyndns.org/changeset/312
>
> Log:
> Modified to use the new DrawString() with offsets per glyph, so that
> justified
> text and other stuff (CSS spacing) works again.
>
> Modified:
>   webkit/trunk/WebCore/platform/graphics/haiku/FontHaiku.cpp
>
> Modified: webkit/trunk/WebCore/platform/graphics/haiku/FontHaiku.cpp
>
> ==============================================================================
> --- webkit/trunk/WebCore/platform/graphics/haiku/FontHaiku.cpp  Sun Mar 14
> 23:23:38 2010        (r311)
> +++ webkit/trunk/WebCore/platform/graphics/haiku/FontHaiku.cpp  Mon Mar 15
> 16:49:35 2010        (r312)
> @@ -64,8 +64,16 @@
>     view->SetFont(font->platformData().font());
>
>     GlyphBufferGlyph* glyphs =
> const_cast<GlyphBufferGlyph*>(glyphBuffer.glyphs(from));
> -    CString converted = UTF8Encoding().encode((const UChar *)glyphs,
> numGlyphs, URLEncodedEntitiesForUnencodables);
> -    view->DrawString(converted.data(), converted.length(),
> BPoint(point.x(), point.y()));
> +    CString converted = UTF8Encoding().encode((const UChar*)glyphs,
> numGlyphs, URLEncodedEntitiesForUnencodables);
> +       BPoint offsets[numGlyphs];
> +       float offset = point.x();
> +    for (int i = 0; i < numGlyphs; i++) {
> +        offsets[i].x = offset;
> +        offsets[i].y = point.y();
> +        offset += glyphBuffer.advanceAt(from + i);
> +    }
> +
> +    view->DrawString(converted.data(), converted.length(), offsets,
> numGlyphs);
>
>     view->SetHighColor(oldColor);
>     view->SetDrawingMode(oldMode);
>
>
I got this issue from FontHaiku.cpp when compiling WebPositive.

WebCore/platform/graphics/haiku/FontHaiku.cpp: In member function 'void
> WebCore::Font::drawGlyphs(WebCore::GraphicsContext*, const
> WebCore::SimpleFontData*, const WebCore::GlyphBuffer&, int, int, const
> WebCore::FloatPoint&) const':

 WebCore/platform/graphics/haiku/FontHaiku.cpp:76: error: no matching
> function for call to 'BView::DrawString(const char*, unsigned int, BPoint
> [(((long unsigned int)(((int)numGlyphs) + -0x000000001)) + 1)], int&)'
> /boot/develop/headers/os/interface/View.h:427: note: candidates are: void
> BView::DrawString(const char*, escapement_delta*)

 /boot/develop/headers/os/interface/View.h:430: note: void
> BView::DrawString(const char*, BPoint, escapement_delta*)

/boot/develop/headers/os/interface/View.h:432: note: void
> BView::DrawString(const char*, int32, escapement_delta*)

/boot/develop/headers/os/interface/View.h:435: note: void
> BView::DrawString(const char*, int32, BPoint, escapement_delta*)


I assume it's from this change.
And a way to fix this should be to add a & before numGlyphs:

> view->DrawString(converted.data(), converted.length(), offsets,
> &numGlyphs);


Regards,
-- 
Maxime

Other related posts: