summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/win32/fx_win32_print.cpp89
1 files changed, 0 insertions, 89 deletions
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index b5e36202ba..0e89e71889 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -16,95 +16,6 @@
#include "core/fxge/include/fx_ge_win32.h"
#include "core/fxge/win32/win32_int.h"
-namespace {
-
-CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc,
- const CFX_Matrix* pDestMatrix) {
- ASSERT(pSrc->GetFormat() == FXDIB_1bppRgb ||
- pSrc->GetFormat() == FXDIB_1bppMask ||
- pSrc->GetFormat() == FXDIB_1bppCmyk);
- CFX_DIBExtractor src_bitmap(pSrc);
- CFX_DIBitmap* pSrcBitmap = src_bitmap;
- if (!pSrcBitmap)
- return nullptr;
-
- int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight();
- uint8_t* src_buf = pSrcBitmap->GetBuffer();
- uint32_t src_pitch = pSrcBitmap->GetPitch();
- FX_FLOAT dest_area = pDestMatrix->GetUnitArea();
- FX_FLOAT area_scale = ((FX_FLOAT)(src_width * src_height)) / dest_area;
- FX_FLOAT size_scale = FXSYS_sqrt(area_scale);
- CFX_Matrix adjusted_matrix(*pDestMatrix);
- adjusted_matrix.Scale(size_scale, size_scale);
- CFX_FloatRect result_rect_f = adjusted_matrix.GetUnitRect();
- FX_RECT result_rect = result_rect_f.GetOutterRect();
- CFX_Matrix src2result;
- src2result.e = adjusted_matrix.c + adjusted_matrix.e;
- src2result.f = adjusted_matrix.d + adjusted_matrix.f;
- src2result.a = adjusted_matrix.a / pSrcBitmap->GetWidth();
- src2result.b = adjusted_matrix.b / pSrcBitmap->GetWidth();
- src2result.c = -adjusted_matrix.c / pSrcBitmap->GetHeight();
- src2result.d = -adjusted_matrix.d / pSrcBitmap->GetHeight();
- src2result.TranslateI(-result_rect.left, -result_rect.top);
- CFX_Matrix result2src;
- result2src.SetReverse(src2result);
- CPDF_FixedMatrix result2src_fix(result2src, 8);
- int result_width = result_rect.Width();
- int result_height = result_rect.Height();
- std::unique_ptr<CFX_DIBitmap> pTempBitmap(new CFX_DIBitmap);
- if (!pTempBitmap->Create(result_width, result_height, pSrc->GetFormat())) {
- if (pSrcBitmap != src_bitmap)
- delete pSrcBitmap;
- return nullptr;
- }
-
- pTempBitmap->CopyPalette(pSrc->GetPalette());
- uint8_t* dest_buf = pTempBitmap->GetBuffer();
- int dest_pitch = pTempBitmap->GetPitch();
- FXSYS_memset(dest_buf, pSrc->IsAlphaMask() ? 0 : 0xff,
- dest_pitch * result_height);
- if (pSrcBitmap->IsAlphaMask()) {
- for (int dest_y = 0; dest_y < result_height; dest_y++) {
- uint8_t* dest_scan = dest_buf + dest_y * dest_pitch;
- for (int dest_x = 0; dest_x < result_width; dest_x++) {
- int src_x, src_y;
- result2src_fix.Transform(dest_x, dest_y, src_x, src_y);
- if (src_x < 0 || src_x >= src_width || src_y < 0 ||
- src_y >= src_height) {
- continue;
- }
- if (!((src_buf + src_pitch * src_y)[src_x / 8] &
- (1 << (7 - src_x % 8)))) {
- continue;
- }
- dest_scan[dest_x / 8] |= 1 << (7 - dest_x % 8);
- }
- }
- } else {
- for (int dest_y = 0; dest_y < result_height; dest_y++) {
- uint8_t* dest_scan = dest_buf + dest_y * dest_pitch;
- for (int dest_x = 0; dest_x < result_width; dest_x++) {
- int src_x, src_y;
- result2src_fix.Transform(dest_x, dest_y, src_x, src_y);
- if (src_x < 0 || src_x >= src_width || src_y < 0 ||
- src_y >= src_height) {
- continue;
- }
- if ((src_buf + src_pitch * src_y)[src_x / 8] & (1 << (7 - src_x % 8))) {
- continue;
- }
- dest_scan[dest_x / 8] &= ~(1 << (7 - dest_x % 8));
- }
- }
- }
- if (pSrcBitmap != src_bitmap)
- delete pSrcBitmap;
-
- return pTempBitmap.release();
-}
-
-} // namespace
-
CGdiPrinterDriver::CGdiPrinterDriver(HDC hDC)
: CGdiDeviceDriver(hDC, FXDC_PRINTER),
m_HorzSize(::GetDeviceCaps(m_hDC, HORZSIZE)),