mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 19:07:31 +09:00
Issue #2364 - use DrawTarget::DrawSurfaceWithShadow to render box shadows on platforms that accelerate it.
This commit is contained in:
parent
8d30faf95f
commit
4beb3b947c
13 changed files with 228 additions and 150 deletions
|
|
@ -56,6 +56,9 @@ public:
|
|||
|
||||
/**
|
||||
* Constructs a box blur and initializes the temporary surface.
|
||||
*
|
||||
* @param aDestinationCtx The destination to blur to.
|
||||
*
|
||||
* @param aRect The coordinates of the surface to create in device units.
|
||||
*
|
||||
* @param aBlurRadius The blur radius in pixels. This is the radius of
|
||||
|
|
@ -73,21 +76,27 @@ public:
|
|||
* for speed reasons. It is safe to pass nullptr here.
|
||||
*/
|
||||
already_AddRefed<gfxContext>
|
||||
Init(const gfxRect& aRect,
|
||||
Init(gfxContext* aDestinationCtx,
|
||||
const gfxRect& aRect,
|
||||
const mozilla::gfx::IntSize& aSpreadRadius,
|
||||
const mozilla::gfx::IntSize& aBlurRadius,
|
||||
const gfxRect* aDirtyRect,
|
||||
const gfxRect* aSkipRect);
|
||||
|
||||
already_AddRefed<DrawTarget>
|
||||
InitDrawTarget(const mozilla::gfx::Rect& aRect,
|
||||
InitDrawTarget(const mozilla::gfx::DrawTarget* aReferenceDT,
|
||||
const mozilla::gfx::Rect& aRect,
|
||||
const mozilla::gfx::IntSize& aSpreadRadius,
|
||||
const mozilla::gfx::IntSize& aBlurRadius,
|
||||
const mozilla::gfx::Rect* aDirtyRect = nullptr,
|
||||
const mozilla::gfx::Rect* aSkipRect = nullptr);
|
||||
|
||||
/**
|
||||
* Performs the blur and optionally colors the result if aShadowColor is not null.
|
||||
*/
|
||||
already_AddRefed<mozilla::gfx::SourceSurface>
|
||||
DoBlur(DrawTarget* aDT, mozilla::gfx::IntPoint* aTopLeft);
|
||||
DoBlur(const mozilla::gfx::Color* aShadowColor = nullptr,
|
||||
mozilla::gfx::IntPoint* aOutTopLeft = nullptr);
|
||||
|
||||
/**
|
||||
* Does the actual blurring/spreading and mask applying. Users of this
|
||||
|
|
@ -170,6 +179,12 @@ protected:
|
|||
DrawTarget* aDestDrawTarget,
|
||||
bool aMirrorCorners);
|
||||
|
||||
|
||||
/**
|
||||
* The DrawTarget of the temporary alpha surface.
|
||||
*/
|
||||
RefPtr<DrawTarget> mDrawTarget;
|
||||
|
||||
/**
|
||||
* The temporary alpha surface.
|
||||
*/
|
||||
|
|
@ -179,6 +194,11 @@ protected:
|
|||
* The object that actually does the blurring for us.
|
||||
*/
|
||||
mozilla::gfx::AlphaBoxBlur mBlur;
|
||||
|
||||
/**
|
||||
* Indicates using DrawTarget-accelerated blurs.
|
||||
*/
|
||||
bool mAccelerated;
|
||||
};
|
||||
|
||||
#endif /* GFX_BLUR_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue