Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
calculate_pitch.h
Go to the documentation of this file.
1// Copyright 2022 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CORE_FXGE_CALCULATE_PITCH_H_
6#define CORE_FXGE_CALCULATE_PITCH_H_
7
8#include <stdint.h>
9
10#include <optional>
11
12namespace fxge {
13
14// Returns the bytes between successive rows of an image where rows are aligned
15// on a byte boundary and there is no additional padding beyond that, or nullopt
16// if the result can not fit in a uint32_t.
17std::optional<uint32_t> CalculatePitch8(uint32_t bits_per_component,
18 uint32_t components_per_pixel,
19 int width_in_pixels);
20
21// Returns the bytes between successive rows of an image where rows are aligned
22// on a 32-bit word boundary and there is no additional padding beyond that, or
23// nullopt if the result can not fit in a uint32_t.
24std::optional<uint32_t> CalculatePitch32(int bits_per_pixel,
25 int width_in_pixels);
26
27// Same as above, but terminate if the result can not fit in a uint32_t.
28uint32_t CalculatePitch8OrDie(uint32_t bits_per_component,
29 uint32_t components_per_pixel,
30 int width_in_pixels);
31uint32_t CalculatePitch32OrDie(int bits_per_pixel, int width_in_pixels);
32
33} // namespace fxge
34
35#endif // CORE_FXGE_CALCULATE_PITCH_H_
fxcodec::BasicModule BasicModule
Definition basicmodule.h:42
fxcrt::ByteString ByteString
Definition bytestring.h:180
#define DCHECK
Definition check.h:33
#define DCHECK_NE(x, y)
Definition check_op.h:18
#define CHECK_GE(x, y)
Definition check_op.h:15
#define DCHECK_EQ(x, y)
Definition check_op.h:17
void SetWidth(int width)
bool HasPalette() const
Definition cfx_dibbase.h:78
int GetBPP() const
Definition cfx_dibbase.h:72
void SetHeight(int height)
void SetFormat(FXDIB_Format format)
void SetPaletteArgb(int index, uint32_t color)
int GetHeight() const
Definition cfx_dibbase.h:66
int GetWidth() const
Definition cfx_dibbase.h:65
void SetPitch(uint32_t pitch)
std::vector< RetainPtr< CPDF_Object > >::const_iterator const_iterator
Definition cpdf_array.h:29
Family GetFamily() const
static uint32_t ComponentsForFamily(Family family)
uint32_t ComponentCount() const
static RetainPtr< CPDF_ColorSpace > GetStockCS(Family family)
~CPDF_DIB() override
RetainPtr< CPDF_DIB > DetachMask()
Definition cpdf_dib.cpp:903
size_t GetEstimatedImageMemoryBurden() const override
uint32_t GetMatteColor() const
Definition cpdf_dib.h:53
bool SkipToScanline(int line, PauseIndicatorIface *pPause) const override
bool IsJBigImage() const
Definition cpdf_dib.cpp:907
RetainPtr< CPDF_ColorSpace > GetColorSpace() const
Definition cpdf_dib.h:52
LoadState ContinueLoadDIBBase(PauseIndicatorIface *pPause)
Definition cpdf_dib.cpp:341
bool Load()
Definition cpdf_dib.cpp:241
pdfium::span< const uint8_t > GetScanline(int line) const override
LoadState StartLoadDIBBase(bool bHasMask, const CPDF_Dictionary *pFormResources, const CPDF_Dictionary *pPageResources, bool bStdCS, CPDF_ColorSpace::Family GroupFamily, bool bLoadMask, const CFX_Size &max_size_required)
Definition cpdf_dib.cpp:295
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
static bool IsValidJpegBitsPerComponent(int32_t bpc)
static bool IsValidJpegComponent(int32_t comps)
int GetMaxIndex() const
static DataVector< uint8_t > RunLengthEncode(pdfium::span< const uint8_t > src_span)
static std::unique_ptr< ScanlineDecoder > CreateRunLengthDecoder(pdfium::span< const uint8_t > src_buf, int width, int height, int nComps, int bpc)
BasicModule & operator=(const BasicModule &)=delete
BasicModule(const BasicModule &)=delete
static DataVector< uint8_t > A85Encode(pdfium::span< const uint8_t > src_span)
static void Sycc420ToRgbForTesting(opj_image_t *img)
static constexpr uint8_t kMaxResolutionsToSkip
bool Decode(pdfium::span< uint8_t > dest_buf, uint32_t pitch, bool swap_rgb, uint32_t component_count)
JpxImageInfo GetInfo() const
static std::unique_ptr< CJPX_Decoder > Create(pdfium::span< const uint8_t > src_span, CJPX_Decoder::ColorSpaceOption option, uint8_t resolution_levels_to_skip, bool strict_mode)
static bool IsValidIccComponents(int components)
pdfium::raw_span< const uint8_t > m_pGlobalSpan
pdfium::raw_span< const uint8_t > m_pSrcSpan
std::unique_ptr< CJBig2_Context > m_pContext
pdfium::raw_span< uint8_t > m_dest_buf
static FXCODEC_STATUS StartDecode(Jbig2Context *pJbig2Context, JBig2_DocumentContext *pJbig2DocumentContext, uint32_t width, uint32_t height, pdfium::span< const uint8_t > src_span, uint64_t src_key, pdfium::span< const uint8_t > global_span, uint64_t global_key, pdfium::span< uint8_t > dest_buf, uint32_t dest_pitch, PauseIndicatorIface *pPause)
static FXCODEC_STATUS ContinueDecode(Jbig2Context *pJbig2Context, PauseIndicatorIface *pPause)
Jbig2Decoder(const Jbig2Decoder &)=delete
Jbig2Decoder & operator=(const Jbig2Decoder &)=delete
JpegModule & operator=(const JpegModule &)=delete
static std::unique_ptr< ScanlineDecoder > CreateDecoder(pdfium::span< const uint8_t > src_span, uint32_t width, uint32_t height, int nComps, bool ColorTransform)
static std::optional< ImageInfo > LoadInfo(pdfium::span< const uint8_t > src_span)
JpegModule(const JpegModule &)=delete
virtual pdfium::span< uint8_t > GetNextLine()=0
ScanlineDecoder(int nOrigWidth, int nOrigHeight, int nOutputWidth, int nOutputHeight, int nComps, int nBpc, uint32_t nPitch)
pdfium::raw_span< uint8_t > m_pLastScanline
bool SkipToScanline(int line, PauseIndicatorIface *pPause)
virtual uint32_t GetSrcOffset()=0
pdfium::span< const uint8_t > GetScanline(int line)
virtual bool Rewind()=0
bool operator==(const char *ptr) const
bool operator!=(const char *ptr) const
Definition bytestring.h:65
#define UNSAFE_TODO(...)
constexpr size_t kHugeImageSize
Definition cpdf_dib.h:39
FXCODEC_STATUS
CFX_STemplate< int32_t > CFX_Size
uint32_t FX_ARGB
Definition fx_dib.h:36
#define FXARGB_B(argb)
Definition fx_dib.h:199
#define FXARGB_G(argb)
Definition fx_dib.h:198
#define FXARGB_R(argb)
Definition fx_dib.h:197
FXDIB_Format
Definition fx_dib.h:21
pdfium::CheckedNumeric< uint32_t > FX_SAFE_UINT32
fxcodec::Jbig2Decoder Jbig2Decoder
fxcodec::Jbig2Context Jbig2Context
fxcodec::JpegModule JpegModule
Definition jpegmodule.h:64
std::optional< uint32_t > CalculatePitch8(uint32_t bits_per_component, uint32_t components_per_pixel, int width_in_pixels)
std::optional< uint32_t > CalculatePitch32(int bits_per_pixel, int width_in_pixels)
uint32_t CalculatePitch8OrDie(uint32_t bits_per_component, uint32_t components_per_pixel, int width_in_pixels)
uint32_t CalculatePitch32OrDie(int bits_per_pixel, int width_in_pixels)
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition retain_ptr.h:222
fxcodec::ScanlineDecoder ScanlineDecoder
float m_DecodeStep
Definition cpdf_dib.h:29
int m_ColorKeyMin
Definition cpdf_dib.h:30
int m_ColorKeyMax
Definition cpdf_dib.h:31
float m_DecodeMin
Definition cpdf_dib.h:28