--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -871,34 +871,16 @@ public:
virtual already_AddRefed<UnscaledFont>
CreateUnscaledFont(uint32_t aIndex,
const uint8_t* aInstanceData,
uint32_t aInstanceDataLength) = 0;
virtual ~NativeFontResource() {}
};
-/** This class is designed to allow passing additional glyph rendering
- * parameters to the glyph drawing functions. This is an empty wrapper class
- * merely used to allow holding on to and passing around platform specific
- * parameters. This is because different platforms have unique rendering
- * parameters.
- */
-class GlyphRenderingOptions : public RefCounted<GlyphRenderingOptions>
-{
-public:
- MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GlyphRenderingOptions)
- virtual ~GlyphRenderingOptions() {}
-
- virtual FontType GetType() const = 0;
-
-protected:
- GlyphRenderingOptions() {}
-};
-
class DrawTargetCapture;
/** This is the main class used for all the drawing. It is created through the
* factory and accepts drawing commands. The results of drawing to a target
* may be used either through a Snapshot or by flushing the target and directly
* accessing the backing store a DrawTarget was created with.
*/
class DrawTarget : public external::AtomicRefCounted<DrawTarget>
@@ -1101,28 +1083,26 @@ public:
const DrawOptions &aOptions = DrawOptions()) = 0;
/**
* Fill a series of glyphs on the draw target with a certain source pattern.
*/
virtual void FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions = DrawOptions(),
- const GlyphRenderingOptions *aRenderingOptions = nullptr) = 0;
+ const DrawOptions &aOptions = DrawOptions()) = 0;
/**
* Stroke a series of glyphs on the draw target with a certain source pattern.
*/
virtual void StrokeGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions = StrokeOptions(),
- const DrawOptions& aOptions = DrawOptions(),
- const GlyphRenderingOptions* aRenderingOptions = nullptr);
+ const DrawOptions& aOptions = DrawOptions());
/**
* This takes a source pattern and a mask, and composites the source pattern
* onto the destination surface using the alpha channel of the mask pattern
* as a mask for the operation.
*
* @param aSource Source pattern
* @param aMask Mask pattern
@@ -1679,21 +1659,16 @@ public:
static already_AddRefed<DrawTarget> CreateTiledDrawTarget(const TileSet& aTileSet);
static bool DoesBackendSupportDataDrawtarget(BackendType aType);
#ifdef USE_SKIA
static already_AddRefed<DrawTarget> CreateDrawTargetWithSkCanvas(SkCanvas* aCanvas);
#endif
-#ifdef XP_DARWIN
- static already_AddRefed<GlyphRenderingOptions>
- CreateCGGlyphRenderingOptions(const Color &aFontSmoothingBackgroundColor);
-#endif
-
#ifdef MOZ_ENABLE_FREETYPE
static void SetFTLibrary(FT_Library aFTLibrary);
static FT_Library GetFTLibrary();
static FT_Library NewFTLibrary();
static void ReleaseFTLibrary(FT_Library aFTLibrary);
static void LockFTLibrary(FT_Library aFTLibrary);
static void UnlockFTLibrary(FT_Library aFTLibrary);
--- a/gfx/2d/DrawCommand.h
+++ b/gfx/2d/DrawCommand.h
@@ -534,98 +534,92 @@ private:
class FillGlyphsCommand : public DrawingCommand
{
friend class DrawTargetCaptureImpl;
public:
FillGlyphsCommand(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
- const DrawOptions& aOptions,
- const GlyphRenderingOptions* aRenderingOptions)
+ const DrawOptions& aOptions)
: DrawingCommand(CommandType::FILLGLYPHS)
, mFont(aFont)
, mPattern(aPattern)
, mOptions(aOptions)
- , mRenderingOptions(const_cast<GlyphRenderingOptions*>(aRenderingOptions))
{
mGlyphs.resize(aBuffer.mNumGlyphs);
memcpy(&mGlyphs.front(), aBuffer.mGlyphs, sizeof(Glyph) * aBuffer.mNumGlyphs);
}
void CloneInto(CaptureCommandList* aList) {
GlyphBuffer glyphs = {
mGlyphs.data(),
(uint32_t)mGlyphs.size(),
};
- CLONE_INTO(FillGlyphsCommand)(mFont, glyphs, mPattern, mOptions, mRenderingOptions);
+ CLONE_INTO(FillGlyphsCommand)(mFont, glyphs, mPattern, mOptions);
}
virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
{
GlyphBuffer buf;
buf.mNumGlyphs = mGlyphs.size();
buf.mGlyphs = &mGlyphs.front();
- aDT->FillGlyphs(mFont, buf, mPattern, mOptions, mRenderingOptions);
+ aDT->FillGlyphs(mFont, buf, mPattern, mOptions);
}
static const bool AffectsSnapshot = true;
private:
RefPtr<ScaledFont> mFont;
std::vector<Glyph> mGlyphs;
StoredPattern mPattern;
DrawOptions mOptions;
- RefPtr<GlyphRenderingOptions> mRenderingOptions;
};
class StrokeGlyphsCommand : public StrokeOptionsCommand
{
friend class DrawTargetCaptureImpl;
public:
StrokeGlyphsCommand(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
- const DrawOptions& aOptions,
- const GlyphRenderingOptions* aRenderingOptions)
+ const DrawOptions& aOptions)
: StrokeOptionsCommand(CommandType::STROKEGLYPHS, aStrokeOptions)
, mFont(aFont)
, mPattern(aPattern)
, mOptions(aOptions)
- , mRenderingOptions(const_cast<GlyphRenderingOptions*>(aRenderingOptions))
{
mGlyphs.resize(aBuffer.mNumGlyphs);
memcpy(&mGlyphs.front(), aBuffer.mGlyphs, sizeof(Glyph) * aBuffer.mNumGlyphs);
}
void CloneInto(CaptureCommandList* aList) {
GlyphBuffer glyphs = {
mGlyphs.data(),
(uint32_t)mGlyphs.size(),
};
- CLONE_INTO(StrokeGlyphsCommand)(mFont, glyphs, mPattern, mStrokeOptions, mOptions, mRenderingOptions);
+ CLONE_INTO(StrokeGlyphsCommand)(mFont, glyphs, mPattern, mStrokeOptions, mOptions);
}
virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
{
GlyphBuffer buf;
buf.mNumGlyphs = mGlyphs.size();
buf.mGlyphs = &mGlyphs.front();
- aDT->StrokeGlyphs(mFont, buf, mPattern, mStrokeOptions, mOptions, mRenderingOptions);
+ aDT->StrokeGlyphs(mFont, buf, mPattern, mStrokeOptions, mOptions);
}
static const bool AffectsSnapshot = true;
private:
RefPtr<ScaledFont> mFont;
std::vector<Glyph> mGlyphs;
StoredPattern mPattern;
DrawOptions mOptions;
- RefPtr<GlyphRenderingOptions> mRenderingOptions;
};
class MaskCommand : public DrawingCommand
{
public:
MaskCommand(const Pattern& aSource,
const Pattern& aMask,
const DrawOptions& aOptions)
--- a/gfx/2d/DrawTarget.cpp
+++ b/gfx/2d/DrawTarget.cpp
@@ -203,18 +203,17 @@ DrawTarget::PushDeviceSpaceClipRects(con
SetTransform(oldTransform);
}
void
DrawTarget::StrokeGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
- const DrawOptions& aOptions,
- const GlyphRenderingOptions* aRenderingOptions)
+ const DrawOptions& aOptions)
{
RefPtr<Path> path = aFont->GetPathForGlyphs(aBuffer, this);
Stroke(path, aPattern, aStrokeOptions, aOptions);
}
already_AddRefed<SourceSurface>
DrawTarget::IntoLuminanceSource(LuminanceType aMaskType, float aOpacity)
{
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -1346,18 +1346,17 @@ DrawTargetCairo::SetPermitSubpixelAA(boo
aPermitSubpixelAA ? CAIRO_SUBPIXEL_ANTIALIASING_ENABLED : CAIRO_SUBPIXEL_ANTIALIASING_DISABLED);
#endif
}
void
DrawTargetCairo::FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions,
- const GlyphRenderingOptions*)
+ const DrawOptions &aOptions)
{
if (mTransformSingular) {
return;
}
if (!IsValid()) {
gfxDebug() << "FillGlyphs bad surface " << cairo_surface_status(cairo_get_group_target(mContext));
return;
--- a/gfx/2d/DrawTargetCairo.h
+++ b/gfx/2d/DrawTargetCairo.h
@@ -120,18 +120,17 @@ public:
virtual void Fill(const Path *aPath,
const Pattern &aPattern,
const DrawOptions &aOptions = DrawOptions()) override;
virtual void FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions,
- const GlyphRenderingOptions *aRenderingOptions = nullptr) override;
+ const DrawOptions &aOptions) override;
virtual void Mask(const Pattern &aSource,
const Pattern &aMask,
const DrawOptions &aOptions = DrawOptions()) override;
virtual void MaskSurface(const Pattern &aSource,
SourceSurface *aMask,
Point aOffset,
const DrawOptions &aOptions = DrawOptions()) override;
--- a/gfx/2d/DrawTargetCapture.cpp
+++ b/gfx/2d/DrawTargetCapture.cpp
@@ -218,30 +218,28 @@ DrawTargetCaptureImpl::Fill(const Path*
{
AppendCommand(FillCommand)(aPath, aPattern, aOptions);
}
void
DrawTargetCaptureImpl::FillGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
- const DrawOptions& aOptions,
- const GlyphRenderingOptions* aRenderingOptions)
+ const DrawOptions& aOptions)
{
- AppendCommand(FillGlyphsCommand)(aFont, aBuffer, aPattern, aOptions, aRenderingOptions);
+ AppendCommand(FillGlyphsCommand)(aFont, aBuffer, aPattern, aOptions);
}
void DrawTargetCaptureImpl::StrokeGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
- const DrawOptions& aOptions,
- const GlyphRenderingOptions* aRenderingOptions)
+ const DrawOptions& aOptions)
{
- AppendCommand(StrokeGlyphsCommand)(aFont, aBuffer, aPattern, aStrokeOptions, aOptions, aRenderingOptions);
+ AppendCommand(StrokeGlyphsCommand)(aFont, aBuffer, aPattern, aStrokeOptions, aOptions);
}
void
DrawTargetCaptureImpl::Mask(const Pattern &aSource,
const Pattern &aMask,
const DrawOptions &aOptions)
{
AppendCommand(MaskCommand)(aSource, aMask, aOptions);
@@ -368,17 +366,17 @@ DrawTargetCaptureImpl::ContainsOnlyColor
}
aColor = colorPat->mColor;
if (fillGlyphs->mOptions.mCompositionOp != CompositionOp::OP_OVER ||
fillGlyphs->mOptions.mAlpha != 1.0f) {
return false;
}
- //TODO: Deal with AA on the DrawOptions, and the GlyphRenderingOptions
+ //TODO: Deal with AA on the DrawOptions
aGlyphs.insert(aGlyphs.end(),
fillGlyphs->mGlyphs.begin(),
fillGlyphs->mGlyphs.end());
result = true;
}
return result;
}
--- a/gfx/2d/DrawTargetCapture.h
+++ b/gfx/2d/DrawTargetCapture.h
@@ -79,24 +79,22 @@ public:
const StrokeOptions &aStrokeOptions = StrokeOptions(),
const DrawOptions &aOptions = DrawOptions()) override;
virtual void Fill(const Path *aPath,
const Pattern &aPattern,
const DrawOptions &aOptions = DrawOptions()) override;
virtual void FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions = DrawOptions(),
- const GlyphRenderingOptions *aRenderingOptions = nullptr) override;
+ const DrawOptions &aOptions = DrawOptions()) override;
virtual void StrokeGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions = StrokeOptions(),
- const DrawOptions& aOptions = DrawOptions(),
- const GlyphRenderingOptions* aRenderingOptions = nullptr) override;
+ const DrawOptions& aOptions = DrawOptions()) override;
virtual void Mask(const Pattern &aSource,
const Pattern &aMask,
const DrawOptions &aOptions = DrawOptions()) override;
virtual void PushClip(const Path *aPath) override;
virtual void PushClipRect(const Rect &aRect) override;
virtual void PopClip() override;
virtual void PushLayer(bool aOpaque,
Float aOpacity,
--- a/gfx/2d/DrawTargetD2D1.cpp
+++ b/gfx/2d/DrawTargetD2D1.cpp
@@ -606,18 +606,17 @@ DrawTargetD2D1::Fill(const Path *aPath,
FinalizeDrawing(aOptions.mCompositionOp, aPattern);
}
void
DrawTargetD2D1::FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions,
- const GlyphRenderingOptions*)
+ const DrawOptions &aOptions)
{
if (aFont->GetType() != FontType::DWRITE) {
gfxDebug() << *this << ": Ignoring drawing call for incompatible font.";
return;
}
ScaledFontDWrite *font = static_cast<ScaledFontDWrite*>(aFont);
--- a/gfx/2d/DrawTargetD2D1.h
+++ b/gfx/2d/DrawTargetD2D1.h
@@ -85,18 +85,17 @@ public:
const StrokeOptions &aStrokeOptions = StrokeOptions(),
const DrawOptions &aOptions = DrawOptions()) override;
virtual void Fill(const Path *aPath,
const Pattern &aPattern,
const DrawOptions &aOptions = DrawOptions()) override;
virtual void FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions = DrawOptions(),
- const GlyphRenderingOptions *aRenderingOptions = nullptr) override;
+ const DrawOptions &aOptions = DrawOptions()) override;
virtual void Mask(const Pattern &aSource,
const Pattern &aMask,
const DrawOptions &aOptions = DrawOptions()) override;
virtual void PushClip(const Path *aPath) override;
virtual void PushClipRect(const Rect &aRect) override;
virtual void PushDeviceSpaceClipRects(const IntRect* aRects, uint32_t aCount) override;
virtual void PopClip() override;
--- a/gfx/2d/DrawTargetDual.cpp
+++ b/gfx/2d/DrawTargetDual.cpp
@@ -174,22 +174,21 @@ DrawTargetDual::Fill(const Path *aPath,
{
DualPattern pattern(aPattern);
mA->Fill(aPath, *pattern.mA, aOptions);
mB->Fill(aPath, *pattern.mB, aOptions);
}
void
DrawTargetDual::FillGlyphs(ScaledFont *aScaledFont, const GlyphBuffer &aBuffer,
- const Pattern &aPattern, const DrawOptions &aOptions,
- const GlyphRenderingOptions *aRenderingOptions)
+ const Pattern &aPattern, const DrawOptions &aOptions)
{
DualPattern pattern(aPattern);
- mA->FillGlyphs(aScaledFont, aBuffer, *pattern.mA, aOptions, aRenderingOptions);
- mB->FillGlyphs(aScaledFont, aBuffer, *pattern.mB, aOptions, aRenderingOptions);
+ mA->FillGlyphs(aScaledFont, aBuffer, *pattern.mA, aOptions);
+ mB->FillGlyphs(aScaledFont, aBuffer, *pattern.mB, aOptions);
}
void
DrawTargetDual::Mask(const Pattern &aSource, const Pattern &aMask, const DrawOptions &aOptions)
{
DualPattern source(aSource);
DualPattern mask(aMask);
mA->Mask(*source.mA, *mask.mA, aOptions);
--- a/gfx/2d/DrawTargetDual.h
+++ b/gfx/2d/DrawTargetDual.h
@@ -99,18 +99,17 @@ public:
const StrokeOptions &aStrokeOptions, const DrawOptions &aOptions) override;
virtual void Stroke(const Path *aPath, const Pattern &aPattern,
const StrokeOptions &aStrokeOptions, const DrawOptions &aOptions) override;
virtual void Fill(const Path *aPath, const Pattern &aPattern, const DrawOptions &aOptions) override;
virtual void FillGlyphs(ScaledFont *aScaledFont, const GlyphBuffer &aBuffer,
- const Pattern &aPattern, const DrawOptions &aOptions,
- const GlyphRenderingOptions *aRenderingOptions) override;
+ const Pattern &aPattern, const DrawOptions &aOptions) override;
virtual void Mask(const Pattern &aSource, const Pattern &aMask, const DrawOptions &aOptions) override;
virtual void PushLayer(bool aOpaque, Float aOpacity,
SourceSurface* aMask,
const Matrix& aMaskTransform,
const IntRect& aBounds = IntRect(),
bool aCopyBackground = false) override;
--- a/gfx/2d/DrawTargetRecording.cpp
+++ b/gfx/2d/DrawTargetRecording.cpp
@@ -319,18 +319,17 @@ void RecordingFontUserDataDestroyFunc(vo
userData->recorder->RemoveScaledFont((ScaledFont*)userData->refPtr);
delete userData;
}
void
DrawTargetRecording::FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions,
- const GlyphRenderingOptions *aRenderingOptions)
+ const DrawOptions &aOptions)
{
EnsurePatternDependenciesStored(aPattern);
UserDataKey* userDataKey = reinterpret_cast<UserDataKey*>(mRecorder.get());
if (!aFont->GetUserData(userDataKey)) {
UnscaledFont* unscaledFont = aFont->GetUnscaledFont();
if (mRecorder->WantsExternalFonts()) {
size_t index = mRecorder->GetUnscaledFontIndex(unscaledFont);
--- a/gfx/2d/DrawTargetRecording.h
+++ b/gfx/2d/DrawTargetRecording.h
@@ -164,18 +164,17 @@ public:
const DrawOptions &aOptions = DrawOptions()) override;
/*
* Fill a series of clyphs on the draw target with a certain source pattern.
*/
virtual void FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions = DrawOptions(),
- const GlyphRenderingOptions *aRenderingOptions = nullptr) override;
+ const DrawOptions &aOptions = DrawOptions()) override;
/*
* This takes a source pattern and a mask, and composites the source pattern
* onto the destination surface using the alpha channel of the mask pattern
* as a mask for the operation.
*
* aSource Source pattern
* aMask Mask pattern
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -1250,18 +1250,17 @@ SetFontColor(CGContextRef aCGContext, CG
* background color the text will draw onto so that CG can render the text
* properly. After that, we have to go back and fixup the pixels
* such that their alpha values are correct.
*/
bool
DrawTargetSkia::FillGlyphsWithCG(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions,
- const GlyphRenderingOptions *aRenderingOptions)
+ const DrawOptions &aOptions)
{
MOZ_ASSERT(aFont->GetType() == FontType::MAC);
MOZ_ASSERT(aPattern.GetType() == PatternType::COLOR);
CGContextRef cgContext = BorrowCGContext(aOptions);
if (!cgContext) {
return false;
}
@@ -1348,18 +1347,17 @@ CanDrawFont(ScaledFont* aFont)
}
}
void
DrawTargetSkia::DrawGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions* aStrokeOptions,
- const DrawOptions& aOptions,
- const GlyphRenderingOptions* aRenderingOptions)
+ const DrawOptions& aOptions)
{
if (!CanDrawFont(aFont)) {
return;
}
MarkChanged();
#ifdef MOZ_WIDGET_COCOA
@@ -1480,31 +1478,29 @@ DrawTargetSkia::DrawGlyphs(ScaledFont* a
mCanvas->drawPosText(indices, aBuffer.mNumGlyphs*2, offsets, paint.mPaint);
}
void
DrawTargetSkia::FillGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
- const DrawOptions& aOptions,
- const GlyphRenderingOptions* aRenderingOptions)
+ const DrawOptions& aOptions)
{
- DrawGlyphs(aFont, aBuffer, aPattern, nullptr, aOptions, aRenderingOptions);
+ DrawGlyphs(aFont, aBuffer, aPattern, nullptr, aOptions);
}
void
DrawTargetSkia::StrokeGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
- const DrawOptions& aOptions,
- const GlyphRenderingOptions* aRenderingOptions)
+ const DrawOptions& aOptions)
{
- DrawGlyphs(aFont, aBuffer, aPattern, &aStrokeOptions, aOptions, aRenderingOptions);
+ DrawGlyphs(aFont, aBuffer, aPattern, &aStrokeOptions, aOptions);
}
void
DrawTargetSkia::Mask(const Pattern &aSource,
const Pattern &aMask,
const DrawOptions &aOptions)
{
MarkChanged();
--- a/gfx/2d/DrawTargetSkia.h
+++ b/gfx/2d/DrawTargetSkia.h
@@ -80,24 +80,22 @@ public:
const DrawOptions &aOptions = DrawOptions()) override;
virtual void Fill(const Path *aPath,
const Pattern &aPattern,
const DrawOptions &aOptions = DrawOptions()) override;
virtual void FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions = DrawOptions(),
- const GlyphRenderingOptions *aRenderingOptions = nullptr) override;
+ const DrawOptions &aOptions = DrawOptions()) override;
virtual void StrokeGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions = StrokeOptions(),
- const DrawOptions& aOptions = DrawOptions(),
- const GlyphRenderingOptions* aRenderingOptions = nullptr) override;
+ const DrawOptions& aOptions = DrawOptions()) override;
virtual void Mask(const Pattern &aSource,
const Pattern &aMask,
const DrawOptions &aOptions = DrawOptions()) override;
virtual void MaskSurface(const Pattern &aSource,
SourceSurface *aMask,
Point aOffset,
const DrawOptions &aOptions = DrawOptions()) override;
virtual bool Draw3DTransformedSurface(SourceSurface* aSurface,
@@ -167,18 +165,17 @@ private:
void MarkChanged();
bool ShouldLCDRenderText(FontType aFontType, AntialiasMode aAntialiasMode);
void DrawGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions* aStrokeOptions = nullptr,
- const DrawOptions& aOptions = DrawOptions(),
- const GlyphRenderingOptions* aRenderingOptions = nullptr);
+ const DrawOptions& aOptions = DrawOptions());
bool UsingSkiaGPU() const;
struct PushedLayer
{
PushedLayer(bool aOldPermitSubpixelAA,
bool aOpaque,
Float aOpacity,
@@ -213,18 +210,17 @@ private:
#ifdef MOZ_WIDGET_COCOA
friend class BorrowedCGContext;
CGContextRef BorrowCGContext(const DrawOptions &aOptions);
void ReturnCGContext(CGContextRef);
bool FillGlyphsWithCG(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
- const DrawOptions& aOptions = DrawOptions(),
- const GlyphRenderingOptions* aRenderingOptions = nullptr);
+ const DrawOptions& aOptions = DrawOptions());
CGContextRef mCG;
CGColorSpaceRef mColorSpace;
uint8_t* mCanvasData;
IntSize mCGSize;
bool mNeedLayer;
#endif
};
--- a/gfx/2d/DrawTargetTiled.cpp
+++ b/gfx/2d/DrawTargetTiled.cpp
@@ -106,17 +106,17 @@ DrawTargetTiled::DetachAllSnapshots()
mTiles[i].mDrawTarget->command(arg1, arg2, arg3, arg4, arg5); \
} \
}
TILED_COMMAND(Flush)
TILED_COMMAND4(DrawFilter, FilterNode*, const Rect&, const Point&, const DrawOptions&)
TILED_COMMAND1(ClearRect, const Rect&)
TILED_COMMAND4(MaskSurface, const Pattern&, SourceSurface*, Point, const DrawOptions&)
-TILED_COMMAND5(FillGlyphs, ScaledFont*, const GlyphBuffer&, const Pattern&, const DrawOptions&, const GlyphRenderingOptions*)
+TILED_COMMAND4(FillGlyphs, ScaledFont*, const GlyphBuffer&, const Pattern&, const DrawOptions&)
TILED_COMMAND3(Mask, const Pattern&, const Pattern&, const DrawOptions&)
void
DrawTargetTiled::PushClip(const Path* aPath)
{
if (!mClippedOutTilesStack.append(std::vector<bool>(mTiles.size()))) {
MOZ_CRASH("out of memory");
}
--- a/gfx/2d/DrawTargetTiled.h
+++ b/gfx/2d/DrawTargetTiled.h
@@ -95,18 +95,17 @@ public:
const StrokeOptions &aStrokeOptions = StrokeOptions(),
const DrawOptions &aOptions = DrawOptions()) override;
virtual void Fill(const Path *aPath,
const Pattern &aPattern,
const DrawOptions &aOptions = DrawOptions()) override;
virtual void FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions = DrawOptions(),
- const GlyphRenderingOptions *aRenderingOptions = nullptr) override;
+ const DrawOptions &aOptions = DrawOptions()) override;
virtual void Mask(const Pattern &aSource,
const Pattern &aMask,
const DrawOptions &aOptions = DrawOptions()) override;
virtual void PushClip(const Path *aPath) override;
virtual void PushClipRect(const Rect &aRect) override;
virtual void PopClip() override;
virtual void PushLayer(bool aOpaque, Float aOpacity,
SourceSurface* aMask,
--- a/gfx/2d/DrawTargetWrapAndRecord.cpp
+++ b/gfx/2d/DrawTargetWrapAndRecord.cpp
@@ -380,18 +380,17 @@ void WrapAndRecordFontUserDataDestroyFun
userData->recorder->RemoveScaledFont((ScaledFont*)userData->refPtr);
delete userData;
}
void
DrawTargetWrapAndRecord::FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions,
- const GlyphRenderingOptions *aRenderingOptions)
+ const DrawOptions &aOptions)
{
EnsurePatternDependenciesStored(aPattern);
UserDataKey* userDataKey = reinterpret_cast<UserDataKey*>(mRecorder.get());
if (!aFont->GetUserData(userDataKey)) {
UnscaledFont* unscaledFont = aFont->GetUnscaledFont();
if (!mRecorder->HasStoredObject(unscaledFont)) {
RecordedFontData fontData(unscaledFont);
@@ -422,17 +421,17 @@ DrawTargetWrapAndRecord::FillGlyphs(Scal
WrapAndRecordFontUserData *userData = new WrapAndRecordFontUserData;
userData->refPtr = aFont;
userData->recorder = mRecorder;
aFont->AddUserData(userDataKey, userData, &WrapAndRecordFontUserDataDestroyFunc);
userData->recorder->AddScaledFont(aFont);
}
mRecorder->RecordEvent(RecordedFillGlyphs(this, aFont, aPattern, aOptions, aBuffer.mGlyphs, aBuffer.mNumGlyphs));
- mFinalDT->FillGlyphs(aFont, aBuffer, *AdjustedPattern(aPattern), aOptions, aRenderingOptions);
+ mFinalDT->FillGlyphs(aFont, aBuffer, *AdjustedPattern(aPattern), aOptions);
}
void
DrawTargetWrapAndRecord::Mask(const Pattern &aSource,
const Pattern &aMask,
const DrawOptions &aOptions)
{
EnsurePatternDependenciesStored(aSource);
--- a/gfx/2d/DrawTargetWrapAndRecord.h
+++ b/gfx/2d/DrawTargetWrapAndRecord.h
@@ -164,18 +164,17 @@ public:
const DrawOptions &aOptions = DrawOptions()) override;
/*
* Fill a series of clyphs on the draw target with a certain source pattern.
*/
virtual void FillGlyphs(ScaledFont *aFont,
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
- const DrawOptions &aOptions = DrawOptions(),
- const GlyphRenderingOptions *aRenderingOptions = nullptr) override;
+ const DrawOptions &aOptions = DrawOptions()) override;
/*
* This takes a source pattern and a mask, and composites the source pattern
* onto the destination surface using the alpha channel of the mask pattern
* as a mask for the operation.
*
* aSource Source pattern
* aMask Mask pattern
--- a/gfx/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -1051,24 +1051,16 @@ Factory::CreateWrappingDataSourceSurface
MOZ_ASSERT(aData);
RefPtr<SourceSurfaceRawData> newSurf = new SourceSurfaceRawData();
newSurf->InitWrappingData(aData, aSize, aStride, aFormat, aDeallocator, aClosure);
return newSurf.forget();
}
-#ifdef XP_DARWIN
-already_AddRefed<GlyphRenderingOptions>
-Factory::CreateCGGlyphRenderingOptions(const Color &aFontSmoothingBackgroundColor)
-{
- return MakeAndAddRef<GlyphRenderingOptionsCG>(aFontSmoothingBackgroundColor);
-}
-#endif
-
already_AddRefed<DataSourceSurface>
Factory::CreateDataSourceSurface(const IntSize &aSize,
SurfaceFormat aFormat,
bool aZero)
{
if (!AllowedSurfaceSize(aSize)) {
gfxCriticalError(LoggerOptionsBasedOnSize(aSize)) << "Failed to allocate a surface due to invalid size (DSS) " << aSize;
return nullptr;
--- a/gfx/2d/ScaledFontMac.h
+++ b/gfx/2d/ScaledFontMac.h
@@ -16,33 +16,16 @@
#include "2D.h"
#include "ScaledFontBase.h"
namespace mozilla {
namespace gfx {
-class GlyphRenderingOptionsCG : public GlyphRenderingOptions
-{
-public:
- MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GlyphRenderingOptionsCG, override)
-
- explicit GlyphRenderingOptionsCG(const Color &aFontSmoothingBackgroundColor)
- : mFontSmoothingBackgroundColor(aFontSmoothingBackgroundColor)
- {}
-
- const Color &FontSmoothingBackgroundColor() const { return mFontSmoothingBackgroundColor; }
-
- virtual FontType GetType() const override { return FontType::MAC; }
-
-private:
- Color mFontSmoothingBackgroundColor;
-};
-
class ScaledFontMac : public ScaledFontBase
{
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontMac, override)
ScaledFontMac(CGFontRef aFont, const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize,
const Color &aFontSmoothingBackgroundColor = Color(),
bool aUseFontSmoothing = true, bool aOwnsFont = false);
~ScaledFontMac();
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -1717,35 +1717,32 @@ private:
if (mat) {
saved = *mat;
*mat = (*mat) * (*mFontParams.passedInvMatrix);
}
}
mRunParams.dt->FillGlyphs(mFontParams.scaledFont, buf,
- *pat, mFontParams.drawOptions,
- mFontParams.renderingOptions);
+ *pat, mFontParams.drawOptions);
if (mat) {
*mat = saved;
}
}
} else if (state.sourceSurface) {
mRunParams.dt->FillGlyphs(mFontParams.scaledFont, buf,
SurfacePattern(state.sourceSurface,
ExtendMode::CLAMP,
state.surfTransform),
- mFontParams.drawOptions,
- mFontParams.renderingOptions);
+ mFontParams.drawOptions);
} else {
mRunParams.dt->FillGlyphs(mFontParams.scaledFont, buf,
ColorPattern(state.color),
- mFontParams.drawOptions,
- mFontParams.renderingOptions);
+ mFontParams.drawOptions);
}
}
if (GetStrokeMode(mRunParams.drawMode) == DrawMode::GLYPH_STROKE &&
mRunParams.strokeOpts) {
Pattern *pat;
if (mRunParams.textStrokePattern) {
pat = mRunParams.textStrokePattern->GetPattern(
mRunParams.dt, state.patternTransformChanged
@@ -1796,18 +1793,17 @@ private:
}
}
void FlushStroke(gfx::GlyphBuffer& aBuf, const Pattern& aPattern)
{
mRunParams.dt->StrokeGlyphs(mFontParams.scaledFont, aBuf,
aPattern,
*mRunParams.strokeOpts,
- mFontParams.drawOptions,
- mFontParams.renderingOptions);
+ mFontParams.drawOptions);
}
// We use an "inline" buffer automatically allocated (on the stack) as part
// of the GlyphBufferAzure object to hold the glyphs in most cases, falling
// back to a separately-allocated heap buffer if the count of buffered
// glyphs gets too big.
//
// This is basically a rudimentary AutoTArray; so why not use AutoTArray
@@ -1987,17 +1983,16 @@ gfxFont::DrawOneGlyph(uint32_t aGlyphID,
runParams.callbacks, *aEmittedGlyphs)) {
return;
}
}
if (fontParams.haveColorGlyphs &&
RenderColorGlyph(runParams.dt, runParams.context,
fontParams.scaledFont,
- fontParams.renderingOptions,
fontParams.drawOptions,
fontParams.matInv.TransformPoint(devPt),
aGlyphID)) {
return;
}
}
aBuffer.OutputGlyph(aGlyphID, devPt);
@@ -2229,17 +2224,16 @@ gfxFont::Draw(const gfxTextRun *aTextRun
Matrix mat;
Matrix oldMat = aRunParams.dt->GetTransform();
// This is nullptr when we have inverse-transformed glyphs and we need
// to transform the Brush inside flush.
fontParams.passedInvMatrix = nullptr;
- fontParams.renderingOptions = GetGlyphRenderingOptions(&aRunParams);
fontParams.drawOptions.mAntialiasMode = Get2DAAMode(mAntialiasOption);
// The cairo DrawTarget backend uses the cairo_scaled_font directly
// and so has the font skew matrix applied already.
if (mScaledFont &&
aRunParams.dt->GetBackendType() != BackendType::CAIRO) {
cairo_matrix_t matrix;
cairo_scaled_font_get_font_matrix(mScaledFont, &matrix);
@@ -2372,17 +2366,16 @@ gfxFont::RenderSVGGlyph(gfxContext *aCon
}
return RenderSVGGlyph(aContext, aPoint, aGlyphId, aContextPaint);
}
bool
gfxFont::RenderColorGlyph(DrawTarget* aDrawTarget,
gfxContext* aContext,
mozilla::gfx::ScaledFont* scaledFont,
- GlyphRenderingOptions* aRenderingOptions,
mozilla::gfx::DrawOptions aDrawOptions,
const mozilla::gfx::Point& aPoint,
uint32_t aGlyphId) const
{
AutoTArray<uint16_t, 8> layerGlyphs;
AutoTArray<mozilla::gfx::Color, 8> layerColors;
mozilla::gfx::Color defaultColor;
@@ -2401,17 +2394,17 @@ gfxFont::RenderColorGlyph(DrawTarget* aD
glyph.mPosition = aPoint;
mozilla::gfx::GlyphBuffer buffer;
buffer.mGlyphs = &glyph;
buffer.mNumGlyphs = 1;
aDrawTarget->FillGlyphs(scaledFont, buffer,
ColorPattern(layerColors[layerIndex]),
- aDrawOptions, aRenderingOptions);
+ aDrawOptions);
}
return true;
}
static void
UnionRange(gfxFloat aX, gfxFloat* aDestMin, gfxFloat* aDestMax)
{
*aDestMin = std::min(*aDestMin, aX);
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -67,19 +67,16 @@ class gfxMathTable;
#else
#define OBLIQUE_SKEW_FACTOR 0.25
#endif
struct gfxTextRunDrawCallbacks;
namespace mozilla {
class SVGContextPaint;
-namespace gfx {
-class GlyphRenderingOptions;
-} // namespace gfx
} // namespace mozilla
struct gfxFontStyle {
gfxFontStyle();
gfxFontStyle(uint8_t aStyle, uint16_t aWeight, int16_t aStretch,
gfxFloat aSize, nsAtom *aLanguage, bool aExplicitLanguage,
float aSizeAdjust, bool aSystemFont,
bool aPrinterFont,
@@ -1580,21 +1577,16 @@ public:
// Map unicode character to glyph ID.
// Only used if ProvidesGetGlyph() returns true.
virtual uint32_t GetGlyph(uint32_t unicode, uint32_t variation_selector) {
return 0;
}
// Return the horizontal advance of a glyph.
gfxFloat GetGlyphHAdvance(DrawTarget* aDrawTarget, uint16_t aGID);
- // Return Azure GlyphRenderingOptions for drawing this font.
- virtual already_AddRefed<mozilla::gfx::GlyphRenderingOptions>
- GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr)
- { return nullptr; }
-
gfxFloat SynthesizeSpaceWidth(uint32_t aCh);
// Work out whether cairo will snap inter-glyph spacing to pixels
// when rendering to the given drawTarget.
RoundingFlags GetRoundOffsetsToPixels(DrawTarget* aDrawTarget);
// Font metrics
struct Metrics {
@@ -2274,17 +2266,16 @@ protected:
bool RenderSVGGlyph(gfxContext *aContext, mozilla::gfx::Point aPoint,
uint32_t aGlyphId, SVGContextPaint* aContextPaint,
gfxTextRunDrawCallbacks *aCallbacks,
bool& aEmittedGlyphs) const;
bool RenderColorGlyph(DrawTarget* aDrawTarget,
gfxContext* aContext,
mozilla::gfx::ScaledFont* scaledFont,
- mozilla::gfx::GlyphRenderingOptions* renderingOptions,
mozilla::gfx::DrawOptions drawOptions,
const mozilla::gfx::Point& aPoint,
uint32_t aGlyphId) const;
// Bug 674909. When synthetic bolding text by drawing twice, need to
// render using a pixel offset in device pixels, otherwise text
// doesn't appear bolded, it appears as if a bad text shadow exists
// when a non-identity transform exists. Use an offset factor so that
@@ -2317,17 +2308,16 @@ struct MOZ_STACK_CLASS TextRunDrawParams
DrawMode drawMode;
bool isVerticalRun;
bool isRTL;
bool paintSVGGlyphs;
};
struct MOZ_STACK_CLASS FontDrawParams {
RefPtr<mozilla::gfx::ScaledFont> scaledFont;
- RefPtr<mozilla::gfx::GlyphRenderingOptions> renderingOptions;
mozilla::SVGContextPaint *contextPaint;
mozilla::gfx::Matrix *passedInvMatrix;
mozilla::gfx::Matrix matInv;
mozilla::gfx::Float synBoldOnePixelOffset;
int32_t extraStrikes;
mozilla::gfx::DrawOptions drawOptions;
bool isVerticalFont;
bool haveSVGGlyphs;
--- a/gfx/thebes/gfxMacFont.cpp
+++ b/gfx/thebes/gfxMacFont.cpp
@@ -533,25 +533,16 @@ gfxMacFont::GetScaledFont(DrawTarget *aT
mAzureScaledFont->SetCairoScaledFont(mScaledFont);
}
RefPtr<ScaledFont> scaledFont(mAzureScaledFont);
return scaledFont.forget();
}
-already_AddRefed<GlyphRenderingOptions>
-gfxMacFont::GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams)
-{
- if (aRunParams) {
- return Factory::CreateCGGlyphRenderingOptions(aRunParams->fontSmoothingBGColor);
- }
- return nullptr;
-}
-
void
gfxMacFont::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const
{
gfxFont::AddSizeOfExcludingThis(aMallocSizeOf, aSizes);
// mCGFont is shared with the font entry, so not counted here;
// and we don't have APIs to measure the cairo mFontFace object
}
--- a/gfx/thebes/gfxMacFont.h
+++ b/gfx/thebes/gfxMacFont.h
@@ -50,19 +50,16 @@ public:
}
int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
uint16_t aGID) override;
already_AddRefed<mozilla::gfx::ScaledFont>
GetScaledFont(mozilla::gfx::DrawTarget *aTarget) override;
- already_AddRefed<mozilla::gfx::GlyphRenderingOptions>
- GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) override;
-
void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const override;
void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const override;
FontType GetType() const override { return FONT_TYPE_MAC; }
// Helper to create a CTFont from a CGFont, with optional font descriptor
--- a/layout/generic/TextDrawTarget.h
+++ b/layout/generic/TextDrawTarget.h
@@ -94,21 +94,18 @@ public:
void FoundUnsupportedFeature() { mHasUnsupportedFeatures = true; }
bool HasUnsupportedFeatures() { return mHasUnsupportedFeatures; }
// This overload just stores the glyphs/font/color.
void
FillGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
- const DrawOptions& aOptions,
- const GlyphRenderingOptions* aRenderingOptions) override
+ const DrawOptions& aOptions) override
{
- // FIXME(?): Deal with GlyphRenderingOptions
-
// Make sure we're only given boring color patterns
MOZ_RELEASE_ASSERT(aOptions.mCompositionOp == CompositionOp::OP_OVER);
MOZ_RELEASE_ASSERT(aOptions.mAlpha == 1.0f);
MOZ_RELEASE_ASSERT(aPattern.GetType() == PatternType::COLOR);
auto* colorPat = static_cast<const ColorPattern*>(&aPattern);
auto color = wr::ToColorF(colorPat->mColor);
// Make sure the font exists, and can be serialized
@@ -390,18 +387,17 @@ public:
const DrawOptions &aOptions) override {
MOZ_CRASH("TextDrawTarget: Method shouldn't be called");
}
void StrokeGlyphs(ScaledFont* aFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
- const DrawOptions& aOptions,
- const GlyphRenderingOptions* aRenderingOptions) override {
+ const DrawOptions& aOptions) override {
MOZ_CRASH("TextDrawTarget: Method shouldn't be called");
}
void Mask(const Pattern &aSource,
const Pattern &aMask,
const DrawOptions &aOptions) override {
MOZ_CRASH("TextDrawTarget: Method shouldn't be called");
}