Граф коммитов

75 Коммитов

Автор SHA1 Сообщение Дата
Jeff Muizelaar 0b68652b49 Bug 1539702. Improve CreateClippedDrawTarget API r=jwatt,rhunt
This changes CreateClippedDrawTarget so that instead of taking
a max size and a transform it just takes a user space rect of
the desired bounds.

This change allows the caller to not worry about the computing
a max size based on the current clip. Instead this responsibility
is lowered into the specific backends.

The main motivation for this work is to allow blob recoordination
to create recordings that don't depend on the current clip.

Some additional benefits are that the API is easier to use and
as can be seen simplifies the SVG masking code because it doesn't
need to track surface offsets manually.

It's also an important step towards removing all the uses of
gfxContext::GetClipExtents which will let us get rid of the separate
clipping stack in gfxContext and help us move off of gfxContext
completely.

Most backend implementations of CreateClippedDrawTarget are relatively
simple. DrawTargetCapture is modified to track the current clip rect
so that it can create a new DrawTargetCapture of the appropriate size
without needing to worry about lazy resolution.

Differential Revision: https://phabricator.services.mozilla.com/D33363

--HG--
extra : moz-landing-system : lando
2019-06-21 09:51:00 +00:00
Narcis Beleuzu 767a7b2616 Backed out changeset 88e6c989e783 (bug 1539702) for multiple reftest failures. CLOSED TREE 2019-06-21 12:46:16 +03:00
Jeff Muizelaar afe9ee5a45 Bug 1539702. Improve CreateClippedDrawTarget API r=jwatt,rhunt
This changes CreateClippedDrawTarget so that instead of taking
a max size and a transform it just takes a user space rect of
the desired bounds.

This change allows the caller to not worry about the computing
a max size based on the current clip. Instead this responsibility
is lowered into the specific backends.

The main motivation for this work is to allow blob recoordination
to create recordings that don't depend on the current clip.

Some additional benefits are that the API is easier to use and
as can be seen simplifies the SVG masking code because it doesn't
need to track surface offsets manually.

It's also an important step towards removing all the uses of
gfxContext::GetClipExtents which will let us get rid of the separate
clipping stack in gfxContext and help us move off of gfxContext
completely.

Most backend implementations of CreateClippedDrawTarget are relatively
simple. DrawTargetCapture is modified to track the current clip rect
so that it can create a new DrawTargetCapture of the appropriate size
without needing to worry about lazy resolution.

Differential Revision: https://phabricator.services.mozilla.com/D33363

--HG--
extra : moz-landing-system : lando
2019-06-20 22:34:31 +00:00
Sylvestre Ledru e226046cb8 Bug 1547143 - Format the tree: Be prescriptive with the pointer style (left) r=Ehsan
# ignore-this-changeset

Depends on D28954

Differential Revision: https://phabricator.services.mozilla.com/D28956

--HG--
extra : moz-landing-system : lando
2019-05-01 08:47:10 +00:00
Sylvestre Ledru 14486004b6 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D18488

--HG--
extra : moz-landing-system : lando
2019-02-04 19:10:18 +00:00
Bas Schouten d8a0c14970 Bug 1522415: Properly track initialization state in case a device reset occurs during initialization. r=rhunt
This fixes a situation where a Device Reset occurs during initialization, after mDC has already been created but before mBitmap is created. In this case IsValid and EnsureInitialized would previously return 'true' in subsequent calls, since they were only checking for the DC.

This patch makes us properly store the full result of initialization for checking with IsValid and re-runs of EnsureInitialized.

Differential Revision: https://phabricator.services.mozilla.com/D17486

--HG--
extra : rebase_source : a20480486c094e14c3a2f67e5f39b1efbece5c69
2019-01-24 12:37:28 +01:00
Bas Schouten 587e039c49 Bug 1521368: Forego drawing if our drawtarget is invalid, this can happen on a devicereset. r=rhunt
Differential Revision: https://phabricator.services.mozilla.com/D17224

--HG--
extra : moz-landing-system : lando
2019-01-22 23:09:28 +00:00
Bas Schouten 940959abd0 Bug 1520877 - Part 2: Implement FillRoundedRect for D2D. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D16893

--HG--
extra : rebase_source : 47ea1c3907578f27743a0f3543553062b76953c8
2019-01-17 20:29:43 +01:00
Bas Schouten 7cbaee9bbb Bug 1519760: Attempt to initialize D2D off the main thread as much as possible. r=rhunt
Differential Revision: https://phabricator.services.mozilla.com/D16432

