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

123 Коммитов

Автор SHA1 Сообщение Дата
Andrew Osmond 449b1552c1 Bug 1343499 - Expose native image sizes to imagelib users. r=tnikkel 2017-03-22 09:05:36 -04:00
Andrew Osmond c21c5cb4c8 Backed out changeset 619b5b27ce87 (bug 1343499) for CLOSED TREE build bustage r=backout 2017-03-22 11:04:30 -04:00
Andrew Osmond a60b290b56 Bug 1343499 - Expose native image sizes to imagelib users. r=tnikkel 2017-03-22 09:05:36 -04:00
Andrew Osmond 9f71f348c1 Backed out changeset 0b797601dc36 (bug 1343499) for build bustages. r=backout 2017-03-22 09:19:05 -04:00
Andrew Osmond cbf46adaef Bug 1343499 - Expose native image sizes to imagelib users. r=tnikkel 2017-03-22 09:05:36 -04:00
Andrew Osmond 4f8eb1363e Bug 1339202 - Decode images to shared surfaces for WebRender. r=tnikkel 2017-02-08 15:48:59 -05:00
Sebastian Hengst 3ce82bcd4f Backed out changeset 45dd83a63162 (bug 1339202) for crashing in image processing related tests, e.g. xpcshell test test_imgtools.js. r=backout 2017-02-13 22:34:54 +01:00
Andrew Osmond 1683b602b4 Bug 1339202 - Decode images to shared surfaces for WebRender. r=tnikkel 2017-02-08 15:48:59 -05:00
Andrew Osmond 42d8ee76ab Bug 1290293 - Part 2f. Assert there is no frame on the finish decoding error path. r=tnikkel 2017-02-10 08:33:11 -05:00
Andrew Osmond 65f399d680 Bug 1315443 - Use the embedded BMPs BPP over the ICOs BPP when available. r=tnikkel 2016-11-16 09:57:35 -05:00
Andrew Osmond 54d6f7e0c4 Bug 1258741 - Part 1. Remove dead/unused image decoder aborted flag. r=tnikkel 2016-09-21 07:13:08 -04:00
Seth Fowler 6a44833af8 Bug 1292505 (Part 1c) - Use ExplicitOutputSize() instead of Downscaler::TargetSize() in nsICODecoder. r=edwin 2016-08-05 13:44:48 -07:00
Seth Fowler 3cca5ff418 Bug 1291054 (Part 3) - Rename Decoder::GetSize() to Decoder::Size() to be consistent with the style guide. r=edwin 2016-08-02 04:10:51 -07:00
Seth Fowler 7edd4cdb0d Bug 1287691 (Part 1) - Expose yielding to decoding tasks. r=edwin 2016-07-20 02:30:33 -07:00
Makoto Kato 1cb4228397 Backed out 4 changesets (bug 1287691) due to Windows build failure
MozReview-Commit-ID: KgV3nU9a64F
2016-07-20 11:03:59 +09:00
Seth Fowler 966d0547b7 Bug 1287691 (Part 1) - Expose yielding to decoding tasks. r=edwin 2016-07-19 17:15:01 -07:00
Seth Fowler 666fc943cb Bug 1287367 - Allow users of StreamingLexer to detect and handle truncation. r=njn 2016-07-18 23:41:20 -07:00
Seth Fowler 938a963f7f Bug 1287246 (Part 1) - Expose LexerResult from the StreamingLexer API and add an explicit Yield type. r=njn 2016-07-18 01:25:37 -07:00
Seth Fowler 4c2a4667a7 Bug 1286165 (Part 2) - Advance decoders' SourceBufferIterator directly in StreamingLexer. r=edwin,njn 2016-07-15 17:48:57 -07:00
Seth Fowler 4be29e46b3 Bug 1285867 (Part 7) - Clean up remaining references to decoder 'data errors' and refer to them as just 'errors'. r=edwin 2016-07-15 16:41:11 -07:00
Seth Fowler 0d49568090 Bug 1285867 (Part 3e) - Use TerminalState to exit the Decode() loop. r=edwin 2016-07-15 16:41:11 -07:00
Seth Fowler 0872ad00cb Bug 1285867 (Part 2) - Don't call Decoder::PostDataError() from Decoder subclasses. r=edwin 2016-07-15 16:41:11 -07:00
Seth Fowler 3c38000891 Bug 1285867 (Part 1) - Remove Decoder's notion of decoder errors. r=edwin 2016-07-15 16:41:11 -07:00
Seth Fowler bd9732ac1b Bug 1285865 (Part 6) - Pass a SourceBufferIterator to Decoder::DoDecode(). r=edwin 2016-07-11 12:13:13 -07:00
Seth Fowler e80fff4085 Bug 1285865 (Part 5) - Return a Maybe<TerminalState> from Decoder::DoDecode(). r=edwin 2016-07-11 12:13:11 -07:00
Seth Fowler a9f24e8308 Bug 1285865 (Part 4) - Rename Decoder::WriteInternal() to Decoder::DoDecode() and fix its argument types. r=edwin 2016-07-11 12:13:09 -07:00
Seth Fowler e4439cf3bc Bug 1185799 (Part 3) - Make nsICODecoder use only the public Decoder interface for writing to its contained decoder. r=edwin 2016-07-07 15:50:49 -07:00
Seth Fowler 6361b2adb8 Bug 1185799 (Part 1) - Use DecoderFactory to construct nsICODecoder's contained decoder. r=edwin 2016-07-07 15:50:44 -07:00
Daniel Holbert 3996555d1a Bug 1282670, part 3: Make several imagelib .cpp files #inclue their corresponding .h file as their very first #include, per Gecko convention. r=seth
(In some cases, I've left "ImageLogging.h" being included before the corresponding .h file, because I ran across a warning comment saying that it needs to be included before any IPDL-generated files & anything that includes prlog.h; and it seems possible that Foo.cpp's corresponding Foo.h file could include such headers now or in the future.)

