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

34 Коммитов

Автор SHA1 Сообщение Дата
Andrew Osmond 91b071ed14 Bug 1618345 - Enforce proper color management by splitting gfx::Color into sRGBColor and DeviceColor types. r=jrmuizel
gfx::Color is currently misused in many places. The DrawTargets expect
the color space to be in device space, e.g. what we are actually going
to draw using. Everything sitting above generally deals with sRGB, as
specified in CSS. Sometimes we missed the conversion from sRGB to device
space when issuing draw calls, and similarly sometimes we converted the
color to device space twice.

This patch splits the type in two. sRGBColor and DeviceColor now
represent sRGB and device color spaces respectively. DrawTarget only
accepts DeviceColor, and one can get a DeviceColor from an sRGBColor via
the ToDeviceColor helper API. The reftests now pass with color
management enabled for everything (e.g. CSS) instead of just tagged
raster images.

There will be a follow up patch to enable color management everywhere by
default on all supported platforms.

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

--HG--
extra : moz-landing-system : lando
2020-03-09 14:16:17 +00:00
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
Jean-Yves Avenard 11ac9e9cf8 Bug 1540581 - P6. Tidy some C++ declarations in gfx/. r=gerald,jrmuizel
* 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
2019-04-11 12:36:51 +00: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
Ryan Hunt 9c419c4c91 Bug 1478815 part 2 - Make DrawTargetDual aware of component alpha clearing. r=bas
This commit changes the behavior of DrawTargetDual::Clear to be aware that
it has on-white and on-black buffers, and perform clearing appropriately.

This is slightly against what the DrawTarget documentation says the method
should do, but it allows us to move another paint thread operation into
DrawTargetCapture and simplify our ContentClient implementations.

I haven't seen any obvious breakage with this, and reftests are green.

An alternative would be to add a separate Clear method with documented
difference here.

MozReview-Commit-ID: 65CzcxlRqv7

--HG--
extra : rebase_source : 299adbb02e79f66f7d6860c5fe86784bad8332f8
extra : source : 3dc47f17fa446bb7f2b5876753f8271a93c0e0c8
2018-08-01 12:45:35 -05:00
Brindusan Cristian 181d4f159b Backed out 10 changesets (bug 1478815) for reftest failures on /reftests/layers/forced-bg-color-outside-visible-region.html. CLOSED TREE
Backed out changeset 7ae4c893867a (bug 1478815)
Backed out changeset b865a866fe5a (bug 1478815)
Backed out changeset 405ad3518218 (bug 1478815)
Backed out changeset 64cb50b227e0 (bug 1478815)
Backed out changeset 392a724d5acd (bug 1478815)
Backed out changeset 01110727f2e9 (bug 1478815)
Backed out changeset 56d967e03ee2 (bug 1478815)
Backed out changeset 082638a5c643 (bug 1478815)
Backed out changeset 3dc47f17fa44 (bug 1478815)
Backed out changeset 699c954992f8 (bug 1478815)

--HG--
rename : gfx/2d/BufferEdgePad.cpp => gfx/layers/BufferEdgePad.cpp
rename : gfx/2d/BufferEdgePad.h => gfx/layers/BufferEdgePad.h
rename : gfx/2d/BufferUnrotate.cpp => gfx/layers/BufferUnrotate.cpp
rename : gfx/2d/BufferUnrotate.h => gfx/layers/BufferUnrotate.h
2018-08-07 20:57:27 +03:00
Ryan Hunt 74645824fc Bug 1478815 part 2 - Make DrawTargetDual aware of component alpha clearing. r=bas
This commit changes the behavior of DrawTargetDual::Clear to be aware that
it has on-white and on-black buffers, and perform clearing appropriately.

This is slightly against what the DrawTarget documentation says the method
should do, but it allows us to move another paint thread operation into
DrawTargetCapture and simplify our ContentClient implementations.

I haven't seen any obvious breakage with this, and reftests are green.

An alternative would be to add a separate Clear method with documented
difference here.

MozReview-Commit-ID: 65CzcxlRqv7

--HG--
extra : rebase_source : 47403847e56521be90190eb6b70ec333f6daf5c0
2018-08-01 12:45:35 -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
Daniel Holbert fc539779ba Bug 1412427 part 5: Deindent over-indented MPL boilerplate comments down to 1 space, for consistency & alignment. (whitespace-only) r=jrmuizel
This patch was automatically generated. I found the files to be fixed in this
patch with the following command:
grep -r "  \* This Source Code" gfx

...and then I modified each of these files with the following script
(where $1 is the filename to be modified):
###
line1=" \* This Source Code Form is subject to the terms of the Mozilla Public"
line2=" \* License, v\. 2\.0\. If a copy of the MPL was not distributed with this"
line3=" \* file, You can obtain one at http://mozilla\.org/MPL/2\.0/\. \*/"

# Strip off 1 space at beginning:
sed -i s%"^ $line1"%"$line1"% $1
sed -i s%"^ $line2"%"$line2"% $1
sed -i s%"^ $line3"%"$line3"% $1
###

MozReview-Commit-ID: EwCjyajgY4W

--HG--
extra : rebase_source : c61ca17ba556290d1f27af0a0c84e2ccc5371a36
2017-10-27 15:55:37 -07:00
Jeff Muizelaar e61bc0e9d7 Bug 1375179. Don't create a DrawTrargetDual from DrawTargetDual::CreateSimilarSurface() r=mstange
We mostly don't want a DrawTargetDual when calling CreateSimilarSurface
because we're going to doing something with that surface that doesn't
preserve the subpixel rendering.
2017-06-22 16:50:05 -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
Jonathan Watt 0b33916487 Bug 1277862, part 1 - Rename Moz2D's Filter to SamplingFilter in gfx/2d/. r=Bas 2016-05-25 17:01:18 +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
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
Birunthan Mohanathas a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07: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
Nathan Froyd c24f5f4e7c Bug 1116905 - part 3 - remove dependence on implicit conversion from T* to TemporaryRef<T>, gfx changes; r=jrmuizel 2015-04-30 15:20:30 -04:00
Nicolas Silva 645e9e7d94 Bug 1061712 - Fix missing include. r=me 2014-09-16 14:55:03 +02:00
Nicolas Silva 426b1eaffa Bug 1061712 - Don't crash in DrawTargetDual::CreateSimilar if allocation fails. r=Bas 2014-09-16 14:29:40 +02:00
Ehsan Akhgari 3cc9664125 Bug 1060802 - Fix some more bad implicit constructors in gfx; r=roc 2014-08-31 23:31:20 -04:00
Benoit Jacob f447d87c57 Bug 958375 - 8/9 - Make remaining Moz2D enums typed - r=Bas
Specifically:
  r=Bas for manual changes
  f=Bas for automatic changes
See attachments on the bug for the specific breakdown.
2014-01-10 14:06:17 -05:00
Benoit Jacob 80ebacd7e6 Bug 958375 - 1/9 - Make SurfaceType a typed enum - r=Bas
Specifically:
  r=Bas for manual changes
  f=Bas for automatic changes
See attachments on the bug for the specific breakdown.
2014-01-10 13:55:24 -05:00
Jeff Muizelaar 1be4a402cb Bug 880836. Fix a typo caught by joe.
--HG--
extra : rebase_source : deabe5a79c8ac27497cfbeb42d5f98b7b882a7a3
2013-06-18 20:31:17 -04:00
Jeff Muizelaar 44d26ad07a Bug 880836. Add MaskSurface() to Azure. r=bas
This gives a substantial performance improvement over the more general Mask():

Test (MaskSurface10x10):  1.93042ms +/- 0.305028
Test (MaskSurface100x100):  2.33435ms +/- 1.00807
Test (MaskSurface500x500):  28.0472ms +/- 0.820744
Test (MaskSurface1000x1000):  107.656ms +/- 6.44615
Test (Mask10x10):  13.5237ms +/- 0.0932034
Test (Mask100x100):  14.0742ms +/- 1.21005
Test (Mask500x500):  96.5596ms +/- 1.81415
Test (Mask1000x1000):  356.891ms +/- 9.30592

--HG--
extra : rebase_source : a3031305302fb4abe93aa480df35ed0936d68cd8
2013-06-12 23:57:51 -04:00
Gervase Markham 82ff7027aa Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Bas Schouten 858515dc1f Bug 740815 - Part 1: Add DrawTargetDual to Azure for Component Alpha drawing. r=jrmuizel 2012-04-03 22:25:52 +02:00