--HG--
extra : rebase_source : d42875e3e87c6fd756d5de192387a36a0ec2dafd
2019-01-13 23:14:33 +01:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Kartikaya Gupta 17eea57296 Bug 1466613 - Robustify DrawTargetRecording codepaths that create new drawtargets. r=mstange
Badly-behaved consumers of DrawTargetRecording can trigger recording of
draw calls that will fail to allocate required draw targets when the
recording is replayed. This patch tries to guard against this by
detecting these situations at record-time rather than crashing at
replay-time. When such a situation is detected, it will crash (for
content processes, to catch such scenarios) or gracefully fail (for
other processes).

Differential Revision: https://phabricator.services.mozilla.com/D11527

--HG--
extra : moz-landing-system : lando
2018-11-13 10:39:02 +00:00
Jamie Nicol 35e92591dd Bug 1474883 - Ensure D2D glyph cache is pruned after rendering 1000 transformed glyphs. r=bas
Rendering glyphs at many different rotations was causing the D2D glyph
cache to grow very large. Calling EndDraw/BeginDraw will prune the
cache, but is costly, so only do it for every 1000 glyphs.

MozReview-Commit-ID: HUFpxDvYAzQ

--HG--
extra : rebase_source : de283c5e687da07e5417e0d221d7f45b992080d5
2018-07-26 15:23:19 +01:00
Jamie Nicol 190d2c71c5 Bug 1429508 - Mark DrawTarget::GetSize as const. r=jrmuizel
MozReview-Commit-ID: BmhlrQjmIjW

--HG--
extra : rebase_source : 388e5a273140e7996f4943b6f28d23c3d44ccf18
2018-01-23 17:10:11 +00:00
Bas Schouten 7f06948838 Bug 1425257: Introduce a global lock to protect the dependency graph between DrawTargets. r=lsalzman
This patch takes the safest route for securing modifications to the dependency graph for D2D DrawTargets. It's possible a slightly optimal approach is possible, however lock contention should be rare and I believe this is the safest and most upliftable approach.

MozReview-Commit-ID: HGfSdEp2U5N
2018-02-06 03:08:04 +01:00
David Anderson 4d9d8d5d59 Bug 1416864 - Synchronize how snapshots detach in DrawTargetD2D1. r=bas 2017-11-21 10:52:38 -05:00
Markus Stange 78303f13ce Bug 1414154 - Remove GlyphRenderingOptions. r=lsalzman
MozReview-Commit-ID: JtwnTj1hhPV

--HG--
extra : rebase_source : 2a3e896eec8b6839097baf6e2cccc10eb162827b
2017-11-02 21:42:56 -04:00
Daniel Holbert 126bd9e1a4 Bug 1412427 part 8: (automated patch) Switch a bunch of C++ files in gfx to use our standard mode lines. r=jrmuizel
This patch was generated automatically by the "modeline.py" script, available
here: https://github.com/amccreight/moz-source-tools/blob/master/modeline.py

For every file that is modified in this patch, the changes are as follows:
 (1) The patch changes the file to use the exact C++ mode lines from the
     Mozilla coding style guide, available here:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Mode_Line

 (2) The patch deletes any blank lines between the mode line & the MPL
     boilerplate comment.

 (3) If the file previously had the mode lines and MPL boilerplate in a
     single contiguous C++ comment, then the patch splits them into
     separate C++ comments, to match the boilerplate in the coding style.

MozReview-Commit-ID: 77D61xpSmIl

--HG--
extra : rebase_source : c6162fa3cf539a07177a19838324bf368faa162b
2017-10-27 16:10:06 -07:00
Bas Schouten 576b1d0c7d Bug 1392453: Allow a small amount of list-in-list drawing commands. r=mchang
MozReview-Commit-ID: H4w5gPVOhwg
2017-09-22 19:37:02 +02:00
Bas Schouten 973de6713e Bug 1400573: Back out initial fix for bug 1392453. r=mchang
MozReview-Commit-ID: 3c3vJbL4kXS
2017-09-20 14:57:25 +02:00
Bas Schouten 2d48dc6667 Bug 1392453: Allow limiting the blend surface area and the portion of the layer being resolved. r=mchang
This introduces the infrastructure to specify the bounds of drawing commands being executed. These bounds can then be used to limit operations done for blending in order to reduce required fillrate. Currently we only specify the bounds for DrawSurface but it would be easy to extend this for other drawing commands if so desired.

MozReview-Commit-ID: BUFJzphfdKc

