Commit Graph

2051 Commits

Author SHA1 Message Date
Timothy Nikkel
b0c0939414 Bug 1241728. Add crashtest. 2016-01-27 16:19:34 -06:00
Timothy Nikkel
a537ac9678 Bug 1241728. Limit the size of images that we will downscale from to 1048576 pixels. r=edwin
This avoids spending too much cpu/memory downscaling absolutely huge images.
2016-01-27 16:19:33 -06:00
Daniel Holbert
11c746cfa3 Bug 1242778: Add MOZ_COUNT_CTOR & MOZ_COUNT_DTOR calls to track leaks of imagelib's FrameAnimator class. r=tn
Also add crashtest with a corrupt animated PNG image that causes a leak to be reported (thanks to these MOZ_COUNT calls). This leak is fixed by the patch on separate bug 1237709.
2016-01-26 11:08:26 -08:00
Jeff Muizelaar
52c914f25f Bug 1237709: During RasterImage error-handling cleanup, set UniquePtr mAnim to null instead of using reset(), to avoid leaking. r=dholbert 2016-01-26 11:08:19 -08:00
David Rajchenbach-Teller
8dc9509180 Bug 1224374 - Profiler labels for the top 26-100 chrome hangs;r=BenWa 2016-01-15 11:38:03 +01:00
Edwin Flores
b821aae08f Bug 1207958 - Fix heuristic for choosing which ICO sub-image to render - r=tn 2016-01-20 11:00:12 +00:00
Sebastian Hengst
e687c33b0f Backed out 2 changesets (bug 1224374) for Windows bustage. r=bustage on a CLOSED TREE
Backed out changeset 5f458e6e4997 (bug 1224374)
Backed out changeset 0dc02cb0b604 (bug 1224374)
2016-01-19 21:30:41 +01:00
David Rajchenbach-Teller
ad8745d7f6 Bug 1224374 - Profiler labels for the top 26-100 chrome hangs;r=BenWa 2016-01-15 11:38:03 +01:00
Nicholas Nethercote
23d93a8ac7 Bug 1238551 (part 2) - Add a test. r=tn. 2016-01-17 21:13:32 -08:00
Nicholas Nethercote
750b2fc655 Bug 1238551 (part 1) - Reject BITMAPV3INFOHEADER BMP images. r=tn.
This is an obscure BMP variant that's not worth supporting.
2016-01-17 21:12:17 -08:00
Jan de Mooij
615910393e Bug 1237201 part 3 - Handle Vector OOM in StreamingLexer. r=njn 2016-01-14 15:19:21 +01:00
Timothy Nikkel
a5be3141f1 Bug 1224200. Allow downscaler to get (and ignore) new input lines after it has finished producing all output lines. r=milan 2016-01-13 17:16:32 -06:00
Nicholas Nethercote
01e7ff94f4 Bug 1237171 - Improve a case where ICO and BMP files disagree on an image size. r=tn. 2016-01-07 16:18:22 -08:00
Steve Singer
e7ddc9751d Bug 1235859 - Add FrameSize to non-skia downscaler. r=edwin 2015-12-30 14:46:54 -05:00
Edwin Flores
65b329c2f5 Bug 1235605 - Use CheckedInt in Deinterlacer and make its buffer allocation fallible. r=tn 2015-12-30 17:03:24 -05:00
Edwin Flores
fe6a36addb Bug 1229825 - Make GIF deinterlacer respect the frame rect bounds. r=tn 2015-12-29 18:19:27 -05:00
Morris Tseng
b985b4445c Bug 1215438 - Part 4: Rename CairoImage to SourceSurfaceImage. r=roc 2015-12-18 14:52:16 +08:00
Christoph Kerschbaumer
e0194da0a5 Bug 1229889 - Convert JS callsites to use asyncOpen2 within image/ (r=sicking) 2015-12-06 20:57:08 -08:00
Wes Kocher
748bfe6315 Backed out 4 changesets (bug 1230221, bug 1230220, bug 1229890) for m-e10s(2) permafails in test_window_open_close.html CLOSED TREE
Backed out changeset a1cd28ddbfa2 (bug 1230221)
Backed out changeset 7e89f5020ac7 (bug 1230220)
Backed out changeset 91f6e72fa9f4 (bug 1229890)
Backed out changeset 7e717a810420 (bug 1229890)
2015-12-04 15:58:40 -08:00
Christoph Kerschbaumer
85e1304cb5 Bug 1229890 - Convert JS callsites to use asyncOpen2 within image/ (r=sicking) 2015-12-04 09:39:05 -08:00
Christoph Kerschbaumer
ed48ca2d92 Bug 1225641 - Change default security flags within NetUtil.newChannel (r=sicking) 2015-11-17 17:35:30 -08:00
Edwin Flores
1600cc22c5 Bug 1223465 - Clamp GIF frame rects to their screen rects - r=seth 2015-11-25 13:50:13 +00:00
Edwin Flores
5249bcdc20 Bug 1224100 - Initialize row buffer to 0 in Downscaler - r=seth 2015-11-24 15:05:01 +00:00
Nicholas Nethercote
385f8fa699 Bug 1220021 (part 2) - Add four reftests. r=seth. 2015-11-23 18:20:21 -08:00
Nicholas Nethercote
39597fd6c7 Bug 1220021 (part 1) - Don't treat 0RGB ICO files as transparent. r=seth.
This approach is much the same as the one we had before bug 1062066 caused the
regression.
2015-11-23 15:32:39 -08:00
Nicholas Nethercote
399ecd0ab5 Bug 1223319 (part 1) - Remove unused function nsICODecoder::CalcAlphaRowSize(). r=seth. 2015-11-16 17:54:11 -08:00
Glenn Randers-Pehrson
c434c3bf01 Bug 75077 - Interpolate interlaced PNG images instead of libpng blocky display. r=seth 2015-11-14 11:33:00 +01:00
Mason Chang
78ebc29d9b Bug 1221840. Support repeating images in 1 axis. r=seth 2015-11-23 08:17:35 -08:00
sajitk
444d20588b Bug 1219474 - Replace PRLogModuleInfo w/ LazyLogModule in the 'image/' directory. r=seth 2015-11-16 18:21:00 +01:00
David Anderson
f64d767dfe Decouple CairoImage from ImageContainer. (bug 1222910, r=roc) 2015-11-17 00:09:00 -08:00
Nicholas Nethercote
28bfe1d2d9 Bug 1210291 - Streamline StreamingLexer's handling of terminal states. r=seth.
This patch introduces TerminalState and changes LexerTransition::mNextState to
be a Variant<State, TerminalState>. This means that SUCCESS and FAILURE no
longer need to be part of State.

