7#ifndef CORE_FXGE_WIN32_CFX_PSRENDERER_H_
8#define CORE_FXGE_WIN32_CFX_PSRENDERER_H_
17#include "core/fxcrt/bytestring.h"
18#include "core/fxcrt/data_vector.h"
19#include "core/fxcrt/fx_coordinates.h"
20#include "core/fxcrt/fx_memory_wrappers.h"
21#include "core/fxcrt/fx_stream.h"
22#include "core/fxcrt/fx_string_wrappers.h"
23#include "core/fxcrt/retain_ptr.h"
24#include "core/fxcrt/unowned_ptr.h"
25#include "core/fxge/cfx_graphstatedata.h"
26#include "third_party/abseil-cpp/absl/types/optional.h"
27#include "third_party/base/containers/span.h"
39 DataVector<uint8_t> (*pA85EncodeFunc)(pdfium::span<
const uint8_t> src_span);
41 DataVector<uint8_t> (*pFlateEncodeFunc)(pdfium::span<
const uint8_t> src_span);
45 DataVector<uint8_t> (*pRunLengthEncodeFunc)(
46 pdfium::span<
const uint8_t> src_span);
78 uint32_t stroke_color,
103 const ByteString& psname,
104 pdfium::span<
const uint8_t> font_data);
107 const ByteString& psname,
110 size_t glyphs_per_descendant_font);
115 struct FaxCompressResult {
117 FaxCompressResult(
const FaxCompressResult&) =
delete;
118 FaxCompressResult& operator=(
const FaxCompressResult&) =
delete;
119 FaxCompressResult(FaxCompressResult&&)
noexcept;
120 FaxCompressResult& operator=(FaxCompressResult&&)
noexcept;
121 ~FaxCompressResult();
123 DataVector<uint8_t> data;
124 bool compressed =
false;
127 struct PSCompressResult {
129 PSCompressResult(
const PSCompressResult&) =
delete;
130 PSCompressResult& operator=(
const PSCompressResult&) =
delete;
131 PSCompressResult(PSCompressResult&&)
noexcept;
132 PSCompressResult& operator=(PSCompressResult&&)
noexcept;
135 DataVector<uint8_t> data;
139 void StartRendering();
143 void SetColor(uint32_t color);
144 void FindPSFontGlyph(CFX_GlyphCache* pGlyphCache,
149 void DrawTextAsType3Font(
int char_count,
153 fxcrt::ostringstream& buf);
154 bool DrawTextAsType42Font(
int char_count,
158 fxcrt::ostringstream& buf);
160 absl::optional<PSCompressResult> PSCompressData(
161 pdfium::span<
const uint8_t> src_span)
const;
162 void WritePreambleString(ByteStringView str);
163 void WritePSBinary(pdfium::span<
const uint8_t> data);
164 void WriteStream(fxcrt::ostringstream& stream);
165 void WriteString(ByteStringView str);
167 bool m_bInited =
false;
168 bool m_bGraphStateSet =
false;
169 bool m_bColorSet =
false;
170 absl::optional<RenderingLevel> m_Level;
171 uint32_t m_LastColor = 0;
177 std::vector<std::unique_ptr<Glyph>> m_PSFontList;
178 fxcrt::ostringstream m_PreambleOutput;
179 fxcrt::ostringstream m_Output;
180 std::vector<FX_RECT> m_ClipBoxStack;
WindowsPrintMode g_pdfium_print_mode
@ kPostScript3Type42PassThrough
@ kPostScript3PassThrough
@ kPostScript2PassThrough
bool DrawDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t color, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options)
void SetClip_PathStroke(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState)
bool StretchDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FXDIB_ResampleOptions &options)
static absl::optional< ByteString > GenerateType42SfntDataForTesting(const ByteString &psname, pdfium::span< const uint8_t > font_data)
bool DrawText(int nChars, const TextCharPos *pCharPos, CFX_Font *pFont, const CFX_Matrix &mtObject2Device, float font_size, uint32_t color)
static ByteString GenerateType42FontDictionaryForTesting(const ByteString &psname, const FX_RECT &bbox, size_t num_glyphs, size_t glyphs_per_descendant_font)
CFX_PSRenderer(CFX_PSFontTracker *font_tracker, const EncoderIface *encoder_iface)
void SetClip_PathFill(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_FillRenderOptions &fill_options)
void Init(const RetainPtr< IFX_RetainableWriteStream > &stream, RenderingLevel level, int width, int height)
bool DrawPath(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, const CFX_FillRenderOptions &fill_options)
void RestoreState(bool bKeepSaved)
bool SetDIBits(const RetainPtr< const CFX_DIBBase > &pBitmap, uint32_t color, int dest_left, int dest_top)
CFX_WindowsRenderDevice(HDC hDC, CFX_PSFontTracker *ps_font_tracker, const EncoderIface *encoder_iface)
~CFX_WindowsRenderDevice() override
~CPDF_WindowsRenderDevice() override
CPDF_WindowsRenderDevice(HDC hDC, CFX_PSFontTracker *ps_font_tracker)
bool(* pJpegEncodeFunc)(const RetainPtr< const CFX_DIBBase > &pSource, uint8_t **dest_buf, size_t *dest_size)