--HG--
extra : rebase_source : cbd17803d8aeb1a74b6c7c98fd5c00e06870805b
2017-09-12 19:10:55 +00:00
David Anderson e53986168f Store and return D2D singletons in RefPtrs. (bug 1380922 part 1, r=mchang)
--HG--
extra : rebase_source : baf7cce201a38897f1f9dcbd7c36855ff070217b
2017-07-18 12:15:39 -07:00
Lee Salzman 2d696d5c34 Bug 1376026 - fix plumbing of DWrite parameters for Skia fonts to not depend on gfxPlatform. r=jrmuizel
MozReview-Commit-ID: 5K9201eCSv
2017-06-30 14:09:05 -04:00
Sebastian Hengst 522fc18c93 Backed out changeset 24421d72ba08 (bug 1376026) 2017-07-07 21:42:09 +02:00
Lee Salzman ab6885d706 Bug 1376026 - fix plumbing of DWrite parameters for Skia fonts to not depend on gfxPlatform. r=jrmuizel
MozReview-Commit-ID: 5K9201eCSv
2017-06-30 14:09:05 -04:00
Carsten "Tomcat" Book fbc9f302f1 Backed out changeset d09fb3a5cedf (bug 1376026) 2017-07-06 08:11:48 +02:00
Lee Salzman edc6db4195 Bug 1376026 - fix plumbing of DWrite parameters for Skia fonts to not depend on gfxPlatform. r=jrmuizel 2017-06-30 14:09:05 -04:00
Mason Chang d69917e056 Bug 1375452 Fallback to DrawTarget::IntoLuminance if we can't create the effect. r=jrmuizel 2017-06-22 10:15:37 -07:00
Mason Chang 1520cb158b Bug 1359527. Part 1 - Add DrawTarget::IntoLuminance r=jrmuizel 2017-06-02 11:13:36 -07:00
Kevin Chen d6f7dc2900 Bug 1363677 - Skip Flush() and EndDraw() if the ID2D1DeviceContext is stale; r=dvander
MozReview-Commit-ID: 6KnryMZE8Qj

--HG--
extra : rebase_source : 7e8794825934b82c887159b04128cf830f77d897
2017-05-10 16:22:08 +08:00
Lee Salzman f942812710 Bug 1347147 - fix DrawTargetD2D1::GetImageForSurface to support uploads in device-space. r=mchang
MozReview-Commit-ID: 2galhKidxca
2017-03-14 22:17:47 -04:00
Bas Schouten 0da057c54f Bug 1300338: Do not attempt to preserve layer content when we're going to override it in a blend operation anyway. r=jrmuizel
MozReview-Commit-ID: DIEyrK89jtd
2016-09-12 18:41:10 +02:00
Lee Salzman 8869fd86cf Bug 1029705 - allow clipping to a list of device-space rectangles (a region) in DrawTarget via PushDeviceSpaceClipRects. r=bas
MozReview-Commit-ID: 8zM116zB0NB
2016-09-21 17:03:20 -04:00
Bas Schouten 37341a7ea4 Bug 1293586: Don't use command lists for an effect when that command list already has an effect with a command list used inside of it. r=mstange
MozReview-Commit-ID: 2T2wdUaWgMC

--HG--
extra : rebase_source : f569e9b5613bf8cf419792251335e07a7f743607
2016-08-22 13:22:01 +02:00
Bas Schouten e0031c0160 Bug 943626 - Part 2: Implement GetGlyphMetrics API for DirectWrite r=jrmuizel 2016-08-11 15:47:32 -04:00
Nicolas Silva 10809f5f78 Bug 1167235 - Part 2 - Detach DrawTarget snapshots before unlocking TextureClient. r=Bas 2016-07-01 10:58:13 +02:00
Sebastian Hengst 1e83040b43 Backed out changeset b67548cc946e (bug 1167235) 2016-06-28 20:28:23 +02:00
Nicolas Silva 24410dac99 Bug 1167235 - Part 2 - Detach DrawTarget snapshots before unlocking TextureClient. r=Bas 2016-06-28 14:06:55 +02:00
Bas Schouten 8287b9b368 Bug 1266430: Support offsets in DrawTargetD2D1::CopySurface when using PartialUploading. r=jrmuizel
MozReview-Commit-ID: LilGG2ySPw7
2016-04-28 13:22:31 +00:00
Bas Schouten 9c327300bf Bug 1258168: Push ClearType compatible clipping layers when the last pushed layer was marked as opaque. r=jrmuizel
MozReview-Commit-ID: IM1srXx7CfB
2016-03-20 19:51:46 +01:00
Bas Schouten 66c618a6ee Bug 1246641: Also execute an occasional EndDraw for CommandLists used by non-operator OVER drawing. r=jrmuizel
MozReview-Commit-ID: H3V3z8ZIiIK
2016-02-11 21:35:07 +01:00
Bas Schouten b3027878ab Bug 1238328: Purge stored command lists by calling EndDraw/BeginDraw on a regular basis when they're used. r=jrmuizel
--HG--
extra : rebase_source : 5041fa82907837c50e657c87afeda85be40b25d7
2016-01-11 16:38:10 +01:00
Bas Schouten 12b9a82473 Bug 1220629 - Part 6: Implement PushLayer/PopLayer API in several wrapper DT types. r=jrmuizel
--HG--
extra : rebase_source : 5a421568fa20b23d7ceef71eb58014e29dbc1c76
2016-01-06 00:23:33 +01:00
Bas Schouten b5ed4b63ba Bug 1220629 - Part 5: Implement PushLayer/PopLayer API for Direct2D 1.1. r=jrmuizel
--HG--
extra : rebase_source : ec545e1bde6741e9bc461b1a6ab966e7b6c9236a
2016-01-06 00:23:29 +01:00
Bas Schouten fd6c57413d Bug 1220629 - Part 2: Prepare DrawTargetD2D1 for the possibilities of layers existing inside it. r=jrmuizel
--HG--
extra : rebase_source : 97685e7ee1e9249dd465bfcee40bd7401f2a6e4e
2016-01-05 09:03:08 +01:00
Nathan Froyd 4094e18ff5 Bug 1233069 - add override declarations to Windows graphics headers; r=Bas
This change silences a number of -Winconsistent-missing-override
warnings on clang-cl.
2015-12-16 10:41:21 -05:00
Bas Schouten 7f79cf9b7a Bug 1221616: Use ID2D1CommandList instead of a bitmap for temporary D2D drawing. r=jrmuizel 2015-11-12 17:00:52 +01:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Nathan Froyd 583afa0965 Bug 1207245 - part 3 - switch all uses of mozilla::RefPtr<T> to nsRefPtr<T>; r=ehsan
This commit was generated using the following script, executed at the
top level of a typical source code checkout.

 # Don't modify select files in mfbt/ because it's not worth trying to
 # tease out the dependencies currently.
 #
 # Don't modify anything in media/gmp-clearkey/0.1/ because those files
 # use their own RefPtr, defined in their own RefCounted.h.
find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    grep -v 'mfbt/RefPtr.h' | \
    grep -v 'mfbt/nsRefPtr.h' | \
    grep -v 'mfbt/RefCounted.h' | \
    grep -v 'media/gmp-clearkey/0.1/' | \
    xargs perl -p -i -e '
 s/mozilla::RefPtr/nsRefPtr/g; # handle declarations in headers
 s/\bRefPtr</nsRefPtr</g; # handle local variables in functions
 s#mozilla/RefPtr.h#mozilla/nsRefPtr.h#; # handle #includes
 s#mfbt/RefPtr.h#mfbt/nsRefPtr.h#;       # handle strange #includes
'

 # |using mozilla::RefPtr;| is OK; |using nsRefPtr;| is invalid syntax.
find . -name '*.cpp' -o -name '*.mm' | xargs sed -i -e '/using nsRefPtr/d'

 # RefPtr.h used |byRef| for dealing with COM-style outparams.
 # nsRefPtr.h uses |getter_AddRefs|.
 # Fixup that mismatch.
find . -name '*.cpp' -o -name '*.h'| \
    xargs perl -p -i -e 's/byRef/getter_AddRefs/g'
2015-10-18 00:40:10 -04:00
Nathan Froyd 974d8120f2 Bug 1161627 - part 2 - machine-convert TemporaryRef<T> to already_AddRefed<T>; r=ehsan
This conversion was done with the script:

  find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl' | \
    egrep -v 'cairo-win32-refptr.h|RefPtr.h|TestRefPtr.cpp' | \
    xargs sed -i -e 's/mozilla::TemporaryRef</already_AddRefed</g' \
                 -e 's/TemporaryRef</already_AddRefed</g'

Manual fixups were performed in the following instances:

- We handled mfbt/RefPtr.h manually so as to not convert TemporaryRef itself
  into already_AddRefed.

- The following files had explicit Move() calls added to make up for the lack
  of a copy constructor on already_AddRefed:

  dom/base/ImageEncoder.cpp
  dom/media/MediaTaskQueue.{h,cpp}
  dom/media/webaudio/PannerNode.cpp

- A redundant overload for MediaTaskQueue::Dispatch was deleted.

- A few manual fixups were required in mfbt/tests/TestRefPtr.cpp.

- Comments, using declarations, and forward declarations relating to
  TemporaryRef in dom/canvas/ and gfx/layers/ were changed to refer to
  already_AddRefed.
2015-06-17 10:00:52 -04:00
Bas Schouten ea9a0a76af Bug 1153609: Push layers for cleartype when trying to draw cleartype glyphs to a transparent layer. r=jrmuizel
This patch lets us repush all layers with their backgrounds copied when drawing subpixel AA'ed text to a transparent surface. This can be wasteful since the last layer that was pushed could already have had its pixels where the glyphs will be drawn made opaque, however we have no way of knowing this so we have to always repush the layers.
2015-05-29 14:49:19 +02:00