mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 738691 - Part 1: Add CopyGlyphsToBuilder API. r=jrmuizel
This commit is contained in:
parent
eaa02a2931
commit
283bb94230
@ -485,6 +485,13 @@ public:
|
||||
*/
|
||||
virtual TemporaryRef<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget) = 0;
|
||||
|
||||
/* This copies the path describing the glyphs into a PathBuilder. We use this
|
||||
* API rather than a generic API to append paths because it allows easier
|
||||
* implementation in some backends, and more efficient implementation in
|
||||
* others.
|
||||
*/
|
||||
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder) = 0;
|
||||
|
||||
protected:
|
||||
ScaledFont() {}
|
||||
};
|
||||
|
@ -132,6 +132,14 @@ ScaledFontBase::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *a
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ScaledFontBase::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder)
|
||||
{
|
||||
// XXX - implement me
|
||||
MOZ_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_CAIRO
|
||||
void
|
||||
ScaledFontBase::SetCairoScaledFont(cairo_scaled_font_t* font)
|
||||
|
@ -59,6 +59,9 @@ public:
|
||||
virtual ~ScaledFontBase();
|
||||
|
||||
virtual TemporaryRef<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
|
||||
|
||||
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder);
|
||||
|
||||
#ifdef USE_SKIA
|
||||
virtual SkTypeface* GetSkTypeface() { return mTypeface; }
|
||||
#endif
|
||||
|
@ -56,6 +56,24 @@ ScaledFontDWrite::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget
|
||||
PathBuilderD2D *pathBuilderD2D =
|
||||
static_cast<PathBuilderD2D*>(pathBuilder.get());
|
||||
|
||||
CopyGlyphsToSink(aBuffer, pathBuilderD2D->GetSink());
|
||||
|
||||
return pathBuilder->Finish();
|
||||
}
|
||||
|
||||
void
|
||||
ScaledFontDWrite::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder)
|
||||
{
|
||||
// XXX - Check path builder type!
|
||||
PathBuilderD2D *pathBuilderD2D =
|
||||
static_cast<PathBuilderD2D*>(aBuilder);
|
||||
|
||||
CopyGlyphsToSink(aBuffer, pathBuilderD2D->GetSink());
|
||||
}
|
||||
|
||||
void
|
||||
ScaledFontDWrite::CopyGlyphsToSink(const GlyphBuffer &aBuffer, ID2D1GeometrySink *aSink)
|
||||
{
|
||||
std::vector<UINT16> indices;
|
||||
std::vector<FLOAT> advances;
|
||||
std::vector<DWRITE_GLYPH_OFFSET> offsets;
|
||||
@ -72,9 +90,7 @@ ScaledFontDWrite::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget
|
||||
|
||||
mFontFace->GetGlyphRunOutline(mSize, &indices.front(), &advances.front(),
|
||||
&offsets.front(), aBuffer.mNumGlyphs,
|
||||
FALSE, FALSE, pathBuilderD2D->GetSink());
|
||||
|
||||
return pathBuilder->Finish();
|
||||
FALSE, FALSE, aSink);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "2D.h"
|
||||
#include <dwrite.h>
|
||||
|
||||
struct ID2D1GeometrySink;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
@ -55,10 +57,13 @@ public:
|
||||
virtual FontType GetType() const { return FONT_DWRITE; }
|
||||
|
||||
virtual TemporaryRef<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
|
||||
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder);
|
||||
|
||||
private:
|
||||
friend class DrawTargetD2D;
|
||||
|
||||
void CopyGlyphsToSink(const GlyphBuffer &aBuffer, ID2D1GeometrySink *aSink);
|
||||
|
||||
RefPtr<IDWriteFontFace> mFontFace;
|
||||
Float mSize;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user