Bug 1308394 - In CopyGlyphsToBuilder, use PathBuilder's backend instead of DrawTarget's. r=bas

--HG--
extra : rebase_source : 27d283fe8fecf613bdc4cc7c0492a0d3e97a3253
This commit is contained in:
Ethan Lin 2016-10-26 19:46:00 +02:00
Родитель 24632186f9
Коммит 68f7c140b8
6 изменённых файлов: 12 добавлений и 13 удалений

Просмотреть файл

@ -694,7 +694,7 @@ public:
* implementation in some backends, and more efficient implementation in
* others.
*/
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint = nullptr) = 0;
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, const Matrix *aTransformHint = nullptr) = 0;
/* This gets the metrics of a set of glyphs for the current font face.
*/

Просмотреть файл

@ -151,17 +151,18 @@ ScaledFontBase::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *a
}
void
ScaledFontBase::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint)
ScaledFontBase::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, const Matrix *aTransformHint)
{
BackendType backendType = aBuilder->GetBackendType();
#ifdef USE_SKIA
if (aBackendType == BackendType::SKIA) {
if (backendType == BackendType::SKIA) {
PathBuilderSkia *builder = static_cast<PathBuilderSkia*>(aBuilder);
builder->AppendPath(GetSkiaPathForGlyphs(aBuffer));
return;
}
#endif
#ifdef USE_CAIRO
if (aBackendType == BackendType::CAIRO) {
if (backendType == BackendType::CAIRO) {
MOZ_ASSERT(mScaledFont);
PathBuilderCairo* builder = static_cast<PathBuilderCairo*>(aBuilder);
@ -191,8 +192,6 @@ ScaledFontBase::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBu
return;
}
#endif
MOZ_CRASH("GFX: The specified backend type is not supported by CopyGlyphsToBuilder");
}
void

Просмотреть файл

@ -33,7 +33,7 @@ public:
virtual already_AddRefed<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint);
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, const Matrix *aTransformHint);
virtual void GetGlyphDesignMetrics(const uint16_t* aGlyphIndices, uint32_t aNumGlyphs, GlyphMetrics* aGlyphMetrics);

Просмотреть файл

@ -151,10 +151,11 @@ ScaledFontDWrite::GetSkTypeface()
#endif
void
ScaledFontDWrite::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint)
ScaledFontDWrite::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, const Matrix *aTransformHint)
{
if (aBackendType != BackendType::DIRECT2D && aBackendType != BackendType::DIRECT2D1_1) {
ScaledFontBase::CopyGlyphsToBuilder(aBuffer, aBuilder, aBackendType, aTransformHint);
BackendType backendType = aBuilder->GetBackendType();
if (backendType != BackendType::DIRECT2D && backendType != BackendType::DIRECT2D1_1) {
ScaledFontBase::CopyGlyphsToBuilder(aBuffer, aBuilder, aTransformHint);
return;
}

Просмотреть файл

@ -32,7 +32,7 @@ public:
virtual FontType GetType() const { return FontType::DWRITE; }
virtual already_AddRefed<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint);
virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, const Matrix *aTransformHint);
void CopyGlyphsToSink(const GlyphBuffer &aBuffer, ID2D1GeometrySink *aSink);

Просмотреть файл

@ -1736,8 +1736,7 @@ private:
mRunParams.context->EnsurePathBuilder();
Matrix mat = mRunParams.dt->GetTransform();
mFontParams.scaledFont->CopyGlyphsToBuilder(
buf, mRunParams.context->mPathBuilder,
mRunParams.dt->GetBackendType(), &mat);
buf, mRunParams.context->mPathBuilder, &mat);
}
mNumGlyphs = 0;