Some things to note:

- This simplifies the handling of Lex()'s return value, which is nice.

- The patch splits Terminate() into TerminateSuccess() and TerminateFailure().

- |const State& aNextState| wouldn't work for the first arg to
  LexerTransition's ctor due to errors in Variant construction that I didn't
  understand. I had to change it to |State aNextState|.
2015-10-28 01:30:20 -07:00
Nicholas Nethercote
abd6a66edd Bug 1217465 - Fill in missing pixels caused by truncated BMP files. r=seth.
This fixes failures for
image/test/reftest/bmp/bmpsuite/b/{badrle.bmp,shortfile.bmp} with the Skia
back-end.
2015-11-15 20:31:07 -08:00
Phil Ringnalda
61e0022d38 Bug 1182951 - skip test_bug399925.html on b2g debug for constant timeouts 2015-11-14 18:28:40 -08:00
Nathan Froyd
70563b2178 Bug 1217571 - fix the imagelib cache to work in e10s; r=seth
nsICachingChannel isn't available in the child process; we have to use
nsICacheInfoChannel instead.
2015-11-12 15:09:52 -05:00
Nicholas Nethercote
4ce3d974a8 Bug 1223690 - Remove implicit Rect conversions. r=jrmuizel.
gfxRect can be implicitly constructed from IntRect, which hides a number of
implicit conversion points, makes Moz2Dification harder, and has some
surprising effects.

This patch removes the implicit constructor and replaces it with an explicit
conversion function:

  gfxRect ThebesRect(const IntRect&)

This is the obvious outcome of removing the constructor.

But there is also a second, less obvious outcome: currently we do a number of
IntRect-to-Rect conversions using ToRect(), which (surprisingly) works because
it turns into an implicit IntRect-to-gfxRect conversion (via the implicit
constructor) combined with an explicit gfxRect-to-Rect conversion (via
ToRect()). I.e. we do two conversions, going from a Moz2D type to a Thebes
type and back to a Moz2D type!

So this patch also changes these conversion. It moves this existing function:

  Rect ToRect(const IntRect&)

from gfx2DGlue.h -- where it doesn't really belong because it doesn't involve
any Thebes types -- to gfx/2d/Rect.h, templatifying and renaming it as
IntRectToRect() in the process.

The rest of the patch deals with fall-out from these changes. The call sites
change as follows:

- IntRect-to-gfxRect conversions:
  - old: implicit
  - new: ThebesRect()

- IntRect-to-Rect conversions:
  - old: ToRect()
  - new: IntRectToRect()
2015-11-11 14:23:14 -08:00
Sotaro Ikeda
e9fb4b338e Bug 1186796 - Replace nsBaseHashtable::EnumerateRead() calls in image/ with iterators r=njn 2015-11-10 23:07:09 -08:00
Sotaro Ikeda
716ba038a6 Bug 1187149 - Replace nsBaseHashtable::Enumerate() calls in image/ with iterators r=njn 2015-11-10 21:30:02 -08:00
Nathan Froyd
2258a5261d Bug 1216611 - add mozilla::MakeUniqueFallible and convert uses throughout the tree; r=Waldo 2015-11-05 16:24:24 -05:00
Ryan VanderMeulen
4fc00d639a Bug 1123195 - Re-enable 694165-1.xhtml on OSX. 2015-11-01 12:58:53 -05:00
Ryan VanderMeulen
a46beb2ec9 No bug - Various crashtest manifest cleanups. 2015-10-31 19:35:27 -04:00
Timothy Nikkel
da523f7bb7 Bug 1219501. Limit total number of image decoding threads to 32 regardless of number asked for. r=seth 2015-11-01 11:45:40 -06:00
Timothy Nikkel
fc7808deb0 Bug 1219501. In imagelib, initialize the number of cores to at least 1 in case of error. r=seth
PR_GetNumberOfProcessors returns -1 in case of error, which is MAXUINT32 when turned into an unsigned int like sNumCores.
2015-11-01 11:45:40 -06:00
Nathan Froyd
00fdbd8336 Bug 1219405 - use LazyLogModule for PNG decoder logging; r=seth
This change eliminates some TSan warnings and also eliminates some
boilerplate.
2015-10-28 16:08:06 -04:00
Ehsan Akhgari
f18e8fa26b Bug 1202085 - Part 6: Clear the entries in the image cache belonging to a controlled document when it gets destroyed; r=seth 2015-10-30 16:03:13 -04:00
Ehsan Akhgari
35f1afe8c9 Bug 1202085 - Part 4: Add an ID for controlled document to the image cache key; r=seth
This ID will be null for non-controlled documents and also for image cache
entries for which a document is not available, and it will be the numerical
value of the document pointer for controlled documents.