MozReview-Commit-ID: HPvUVj8YuKc
2016-06-30 10:27:03 -07:00
Seth Fowler 1d5c203221 Bug 1249578 (Part 1) - Verify that the size in the BIH header matches the ICO directory entry instead of fixing it. r=njn 2016-06-21 19:48:31 -07:00
Wes Kocher 7e180fa924 Backed out 2 changesets (bug 1249578) for build bustage
Backed out changeset caddb604d934 (bug 1249578)
Backed out changeset a2a645bf7ccf (bug 1249578)
2016-06-21 18:38:46 -07:00
Seth Fowler 79d8677d76 Bug 1249578 (Part 1) - Verify that the size in the BIH header matches the ICO directory entry instead of fixing it. r=njn 2016-06-21 18:06:28 -07:00
Chris Peterson 11ef78ae89 Bug 1275016 - Rename Endian.h to EndianUtils.h to avoid #include confusion with Android's endian.h stdlib header. r=froydnj
--HG--
rename : mfbt/Endian.h => mfbt/EndianUtils.h
2016-05-22 13:31:11 -07:00
Timothy Nikkel 5afe8e5453 Bug 1257101. imgFrame::IsImageComplete says whether we've had pixels decoded to the whole image rect, but it's used to check if the frame is finished decoding. These are different things when the image has more than one progress pass. r=seth
This means that in RasterImage::LookupFrame when we are asked to do a sync decode (if needed) we use WaitUntilComplete to wait until the frame is finished decoding.  But we would actually return after the next progressive pass notified the monitor to wake up. Thus, we would draw a not-fully-decoded image even though the sync decode flag was passed.

The change in FrameAnimator means that we won't draw the next frame in an animated image until all progressive passes of that image are complete. This seems like what we want anyways.

There is one real use of IsImageComplete left, in imgFrame::Draw, where we need to know if the decoded image data covers the whole image frame. (There are a couple of uses of IsImageComplete in asserts.)
2016-03-23 19:31:42 -05:00
Edwin Flores 4623e471a3 Bug 1207958 - Fix heuristic for choosing which ICO sub-image to render - r=tn 2016-01-20 11:00:12 +00:00
Nicholas Nethercote 2c9bfa2dec Bug 1223319 (part 1) - Remove unused function nsICODecoder::CalcAlphaRowSize(). r=seth. 2015-11-16 17:54:11 -08:00
Nicholas Nethercote ce10603db1 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|.

--HG--
extra : rebase_source : f405a67fdf0f1bb712409eafecb21ac9b59d6db0
2015-10-28 01:30:20 -07:00
Nicholas Nethercote 2a85ac5257 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!

--HG--
extra : rebase_source : 5fd43dedc036dca5bc2ff79b029855dc76d62515
2015-10-15 17:54:41 -07:00
Nicholas Nethercote 5203886b92 Bug 1215361 (part 1) - Don't set mBPP twice in nsICODecoder.cpp. r=seth.
Seth's "XXX" comment is correct.

--HG--
extra : rebase_source : 0a3c20d7c8a67e8eb0ec21cdd197a901a463c707
2015-10-15 17:35:21 -07:00
Nicholas Nethercote 65c73a3e0e 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.

--HG--
extra : rebase_source : 629a2ac387a9c8ee1a520c70733adb10cc156aa8
2015-10-15 15:43:31 -07:00
Nicholas Nethercote a685206641 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.

--HG--
rename : image/BMPFileHeaders.h => image/BMPHeaders.h
extra : rebase_source : 2227679b8aef25e48d3e8e7d38a3ba79a57c40d3
2015-10-15 15:43:25 -07:00
Nicholas Nethercote c5432f6a1e 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.

--HG--
rename : image/test/gtest/transparent.bmp => image/test/gtest/transparent-if-within-ico.bmp
extra : rebase_source : 2f4838d04bbae4fac00cc69e8d75469105a5de3b
2015-10-13 21:20:10 -07: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
Nicholas Nethercote 5ca8040708 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

--HG--
extra : rebase_source : 8ddc2f5fccce6998348097ff9f0a1072d273cdf4
2015-10-08 22:47:56 -07:00
Seth Fowler ba99adc235 Bug 1207378 (Part 1) - Add support for a frame rect to Downscaler. r=tn 2015-09-26 01:36:19 -07:00
Seth Fowler 7a466fae73 Bug 1206836 - When downscaling ICOs, downscale the AND mask as well. r=tn a=KWierso 2015-09-21 19:52:31 -07:00
Seth Fowler c1229ef66c Bug 1146663 (Part 5) - Require that all image decoders support downscale-during-decode. r=tn 2015-09-19 16:21:08 -07:00
Seth Fowler 93cbaca5e0 Bug 1201796 (Part 4) - Add downscale-during-decode support for the ICO decoder. r=tn 2015-09-19 13:34:14 -07:00
Seth Fowler 30373cd6eb Bug 1201796 (Part 1) - Treat ICOs with wrong widths and heights as corrupt. r=tn
--HG--
rename : image/test/reftest/ico/ico-bmp-corrupted/invalid_ico_height.ico => image/test/crashtests/invalid_ico_height.ico
rename : image/test/reftest/ico/ico-bmp-corrupted/invalid_ico_width.ico => image/test/crashtests/invalid_ico_width.ico
2015-09-19 13:34:06 -07:00
Seth Fowler 8adce05f13 Bug 1196066 (Part 3) - Rewrite nsICODecoder to use StreamingLexer. r=tn 2015-09-18 23:12:30 -07:00