7#include "core/fxge/win32/cps_printer_driver.h"
14#include "core/fxcrt/data_vector.h"
15#include "core/fxcrt/fx_system.h"
16#include "core/fxcrt/retain_ptr.h"
17#include "core/fxge/cfx_fillrenderoptions.h"
18#include "core/fxge/cfx_path.h"
19#include "core/fxge/dib/cfx_dibbase.h"
20#include "core/fxge/dib/cfx_imagerenderer.h"
21#include "core/fxge/win32/cpsoutput.h"
22#include "third_party/base/check.h"
23#include "third_party/base/notreached.h"
41 NOTREACHED_NORETURN();
53 RenderingLevelFromWindowsPrintMode(mode);
61 m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE);
62 m_VertSize = ::GetDeviceCaps(m_hDC, VERTSIZE);
63 m_Width = ::GetDeviceCaps(m_hDC, HORZRES);
64 m_Height = ::GetDeviceCaps(m_hDC, VERTRES);
65 m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL);
67 m_PSRenderer.Init(pdfium::MakeRetain<CPSOutput>(m_hDC, output_mode), level,
69 HRGN hRgn = ::CreateRectRgn(0, 0, 1, 1);
70 if (::GetClipRgn(m_hDC, hRgn) == 1) {
71 DWORD dwCount = ::GetRegionData(hRgn, 0,
nullptr);
73 DataVector<uint8_t> buffer(dwCount);
74 RGNDATA* pData =
reinterpret_cast<RGNDATA*>(buffer.data());
75 if (::GetRegionData(hRgn, dwCount, pData)) {
77 for (uint32_t i = 0; i < pData->rdh.nCount; i++) {
79 reinterpret_cast<RECT*>(pData->Buffer + pData->rdh.nRgnSize * i);
81 static_cast<
float>(pRect->bottom)
,
82 static_cast<
float>(pRect->right)
,
83 static_cast<
float>(pRect->top)
);
85 m_PSRenderer.SetClip_PathFill(path,
nullptr,
86 CFX_FillRenderOptions::WindingOptions());
106 return m_nBitsPerPixel;
114 NOTREACHED_NORETURN();
119 m_PSRenderer.SaveState();
123 m_PSRenderer.RestoreState(bKeepSaved);
130 m_PSRenderer.SetClip_PathFill(path, pObject2Device, fill_options);
138 m_PSRenderer.SetClip_PathStroke(path, pObject2Device, pGraphState);
146 FX_ARGB stroke_color,
151 return m_PSRenderer.DrawPath(path, pObject2Device, pGraphState, fill_color,
152 stroke_color, fill_options);
156 *pRect = m_PSRenderer.GetClipBox();
168 return m_PSRenderer.SetDIBits(pBitmap, color, left, top);
180 return blend_type == BlendMode::kNormal &&
181 m_PSRenderer.StretchDIBits(std::move(bitmap), color, dest_left,
182 dest_top, dest_width, dest_height, options);
190 std::unique_ptr<CFX_ImageRenderer>* handle,
197 return m_PSRenderer.DrawDIBits(std::move(bitmap), color, matrix, options);
207 return m_PSRenderer.DrawText(pCharPos.size(), pCharPos.data(), pFont,
208 mtObject2Device, font_size, color);
214 NOTREACHED_NORETURN();
221 NOTREACHED_NORETURN();
@ kPostScript3Type42PassThrough
@ kPostScript3PassThrough
@ kPostScript2PassThrough
void AppendRect(float left, float bottom, float right, float top)
bool SetClip_PathFill(const CFX_Path &paath, const CFX_Matrix *pObject2Device, const CFX_FillRenderOptions &fill_options) override
bool StretchDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT *pClipRect, const FXDIB_ResampleOptions &options, BlendMode blend_type) override
CPSPrinterDriver(HDC hDC, WindowsPrintMode mode, CFX_PSFontTracker *ps_font_tracker, const EncoderIface *encoder_iface)
bool MultiplyAlphaMask(const RetainPtr< const CFX_DIBBase > &mask) override
bool GetClipBox(FX_RECT *pRect) override
bool SetDIBits(const RetainPtr< const CFX_DIBBase > &pBitmap, uint32_t color, const FX_RECT &src_rect, int left, int top, BlendMode blend_type) override
~CPSPrinterDriver() override
int GetDeviceCaps(int caps_id) const override
bool DrawDeviceText(pdfium::span< const TextCharPos > pCharPos, CFX_Font *pFont, const CFX_Matrix &mtObject2Device, float font_size, uint32_t color, const CFX_TextRenderOptions &options) override
bool MultiplyAlpha(float alpha) override
void SaveState() override
bool SetClip_PathStroke(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState) override
bool StartDIBits(RetainPtr< const CFX_DIBBase > bitmap, float alpha, uint32_t color, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, std::unique_ptr< CFX_ImageRenderer > *handle, BlendMode blend_type) override
DeviceType GetDeviceType() const override
void RestoreState(bool bKeepSaved) override
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, BlendMode blend_type) override
#define FXDC_PIXEL_HEIGHT