Closed Bug 883004 Opened 6 years ago Closed 6 years ago

Add Direct2D 1.1 backend for Moz2D

Categories

(Core :: Graphics, defect)

x86_64
Windows 8
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: bas.schouten, Assigned: bas.schouten)

References

Details

Attachments

(3 files, 1 obsolete file)

We should add a backend for Direct2D 1.1 to Moz2D, this should allow for a much cleaner code when using the new functionality for Effects and custom Effects.

I've included a patch that should be close to the first iteration patch I want to land (missing support for subpixel AA on transparent surfaces, some interop  so some general reviewing of the overall structure and design can start already.
Attachment #762462 - Flags: feedback?(jmuizelaar)
Just for the record, the relevant parts of the included diff are the portions that modify Moz2D files (particularly DrawTargetD2D1.* and SourceSurfaceD2D1.*), the modifications to the player can be ignored, I'll clean the patch up soon.
Comment on attachment 762462 [details] [diff] [review]
WIP patch, fairly close to completion

Review of attachment 762462 [details] [diff] [review]:
-----------------------------------------------------------------

I didn't review this thoroughly but have no objections to this.

::: DrawTargetD2D1.cpp
@@ +57,5 @@
> +DrawTargetD2D1::DrawSurface(SourceSurface *aSurface,
> +                            const Rect &aDest,
> +                            const Rect &aSource,
> +                            const DrawSurfaceOptions &aSurfOptions,
> +                            const DrawOptions &aOptions)

It would be good to have a comment about the performance difference of using this vs. the classic DrawSurface approach.
Attachment #762462 - Flags: review+
This patch adds the Radial Gradient Effect which is what we need in order to draw Canvas compliant radial gradients using all D2D 1.1 mechanics.
Attachment #764642 - Flags: review?(jmuizelaar)
Comment on attachment 764642 [details] [diff] [review]
Part 1: Add radial gradient effect code

Review of attachment 764642 [details] [diff] [review]:
-----------------------------------------------------------------

This effect stuff is pretty wild.
Attachment #764642 - Flags: review?(jmuizelaar) → review+
Comment on attachment 764642 [details] [diff] [review]
Part 1: Add radial gradient effect code

>+  // A more extensive derrivation can be found in the pixman radial gradient
>+  // code.

s/derrivation/derivation/
https://hg.mozilla.org/mozilla-central/rev/53b1c9358b18
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Just got the following error trying to build with MSVC 10, Windows SDK 7.0A, Platform SDK 5, DX SDK June 2010. The latter has no d2d1_1.h, neither does m-c. So?

e:\mozilla-src\comm-central\mozilla\gfx\2d\RadialGradientEffectD2D1.h(9) : fatal error C1083: Cannot open include file: 'd2d1_1.h': No such file or directory
(In reply to Jens Hatlak (:InvisibleSmiley) from comment #7)
> Just got the following error trying to build with MSVC 10, Windows SDK 7.0A,
> Platform SDK 5, DX SDK June 2010. The latter has no d2d1_1.h, neither does
> m-c. So?
> 
> e:\mozilla-src\comm-central\mozilla\gfx\2d\RadialGradientEffectD2D1.h(9) :
> fatal error C1083: Cannot open include file: 'd2d1_1.h': No such file or
> directory

Same here!
Depends on: 885855
A little bit of the build magic in Makefile.in is still broken. I'm trying to figure this out.
Attachment #762462 - Attachment is obsolete: true
Attachment #762462 - Flags: feedback?(jmuizelaar)
Attachment #766217 - Flags: review?(jmuizelaar)
Attachment #766217 - Flags: review?(jmuizelaar) → review+
Comment on attachment 776859 [details] [diff] [review]
Part 2: Move Direct2D 1.1 detection to configure.in

Review of attachment 776859 [details] [diff] [review]:
-----------------------------------------------------------------

::: configure.in
@@ +8139,5 @@
>  dnl Graphics checks.
>  dnl ========================================================
>  
> +if test "${OS_TARGET}" = "WINNT"; then
> +  if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06030000)"; then

r=me with the version fixed, as mentioned on irc.
Attachment #776859 - Flags: review?(mh+mozilla) → review+
I landed a trivial fix for GCC bustage:

/home/jacek/mozilla/mozilla-central/gfx/2d/DrawTargetD2D1.cpp:172:78: error: no matching function for call to ‘mozilla::gfx::DrawTargetD2D1::GetImageForSurface(mozilla::gfx::SourceSurface*&, mozilla::gfx::Matrix, mozilla::gfx::ExtendMode)’
   RefPtr<ID2D1Image> image = GetImageForSurface(aMask, Matrix(), EXTEND_CLAMP);
                                                                              ^
/home/jacek/mozilla/mozilla-central/gfx/2d/DrawTargetD2D1.cpp:172:78: note: candidate is:
In file included from /home/jacek/mozilla/mozilla-central/gfx/2d/DrawTargetD2D1.cpp:6:0:
/home/jacek/mozilla/mozilla-central/gfx/2d/DrawTargetD2D1.h:163:28: note: mozilla::TemporaryRef<ID2D1Image> mozilla::gfx::DrawTargetD2D1::GetImageForSurface(mozilla::gfx::SourceSurface*, mozilla::gfx::Matrix&, mozilla::gfx::ExtendMode)
   TemporaryRef<ID2D1Image> GetImageForSurface(SourceSurface *aSurface, Matrix &aSourceTransform,
                            ^
/home/jacek/mozilla/mozilla-central/gfx/2d/DrawTargetD2D1.h:163:28: note:   no known conversion for argument 2 from ‘mozilla::gfx::Matrix’ to ‘mozilla::gfx::Matrix&’


https://hg.mozilla.org/integration/mozilla-inbound/rev/9c18b3b78bc7
Depends on: 1091903
You need to log in before you can comment on or make changes to this bug.