33#define BUFFER_SIZE 4096
61 sal_uInt64 nInitialPosition = pStream->
Tell();
70 pStream->
Seek( nInitialPosition );
92 ERREXIT(cinfo, JERR_INPUT_EMPTY);
94 WARNMS(cinfo, JWRN_JPEG_EOF);
96 source->
buffer[0] = JOCTET(0xFF);
97 source->
buffer[1] = JOCTET(JPEG_EOI);
101 source->
pub.next_input_byte = source->
buffer;
102 source->
pub.bytes_in_buffer = nbytes;
116 if (numberOfBytes <= 0)
119 while (numberOfBytes >
static_cast<tools::Long>(source->
pub.bytes_in_buffer))
121 numberOfBytes -=
static_cast<tools::Long>(source->
pub.bytes_in_buffer);
128 source->
pub.next_input_byte +=
static_cast<size_t>(numberOfBytes);
129 source->
pub.bytes_in_buffer -=
static_cast<size_t>(numberOfBytes);
152 if (cinfo->src ==
nullptr)
154 cinfo->src =
static_cast<jpeg_source_mgr *
>(
155 (*cinfo->mem->alloc_small) (
reinterpret_cast<j_common_ptr
>(cinfo), JPOOL_PERMANENT,
sizeof(
SourceManagerStruct)));
157 source->
buffer =
static_cast<JOCTET *
>(
158 (*cinfo->mem->alloc_small) (
reinterpret_cast<j_common_ptr
>(cinfo), JPOOL_PERMANENT,
BUFFER_SIZE *
sizeof(JOCTET)));
165 source->
pub.resync_to_restart = jpeg_resync_to_restart;
168 source->
pub.bytes_in_buffer = 0;
169 source->
pub.next_input_byte =
nullptr;
173 mrStream ( rStream ),
174 mnLastPos ( rStream.Tell() ),
200 bool bGray = rParam.
bGray;
213 for( sal_uInt16
n = 0;
n < 256;
n++ )
234 MapMode aMapMode( nUnit == 1 ? MapUnit::MapInch : MapUnit::MapCM,
Point(), aFractX, aFractY );
256 if (nLines && (nLines < aSizePixel.
Height()))
298 if (bUseExistingBitmap || !
mpBitmap->IsEmpty())
306 if (!bUseExistingBitmap)
void jpeg_svstream_src(j_decompress_ptr cinfo, void *input)
static void term_source(j_decompress_ptr)
static tools::Long StreamRead(SvStream *pStream, void *pBuffer, tools::Long nBufferSize)
static void skip_input_data(j_decompress_ptr cinfo, long numberOfBytes)
static void init_source(j_decompress_ptr cinfo)
static boolean fill_input_buffer(j_decompress_ptr cinfo)
virtual ~JPEGReader() override
ReadState Read(Graphic &rGraphic, GraphicFilterImportFlags nImportFlags, BitmapScopedWriteAccess *ppAccess)
bool CreateBitmap(JPEGCreateBitmapParam const ¶m)
std::optional< AlphaMask > mpIncompleteAlpha
std::optional< Bitmap > mpBitmap
Graphic CreateIntermediateGraphic(tools::Long nLines)
JPEGReader(SvStream &rStream, GraphicFilterImportFlags nImportFlags)
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
virtual void ResetError()
void SetError(ErrCode nErrorCode)
sal_uInt64 Seek(sal_uInt64 nPos)
std::size_t ReadBytes(void *pData, std::size_t nSize)
This template handles BitmapAccess the RAII way.
constexpr ::Color COL_ALPHA_OPAQUE(0xff, 0xff, 0xff)
Reference< XOutputStream > stream
#define ERRCODE_IO_PENDING
@ UseExistingBitmap
Read pixel data into an existing bitmap.
void ReadJPEG(JPEGReader *pJPEGReader, void *pInputStream, tools::Long *pLines, GraphicFilterImportFlags nImportFlags, BitmapScopedWriteAccess *ppAccess)
tools::ULong density_unit
int no_data_available_failures