This helps out when clipping to rects with canvas2d. It reduces GPU
usage on the React-Stockcharts benchmark from ~70% down to ~45% on
a desktop gen9 Intel GPU.
It would be better to handle this in the D2D backend like we do in other
backends, but there's not an easy way to detect rectangle paths there.
This was the easiest place to slot it in and shouldn't have too high a
cost for the other places we use the recording backend.
Differential Revision: https://phabricator.services.mozilla.com/D164764
This implements a new DrawTarget API call, DrawShadow. This can be used to draw
the shadow of a given Path and Pattern. Unlike DrawSurfaceWithShadow, this only
draws the shadow to simplify the resulting implementation. DrawTarget provides
a default implementation that will draw a blurred shadow to a transient surface
before handing it off to DrawSurfaceWithShadow, allowing existing DrawTarget
implementations to function without having to implement the new API at all.
Within DrawTargetWebgl, DrawShadow allows direct caching of the shadow in the
existing PathCache mechanism, unlike DrawSurfaceWithShadow which would usually
be called with different transient surfaces every time, even if the input
patterns actually matched.
CanvasRenderingContext2D is modified to call DrawShadow when only a shadow
needs to be applied without any filter. AdjustedTarget is modified to wrap
the necessary DrawTarget draw calls so they can be dispatched appropriately.
Since a lot of redundant shadow parameters are shared between DrawShadow and
DrawSurfaceWithShadow, and since a lot of consumers of these functions need
to also pass around these parameters, this also bundles these into a new
ShadowOptions structure to make this easier.
Differential Revision: https://phabricator.services.mozilla.com/D142026
Because of the way the canvas 2D implementation juggles between path builders and paths, we have to keep track of current and first points in the path, in case a builder is created out of it.
Differential Revision: https://phabricator.services.mozilla.com/D33757
--HG--
extra : source : c79b3af2395894b449731fccdd9eb006b4d0189e
* Remove redundant virtual keywords
* Mark all destructors of inheriting classes as virtual for clarity
* Mark all classes without virtual destructor as final (exposed errors)
* Make destructor virtual where it needed to be (some were missing)
* Replace empty ({}) code declaration in header with = default
* Remove virtual unused methods
I probably missed some, it quickly became a rabbit hole.
Differential Revision: https://phabricator.services.mozilla.com/D26060
--HG--
extra : moz-landing-system : lando
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
The bulk of this commit was generated by running:
run-clang-tidy.py \
-checks='-*,llvm-namespace-comment' \
-header-filter=^/.../mozilla-central/.* \
-fix
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.