This effectively makes sure that a controlled document doesn't share its
image cache entries with anything else.
2015-10-30 16:03:11 -04:00
Ehsan Akhgari
94e1c22d9d Bug 1202085 - Part 2: Add an optional document argument to imgICache::FindEntryProperties(); r=seth 2015-10-30 16:03:09 -04:00
Ehsan Akhgari
0473e2063b Bug 1202085 - Part 1: Remove imgICache::RemoveEntry(); r=seth 2015-10-30 16:03:08 -04:00
Seth Fowler
38c6d40861 Bug 1207355 (Part 8) - Remove imgIContainer::RequestDecode() and imgIRequest::RequestDecode(). r=tn 2015-10-29 16:37:42 -07:00
Seth Fowler
6596bddd57 Bug 1207355 (Part 7) - Only trigger intrinsic size decode in FinalizeDecoder() if StartDecoding() was called. r=tn 2015-10-29 16:37:42 -07:00
Seth Fowler
673522f3d2 Bug 1207355 (Part 6) - Only respect StartDecoding() in imgRequest/imgRequestProxy. r=tn 2015-10-29 16:37:42 -07:00
Seth Fowler
6c65f4629d Bug 1207355 (Part 5) - Request decodes intelligently in MultipartImage. r=tn 2015-10-29 16:37:42 -07:00
Phil Ringnalda
51a93c44eb Back out 8 changesets (bug 1207355) for OS X 10.10 reftest failures in generated-content/
CLOSED TREE

