diff options
author | Job Bautista <jobbautista9@protonmail.com> | 2022-06-20 19:02:04 +0800 |
---|---|---|
committer | Job Bautista <jobbautista9@protonmail.com> | 2022-06-29 13:53:10 +0800 |
commit | 2ad17268edb8e198000cded87fdbcddac25036cf (patch) | |
tree | 65758a1daa162c8307567fba35f95bf00a8ed097 /image | |
parent | 888c35be894bf163f37bb58bc4049f0f6ff3db60 (diff) | |
download | uxp-2ad17268edb8e198000cded87fdbcddac25036cf.tar.gz |
Issue #1769 - Part 3: Cleanup nsJXLDecoder.
The mp4parse Rust component has been removed in Issue #58. It doesn't seem
like the decoder uses any mp4parse function, so seems like it's safe to
remove it.
Removed const DecoderType named GetType() because we don't have it in our
Decoder.h.
I've decided to abandon the OS_RGBA backporting effort and instead went for
using OS_RGBA's value which is R8G8B8A8. Turns out that there is much more
going on in Mozilla's version of CreateSurfacePipe than I've expected, like
the aInFormat and aOutFormat thing which I really don't want to delve into
right now. Looking at the code it looks like all JPEG-XL images are expected
to have an alpha channel anyway, so I think my workaround should be safe.
I also removed the dependency in OrientedIntSize and used Size() from gfx/2d/
Point.h like our PNG and GIF decoders currently do. Migrating our decoders
to OrientedInt types should be done in another PR instead.
Also also changed the coding style to be closer to UXP's.
Also also also, I made a mistake in Part 1's commit message; the commit used
for libjxl is 192ddd90fdf0c69cd1db1c8d7850db036dd87f4b.
Diffstat (limited to 'image')
-rw-r--r-- | image/decoders/nsJXLDecoder.cpp | 19 | ||||
-rw-r--r-- | image/decoders/nsJXLDecoder.h | 3 |
2 files changed, 11 insertions, 11 deletions
diff --git a/image/decoders/nsJXLDecoder.cpp b/image/decoders/nsJXLDecoder.cpp index ce83937490..e0e3407557 100644 --- a/image/decoders/nsJXLDecoder.cpp +++ b/image/decoders/nsJXLDecoder.cpp @@ -66,8 +66,9 @@ size_t nsJXLDecoder::PreferredThreadCount() { return JxlThreadParallelRunnerDefaultNumWorkerThreads(); } -LexerResult nsJXLDecoder::DoDecode(SourceBufferIterator& aIterator, - IResumable* aOnResume) { +LexerResult +nsJXLDecoder::DoDecode(SourceBufferIterator& aIterator, IResumable* aOnResume) +{ // return LexerResult(TerminalState::FAILURE); MOZ_ASSERT(!HasError(), "Shouldn't call DoDecode after error!"); @@ -83,8 +84,9 @@ LexerResult nsJXLDecoder::DoDecode(SourceBufferIterator& aIterator, }); }; -LexerTransition<nsJXLDecoder::State> nsJXLDecoder::ReadJXLData( - const char* aData, size_t aLength) { +LexerTransition<nsJXLDecoder::State> +nsJXLDecoder::ReadJXLData(const char* aData, size_t aLength) +{ const uint8_t* input = (const uint8_t*)aData; size_t length = aLength; if (mBuffer.length() != 0) { @@ -133,10 +135,9 @@ LexerTransition<nsJXLDecoder::State> nsJXLDecoder::ReadJXLData( } case JXL_DEC_FULL_IMAGE: { - OrientedIntSize size(mInfo.xsize, mInfo.ysize); Maybe<SurfacePipe> pipe = SurfacePipeFactory::CreateSurfacePipe( - this, size, OutputSize(), FullFrame(), SurfaceFormat::R8G8B8A8, - SurfaceFormat::OS_RGBA, Nothing(), nullptr, SurfacePipeFlags()); + this, Size(), OutputSize(), FullFrame(), SurfaceFormat::B8G8R8A8, + Nothing(), SurfacePipeFlags()); for (uint8_t* rowPtr = mOutBuffer.begin(); rowPtr < mOutBuffer.end(); rowPtr += mInfo.xsize * 4) { pipe->WriteBuffer(reinterpret_cast<uint32_t*>(rowPtr)); @@ -154,7 +155,9 @@ LexerTransition<nsJXLDecoder::State> nsJXLDecoder::ReadJXLData( } } -LexerTransition<nsJXLDecoder::State> nsJXLDecoder::FinishedJXLData() { +LexerTransition<nsJXLDecoder::State> +nsJXLDecoder::FinishedJXLData() +{ MOZ_ASSERT_UNREACHABLE("Read the entire address space?"); return Transition::TerminateFailure(); } diff --git a/image/decoders/nsJXLDecoder.h b/image/decoders/nsJXLDecoder.h index 0b723878ae..d4a1abe7f8 100644 --- a/image/decoders/nsJXLDecoder.h +++ b/image/decoders/nsJXLDecoder.h @@ -8,7 +8,6 @@ #define mozilla_image_decoders_nsJXLDecoder_h #include "Decoder.h" -#include "mp4parse.h" #include "SurfacePipe.h" #include "jxl/decode_cxx.h" @@ -21,8 +20,6 @@ class nsJXLDecoder final : public Decoder { public: virtual ~nsJXLDecoder(); - DecoderType GetType() const override { return DecoderType::JXL; } - protected: LexerResult DoDecode(SourceBufferIterator& aIterator, IResumable* aOnResume) override; |