mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1408481 - pass AA via GlyphOptions to WR PushGlyphs. r=gankro
MozReview-Commit-ID: LVieyPaaouc
This commit is contained in:
parent
b4603106d0
commit
6235863fa6
@ -271,7 +271,8 @@ WriteFontFileData(const uint8_t* aData, uint32_t aLength, uint32_t aIndex,
|
||||
void
|
||||
WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArray<wr::GlyphInstance>& aGlyphs,
|
||||
gfx::ScaledFont* aFont, const wr::ColorF& aColor, const StackingContextHelper& aSc,
|
||||
const wr::LayerRect& aBounds, const wr::LayerRect& aClip, bool aBackfaceVisible)
|
||||
const wr::LayerRect& aBounds, const wr::LayerRect& aClip, bool aBackfaceVisible,
|
||||
const wr::GlyphOptions* aGlyphOptions)
|
||||
{
|
||||
MOZ_ASSERT(aFont);
|
||||
MOZ_ASSERT(!aGlyphs.IsEmpty());
|
||||
@ -284,7 +285,8 @@ WebRenderBridgeChild::PushGlyphs(wr::DisplayListBuilder& aBuilder, const nsTArra
|
||||
aBackfaceVisible,
|
||||
aColor,
|
||||
key,
|
||||
Range<const wr::GlyphInstance>(aGlyphs.Elements(), aGlyphs.Length()));
|
||||
Range<const wr::GlyphInstance>(aGlyphs.Elements(), aGlyphs.Length()),
|
||||
aGlyphOptions);
|
||||
}
|
||||
|
||||
wr::FontInstanceKey
|
||||
|
@ -132,7 +132,8 @@ public:
|
||||
gfx::ScaledFont* aFont, const wr::ColorF& aColor,
|
||||
const StackingContextHelper& aSc,
|
||||
const wr::LayerRect& aBounds, const wr::LayerRect& aClip,
|
||||
bool aBackfaceVisible);
|
||||
bool aBackfaceVisible,
|
||||
const wr::GlyphOptions* aGlyphOptions = nullptr);
|
||||
|
||||
wr::FontInstanceKey GetFontKeyForScaledFont(gfx::ScaledFont* aScaledFont);
|
||||
|
||||
|
@ -197,6 +197,19 @@ inline ImageRendering ToImageRendering(gfx::SamplingFilter aFilter)
|
||||
: ImageRendering::Auto;
|
||||
}
|
||||
|
||||
static inline FontRenderMode ToFontRenderMode(gfx::AntialiasMode aMode, bool aPermitSubpixelAA = true)
|
||||
{
|
||||
switch (aMode) {
|
||||
case gfx::AntialiasMode::NONE:
|
||||
return FontRenderMode::Mono;
|
||||
case gfx::AntialiasMode::GRAY:
|
||||
return FontRenderMode::Alpha;
|
||||
case gfx::AntialiasMode::SUBPIXEL:
|
||||
default:
|
||||
return aPermitSubpixelAA ? FontRenderMode::Subpixel : FontRenderMode::Alpha;
|
||||
}
|
||||
}
|
||||
|
||||
static inline MixBlendMode ToMixBlendMode(gfx::CompositionOp compositionOp)
|
||||
{
|
||||
switch (compositionOp)
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
nsRect& aBounds)
|
||||
: mBuilder(aBuilder), mSc(aSc), mManager(aManager)
|
||||
{
|
||||
SetPermitSubpixelAA(!aItem->IsSubpixelAADisabled());
|
||||
|
||||
// Compute clip/bounds
|
||||
auto appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
|
||||
@ -100,7 +101,7 @@ public:
|
||||
const DrawOptions& aOptions,
|
||||
const GlyphRenderingOptions* aRenderingOptions) override
|
||||
{
|
||||
// FIXME(?): Deal with AA on the DrawOptions, and the GlyphRenderingOptions
|
||||
// FIXME(?): Deal with GlyphRenderingOptions
|
||||
|
||||
// Make sure we're only given boring color patterns
|
||||
MOZ_RELEASE_ASSERT(aOptions.mCompositionOp == CompositionOp::OP_OVER);
|
||||
@ -128,9 +129,12 @@ public:
|
||||
LayoutDevicePoint::FromUnknownPoint(sourceGlyph.mPosition));
|
||||
}
|
||||
|
||||
wr::GlyphOptions glyphOptions;
|
||||
glyphOptions.render_mode = wr::ToFontRenderMode(aOptions.mAntialiasMode, GetPermitSubpixelAA());
|
||||
|
||||
mManager->WrBridge()->PushGlyphs(mBuilder, glyphs, aFont,
|
||||
color, mSc, mBoundsRect, mClipRect,
|
||||
mBackfaceVisible);
|
||||
mBackfaceVisible, &glyphOptions);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -5138,7 +5138,6 @@ nsDisplayText::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder
|
||||
RefPtr<TextDrawTarget> textDrawer = new TextDrawTarget(aBuilder, aSc, aManager, this, mBounds);
|
||||
RefPtr<gfxContext> captureCtx = gfxContext::CreateOrNull(textDrawer);
|
||||
|
||||
// TODO: Paint() checks mDisableSubpixelAA, we should too.
|
||||
RenderToContext(captureCtx, aDisplayListBuilder, true);
|
||||
|
||||
return !textDrawer->HasUnsupportedFeatures();
|
||||
|
@ -2281,6 +2281,8 @@ public:
|
||||
mDisableSubpixelAA = true;
|
||||
}
|
||||
|
||||
bool IsSubpixelAADisabled() const { return mDisableSubpixelAA; }
|
||||
|
||||
/**
|
||||
* Check if we can add async animations to the layer for this display item.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user