Backed out changeset aafd6db2fbb4 (bug 1207355)
Backed out changeset 9dd950b837fb (bug 1207355)
Backed out changeset e941e0e106a1 (bug 1207355)
Backed out changeset ecebca101fcb (bug 1207355)
Backed out changeset 08f2017137e1 (bug 1207355)
Backed out changeset 3dc69e37c9b4 (bug 1207355)
Backed out changeset bcdf51edb121 (bug 1207355)
Backed out changeset 1d4c00dbf49a (bug 1207355)
2015-10-28 22:57:43 -07:00
Nicholas Nethercote
cd0d639069 Bug 1209812 (part 3) - Rename SurfaceFormat::R5G6B5 as R5G6B5_UINT16. r=Bas. 2015-10-22 23:01:31 -07:00
Seth Fowler
7a98a9dcaa Bug 1207355 (Part 8) - Remove imgIContainer::RequestDecode() and imgIRequest::RequestDecode(). r=tn 2015-10-28 16:40:43 -07:00
Seth Fowler
9b952ac16a Bug 1207355 (Part 7) - Only trigger intrinsic size decode in FinalizeDecoder() if StartDecoding() was called. r=tn 2015-10-28 16:40:43 -07:00
Seth Fowler
62d0653212 Bug 1207355 (Part 6) - Only respect StartDecoding() in imgRequest/imgRequestProxy. r=tn 2015-10-28 16:40:43 -07:00
Seth Fowler
c82be0d745 Bug 1207355 (Part 5) - Request decodes intelligently in MultipartImage. r=tn 2015-10-28 16:40:43 -07:00
Nicholas Nethercote
450dc59dc6 Bug 1214476 - Remove unused code for encoding BMPv2 files. r=seth.
nsBMPEncoder produces either BMPv3 or BMPv5 files. (See the Version enum which
only has VERSION_3 and VERSION_5 values, and ParseOptions()'s handling of the
|version| parameter.

Nonetheless, there is some code to handle encoding of BMPv2 files. This patch
removes this.
2015-10-14 14:47:29 -07:00
Nicholas Nethercote
81fba50329 Bug 1215361 (part 3) - Deconvolute nsICODecoder's handling of endianness. r=seth.
nsICODecoder's reading and writing of little-endian values can be simplified
greatly.

Also, ReadBPP() was highly dodgy: BMP's bpp field is 16-bit
but ReadBPP() read it as if it's 32-bit. I think this currently works because
the bpp field is followed by the 32-bit compression field which is usually 0
for BMPs within ICOs!
2015-10-15 17:54:41 -07:00
Nicholas Nethercote
adabcb08d4 Bug 1215361 (part 2) - Streamline nsBMPDecoder's getters. r=seth.
- GetBitsPerPixel() and GetWidth() are no longer used.

- GetHeight() is now only used within nsBMPDecoder and can be renamed and
  inlined into the header.

- GetImageData() can be inlined into the header.
2015-10-15 17:38:32 -07:00
Nicholas Nethercote
5dbc0f7d58 Bug 1215361 (part 1) - Don't set mBPP twice in nsICODecoder.cpp. r=seth.
Seth's "XXX" comment is correct.
2015-10-15 17:35:21 -07:00
Nicholas Nethercote
021613e515 Bug 1215334 (part 2) - Avoid creating a fake header for BMP files in ICO files. r=seth.
This requires delaying the creation of the BMP decoder used by the ICO decoder.
2015-10-15 15:43:31 -07:00
Nicholas Nethercote
8ef8ffb5d0 Bug 1215334 (part 1) - Avoid creating a fake header for BMP files in ICO files. r=seth.
The FileHeader and V5InfoHeader structs are shared by the BMP decoder and
encoder. But most of the fields within those structs are actually unused by the
decoder. It makes things clearer if we create a decoder-only struct that
contains the used fields, and then make FileHeader and V5InfoHeader only used
by the encoder. This patch does that.

This patch also renames BMPFileHeaders.h as BMPHeaders.h, which is now a better
name for it.
2015-10-15 15:43:25 -07:00
Nathan Froyd
edc9df0468 Bug 1218823 - use UniquePtr<> in preference to delete[] in image/; r=seth 2015-10-27 10:47:51 -04:00
Nathan Froyd
4b9c463d9b Bug 1218782 - use fallible allocations in Downscaler.cpp; r=seth
MakeUnique and its underlying |new| call will crash the program on
failure.  This code was clearly written with fallible allocations in
mind, so let's make the allocations actually be fallible.
2015-10-27 09:32:53 -04:00
Nicholas Nethercote
c176fc94fe Bug 1214072 (part 2) - Implement transparency properly for BMP images. r=seth.
Currently we don't implement transparency at all in BMP images except for an
odd-duck case of BMPs within ICOs.

This patch does the following.

- It implements transparency properly for 16bpp and 32bpp images via bitfield
  masking. (For 32bpp images this also requires handling colors via bitfield
  masking.) The patch maintains the existing BMP-within-ICO transparency
  handling.

- It also reworks BitFields::Value::Set().

  * It now works correctly if the run of 1s goes all the way to bit 31 (the
    old code didn't set mBitWidth).

  * If the mask is 0, will give an mRightShift of 0 (old code gave 32, and
    right-shifting by 32 is dodgy).

  * It's now easier to read.

- It renames transparent.bmp as transparent-if-within-ico.bmp. Ironically
  enough this file currently uses BITFIELDS compression and is WinBMPv5 format,
  which means it contains well-specified alpha data. In order to use it to test
  the hacky BMP-within-ICO transparency scheme the patch changes it to be
  WinBMPv3 format with RGB compression (i.e. no compression). I left the
  now-excess bytes (including the bitfields) in the info header in place
  because that's allowed -- thanks to the start of the pixel data being
  specified by the |dataoffset| field -- they'll just be ignored.

- It tweaks the naming of the relevant gtests and some of their finer details
  to work with the new way of doing things.

This fixes all four remaining failures in bmpsuite.
2015-10-13 21:20:10 -07:00
Nicholas Nethercote
f53f3ba17b Bug 1214072 (part 1) - Read BMP bitfields during metadata decoding. r=seth.
Currently we don't read BMP bitfields during metadata decoding. But we'll need
to in order implement alpha, because we need to know during metadata decoding
if alpha is used.

This patch moves code around to achieve this (and adds the required
mMayHaveTransparency field). The change has no noticeable effect for now.
2015-10-13 20:01:24 -07:00
Birunthan Mohanathas
a535083ab4 Bug 1217320 - Remove more XPIDL signature comments in .cpp files. r=froydnj
Comment-only, DONTBUILD.
2015-10-27 06:54:25 +02:00
Nathan Froyd
4d892a72c6 Bug 1215763 - part 3 - s/nsAutoArrayPtr/UniquePtr/ in nsBMPEncoder; r=seth
The wrinkle here is that while we can pass a UniquePtr to
ConvertHostARGBRow, we can't pass UniquePtr to
EncodeImageDataRow{24,32}, as the latter get called with raw pointers
out of our control.
2015-10-17 07:01:31 -04:00
Nathan Froyd
a25f833021 Bug 1215763 - part 2 - s/nsAutoPtr/UniquePtr/ in image/; r=seth
These conversions should be straightforward, but we have to add a .get
for nsExpirationTracker::Iterator.
2015-10-17 06:53:28 -04:00
Nathan Froyd
6cdd2ef7ab Bug 1215763 - part 1 - remove unnecessary nsAutoPtr.h includes; r=seth
These turned up when grepping around for nsAutoPtr; it seemed easier to
remove them as a first step.
2015-10-17 06:52:21 -04:00
Nathan Froyd
5fa6cd191a Bug 1215156 - move SetPixel* functions into nsBMPDecoder.cpp; r=seth
These functions are only used in nsBMPDecoder.cpp; we don't need them
anywhere else.  The only other place they might get used would be the
BMP encoder, but the encoder appears to have its own routines for
setting pixel data, which don't overlap very well with the decoder's.
2015-10-15 19:58:52 -04:00
Seth Fowler
87d5a894f4 Bug 1213744 (Part 2) - Clamp the GIF frame rect to the visible rect for DDD and don't decode outside it. r=tn 2015-10-25 13:14:14 -07:00
Seth Fowler
56eda8e1a6 Bug 1213744 (Part 1) - Support zero-size frame rects and detecting the end of the frame in Downscaler. r=tn 2015-10-25 13:14:14 -07:00
Seth Fowler
f5f33ee3a4 Backed out changeset 154fa450fb1f (bug 1214055) because it wasn't ready to land. 2015-10-22 23:34:04 -07:00
Seth Fowler
ce4def49e4 Bug 1214055 - Treat PNGs as transparent during the metadata decode. r=tn 2015-10-22 23:29:38 -07:00
Seth Fowler
75ee270f27 Bug 1214054 - Don't fire DECODE_COMPLETE in VectorImage::OnSVGDocumentError(). r=dholbert 2015-10-22 23:29:38 -07:00
Oliver Henshaw
b9c6244413 Bug 1180715 (1/4) - Track image LoadTime to compare with file mtime. review=seth
mTouchedTime is not appropriate for this as it is updated when an image
load re-uses the same imgRequest, especially as it has one second
granularity. A timestamp that is updated every time the backing file is
re-read should work better.

A millisecond granularity timestamp would be preferable, and would be
achievable on most or all supported platforms. But some older
filesystems have timestamp granularity of a second or worse, notably
ext3 and FAT32 (and even ext4 filesytems created with inode_size < 256
bytes, e.g. with 'mke2fs -t small' - see
https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Inode_Timestamps
for details.)
2015-10-20 10:45:25 +05:30
Phil Ringnalda
360db072b6 Bug 1207012 - Disable browser_bug666317.js for a permaorange uncaught exception that becomes visibly orange on beta 2015-10-18 18:39:07 -07:00
Nathan Froyd
e4e2da55c9 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
2015-10-18 01:24:48 -04:00
Nathan Froyd
5254890206 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
Nicholas Nethercote
f7f51e2582 Bug 1213613 (part 3) - Fix color-scaling of 16bpp BMP images. r=seth.
This patch implements proper color-scaling, instead of bit-shifting, and uses
it for 16bpp images.

It also cleans up the code relating to color masking in the process, by making
BitFields a proper class and introducing the Value class within it.

This fixes sub-optimal handling of four images in bmpsuite.
2015-10-13 20:01:02 -07:00
Nicholas Nethercote
7b48f0bb0c Bug 1213613 (part 2) - Move some BMP-related structs. r=seth.
This patch moves them into less exposed places. It also moves the RLE_*
constants into the RLE enum, and renames ColorTable and its fields.
2015-10-13 16:43:18 -07:00
Nicholas Nethercote
d89f3d4776 Bug 1213613 (part 1) - Formatting cleanups for nsBMPEncoder.h. r=seth.
Two-space indents is the Gecko standard, and it's what nsBMPDecoder.cpp uses.
This patch changes nsBMPEncoder.h to use two-space indents as well. This will
help avoid possible mis-indentation if code is moved from the .h to the .cpp or
vice versa (as subsequent patches in this bug will do).

Also, it changes some of the // comments on public methods to doxygen-style ///
comments.
2015-10-13 16:08:06 -07:00
Nicholas Nethercote
8cc4e81fdd Bug 1204394 (part 2) - Add bmpsuite to the BMP reftests. r=seth.
We have 52 passes and 5 known fails. Three of the passes have higher fuzziness
allowances than they should, so really there are 8 files that we need to
improve on.
2015-10-08 22:55:28 -07:00
Nicholas Nethercote
7a382ecf62 Bug 1204394 (part 1) - Using StreamingLexer in the BMP decoder. r=seth.
This patch is a major overhaul of nsBMPDecoder.

The patch improves the code in the following ways.

- It converts nsBMPDecoder to use StreamingLexer, which makes it much easier to
  read.

- It adds a detailed comment about the BMP format at the top of
  nsBMPDecoder.cpp.

- It fixes lots of inconsistent indenting.

- It moves |bihsize| from |mBFH| to |mBIH| to match the file format and common
  sense. The avoids the need for the confusing LENGTH/INTERNAL_LENGTH
  distinction.

- It renames most of the types in BMPFileHeader.h, so they have better names,
  in StudlyCaps form, and within the new |bmp| namespace.

- It removes the BMP_HEADER_LENGTH struct and inlines its values directly into
  the two places they were used.

- It removes the MOZ_LOG logging done on some of the failure cases. (Most
  failure cases lacked logging so why bother with some?)

- It removes over 200 lines of code, despite the addition of the big format
  comment.

The patch changes the way BMPs are decoded as follows.

- It adds stricter testing of the InfoHeader length, rejecting files with bad
  values.

- It moves all header sanity checking that can lead to file rejection into the
  metadata decode phase. (Previously, bpp/compression consistency checking did
  not occur during a metadata decode.)

- It removes BMPINFOHEADER::ALPHABITFIELDS, which was (a) a weird WinCE-only
  thing, and (b) we didn't actually allow it, and (c) we used the value 4
  instead of 6(!).

- It rejects the previously-accepted compression==RLE4 && bpp=1 combination
  because it doesn't make sense.

- It removes a fudge in RLE absolute mode handling that permitted one pixel too
  many in a row but only if the row's width was odd(!)

- It now rejects a file with a negative gap between the color table and the
  pixel data.

The patch leaves the following problems unaddressed.

- If bpp==32 we totally ignore compression==BITFIELDS and treat it like
  compression=RGB.

- Transparency as specified in WinBMPv{4,5} isn't handled at all.

These will be fixed in follow-ups.

All these changes affect (for the better) the results of the following tests
that will be added in part 2:

- g/pal8v4.bmp
- g/pal8v5.bmp
- q/pal8os2sp.bmp
- q/pal8os2v2.bmp
- q/pal8os2v2-16.bmp
- b/badheadersize.bmp
- b/badpalettesize.bmp
- b/badrle.bmp
2015-10-08 22:47:56 -07:00
Eric Rahm
439b783afc Bug 1194555 - Part 3: Remove |getReportsForThisProcess| from the nsIMemoryReporterManager interface. r=njn
|getReportsForThisProcess| differs from |getReports| in that it is limited to current process and is synchronous. When asynchronous memory reporters are added the function will no longer be able tobe synchronous. There isn't much utility in only measuring the current process, so we can remove the function and switch existing users to |getReports|.
2015-10-14 16:52:55 -07:00
Seth Fowler
b5df412f06 Bug 1209715 - Add operator overloads for combining DrawResults. r=tn 2015-10-13 23:21:39 -07:00
Seth Fowler
d5d3d3f89e Bug 594505 - Remove obsolete comment since this bug has now been fixed. r=me DONTBUILD 2015-10-12 18:45:19 -07:00
Hiroyuki Ikezoe
dd1c422ef6 Bug 1167627 - Part 8: Use mozinfo in image/. 2015-08-25 15:01:00 +02:00
Tom Klein
9524cbb750 Bug 1212954 - Make BaseSize::IsEmpty return true for negative sizes to avoid NS_ERROR in VectorImage::GetFrameAtSize when root svg doesn't have intrinsic width or height. r=roc 2015-10-11 18:13:10 +02:00
Carsten "Tomcat" Book
d7f143eaad Backed out 2 changesets (bug 1202902) to recking bug 1202902 to be able to reopen inbound on a CLOSED TREE
Backed out changeset 647025383676 (bug 1202902)
Backed out changeset d70c7fe532c6 (bug 1202902)
2015-10-07 14:03:21 +02:00
Nicholas Nethercote
0c9936d9d3 Bug 1211324 (part 5) - Remove GraphicsFilter and gfxGraphicsFilter. r=mattwoodrow. 2015-10-05 17:18:10 -07:00
Nicholas Nethercote
e6cc09cd51 Bug 1211324 (part 4) - Replace GraphicsFilter constants with gfx::Filter equivalents. r=mattwoodrow.
The conversion is as follows:

- GraphicsFilter::FILTER_NEAREST == gfx::Filter::POINT
- GraphicsFilter::FILTER_GOOD    == gfx::Filter::GOOD
- GraphicsFilter::FILTER_BEST    == gfx::Filter::LINEAR

Also typedef GraphicsFilter to gfx::Filter; this will be removed in the next
patch.

These changes mean ToFilter() and ThebesFilter() are no longer needed.
2015-10-05 17:12:46 -07:00
Nicholas Nethercote
4461b88439 Bug 1211324 (part 3) - Remove GraphicsFilter::FILTER_FAST and replace it with FILTER_BEST. r=mattwoodrow.
This may sound like an odd change but it's what the current code effectively
already does due to the way ToFilter() and ThebesFilter() are defined.
2015-10-05 16:59:32 -07:00
Carsten "Tomcat" Book
b9e5717f50 Backed out 1 changesets (bug 1202902) for causing merge conflicts to mozilla-central
Backed out changeset cfc1820361f5 (bug 1202902)
2015-10-07 12:13:45 +02:00
Wes Kocher
46d77c938b Backed out 7 changesets (bug 1194555) for xpcshell failures
Backed out changeset e77be333f4fb (bug 1194555)
Backed out changeset 11951462a37c (bug 1194555)
Backed out changeset 99b27aa952c5 (bug 1194555)
Backed out changeset 70a8ed3b6a45 (bug 1194555)
Backed out changeset 748bfebe81e7 (bug 1194555)
Backed out changeset cbaac05a2934 (bug 1194555)
Backed out changeset fcbfd1379fcd (bug 1194555)
2015-10-06 14:40:51 -07:00
Shu-yu Guo
b5f316de44 Bug 1202902 - Scripted fix the world. 2015-10-06 14:00:31 -07:00
Eric Rahm
ceea29572f Bug 1194555 - Part 3: Remove |getReportsForThisProcess| from the nsIMemoryReporterManager interface. r=njn
|getReportsForThisProcess| differs from |getReports| in that it is limited to current process and is synchronous. When asynchronous memory reporters are added the function will no longer be able tobe synchronous. There isn't much utility in only measuring the current process, so we can remove the function and switch existing users to |getReports|.
2015-10-06 11:23:33 -07:00
Nicholas Nethercote
58b9dc1102 Bug 1204393 (part 2) - Add more testing of the ICON decoder. r=seth. 2015-10-05 14:29:11 -07:00