mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
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.
This commit is contained in:
parent
51ea0e4f3a
commit
2df558509f
2 changed files with 11 additions and 11 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue