Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: core/src/fxge/win32/fx_win32_print.cpp

Issue 1171733003: Remove typdefs for pointer types in fx_system.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual fixes. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/win32/fx_win32_gdipext.cpp ('k') | core/src/fxge/win32/win32_int.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
9 #include <windows.h> 9 #include <windows.h>
10 #include "../../../include/fxge/fx_ge_win32.h" 10 #include "../../../include/fxge/fx_ge_win32.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect(); 114 CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect();
115 FX_RECT full_rect = unit_rect.GetOutterRect(); 115 FX_RECT full_rect = unit_rect.GetOutterRect();
116 int full_left = full_rect.left; 116 int full_left = full_rect.left;
117 int full_top = full_rect.top; 117 int full_top = full_rect.top;
118 CFX_DIBExtractor src_bitmap(pSrc); 118 CFX_DIBExtractor src_bitmap(pSrc);
119 CFX_DIBitmap* pSrcBitmap = src_bitmap; 119 CFX_DIBitmap* pSrcBitmap = src_bitmap;
120 if (pSrcBitmap == NULL) { 120 if (pSrcBitmap == NULL) {
121 return NULL; 121 return NULL;
122 } 122 }
123 int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight() ; 123 int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight() ;
124 FX_LPBYTE src_buf = pSrcBitmap->GetBuffer(); 124 uint8_t* src_buf = pSrcBitmap->GetBuffer();
125 FX_DWORD src_pitch = pSrcBitmap->GetPitch(); 125 FX_DWORD src_pitch = pSrcBitmap->GetPitch();
126 FX_FLOAT dest_area = pDestMatrix->GetUnitArea(); 126 FX_FLOAT dest_area = pDestMatrix->GetUnitArea();
127 FX_FLOAT area_scale = FXSYS_Div((FX_FLOAT)(src_width * src_height), dest_are a); 127 FX_FLOAT area_scale = FXSYS_Div((FX_FLOAT)(src_width * src_height), dest_are a);
128 FX_FLOAT size_scale = FXSYS_sqrt(area_scale); 128 FX_FLOAT size_scale = FXSYS_sqrt(area_scale);
129 CFX_AffineMatrix adjusted_matrix(*pDestMatrix); 129 CFX_AffineMatrix adjusted_matrix(*pDestMatrix);
130 adjusted_matrix.Scale(size_scale, size_scale); 130 adjusted_matrix.Scale(size_scale, size_scale);
131 CFX_FloatRect result_rect_f = adjusted_matrix.GetUnitRect(); 131 CFX_FloatRect result_rect_f = adjusted_matrix.GetUnitRect();
132 FX_RECT result_rect = result_rect_f.GetOutterRect(); 132 FX_RECT result_rect = result_rect_f.GetOutterRect();
133 CFX_AffineMatrix src2result; 133 CFX_AffineMatrix src2result;
134 src2result.e = adjusted_matrix.c + adjusted_matrix.e; 134 src2result.e = adjusted_matrix.c + adjusted_matrix.e;
(...skipping 10 matching lines...) Expand all
145 int result_height = result_rect.Height(); 145 int result_height = result_rect.Height();
146 CFX_DIBitmap* pTempBitmap = new CFX_DIBitmap; 146 CFX_DIBitmap* pTempBitmap = new CFX_DIBitmap;
147 if (!pTempBitmap->Create(result_width, result_height, pSrc->GetFormat())) { 147 if (!pTempBitmap->Create(result_width, result_height, pSrc->GetFormat())) {
148 delete pTempBitmap; 148 delete pTempBitmap;
149 if (pSrcBitmap != src_bitmap) { 149 if (pSrcBitmap != src_bitmap) {
150 delete pSrcBitmap; 150 delete pSrcBitmap;
151 } 151 }
152 return NULL; 152 return NULL;
153 } 153 }
154 pTempBitmap->CopyPalette(pSrc->GetPalette()); 154 pTempBitmap->CopyPalette(pSrc->GetPalette());
155 FX_LPBYTE dest_buf = pTempBitmap->GetBuffer(); 155 uint8_t* dest_buf = pTempBitmap->GetBuffer();
156 int dest_pitch = pTempBitmap->GetPitch(); 156 int dest_pitch = pTempBitmap->GetPitch();
157 FXSYS_memset8(dest_buf, pSrc->IsAlphaMask() ? 0 : 0xff, dest_pitch * result_ height); 157 FXSYS_memset8(dest_buf, pSrc->IsAlphaMask() ? 0 : 0xff, dest_pitch * result_ height);
158 if (pSrcBitmap->IsAlphaMask()) { 158 if (pSrcBitmap->IsAlphaMask()) {
159 for (int dest_y = 0; dest_y < result_height; dest_y ++) { 159 for (int dest_y = 0; dest_y < result_height; dest_y ++) {
160 FX_LPBYTE dest_scan = dest_buf + dest_y * dest_pitch; 160 uint8_t* dest_scan = dest_buf + dest_y * dest_pitch;
161 for (int dest_x = 0; dest_x < result_width; dest_x ++) { 161 for (int dest_x = 0; dest_x < result_width; dest_x ++) {
162 int src_x, src_y; 162 int src_x, src_y;
163 result2src_fix.Transform(dest_x, dest_y, src_x, src_y); 163 result2src_fix.Transform(dest_x, dest_y, src_x, src_y);
164 if (src_x < 0 || src_x >= src_width || src_y < 0 || src_y >= src _height) { 164 if (src_x < 0 || src_x >= src_width || src_y < 0 || src_y >= src _height) {
165 continue; 165 continue;
166 } 166 }
167 if (!((src_buf + src_pitch * src_y)[src_x / 8] & (1 << (7 - src_ x % 8)))) { 167 if (!((src_buf + src_pitch * src_y)[src_x / 8] & (1 << (7 - src_ x % 8)))) {
168 continue; 168 continue;
169 } 169 }
170 dest_scan[dest_x / 8] |= 1 << (7 - dest_x % 8); 170 dest_scan[dest_x / 8] |= 1 << (7 - dest_x % 8);
171 } 171 }
172 } 172 }
173 } else { 173 } else {
174 for (int dest_y = 0; dest_y < result_height; dest_y ++) { 174 for (int dest_y = 0; dest_y < result_height; dest_y ++) {
175 FX_LPBYTE dest_scan = dest_buf + dest_y * dest_pitch; 175 uint8_t* dest_scan = dest_buf + dest_y * dest_pitch;
176 for (int dest_x = 0; dest_x < result_width; dest_x ++) { 176 for (int dest_x = 0; dest_x < result_width; dest_x ++) {
177 int src_x, src_y; 177 int src_x, src_y;
178 result2src_fix.Transform(dest_x, dest_y, src_x, src_y); 178 result2src_fix.Transform(dest_x, dest_y, src_x, src_y);
179 if (src_x < 0 || src_x >= src_width || src_y < 0 || src_y >= src _height) { 179 if (src_x < 0 || src_x >= src_width || src_y < 0 || src_y >= src _height) {
180 continue; 180 continue;
181 } 181 }
182 if ((src_buf + src_pitch * src_y)[src_x / 8] & (1 << (7 - src_x % 8))) { 182 if ((src_buf + src_pitch * src_y)[src_x / 8] & (1 << (7 - src_x % 8))) {
183 continue; 183 continue;
184 } 184 }
185 dest_scan[dest_x / 8] &= ~(1 << (7 - dest_x % 8)); 185 dest_scan[dest_x / 8] &= ~(1 << (7 - dest_x % 8));
186 } 186 }
187 } 187 }
188 } 188 }
189 if (pSrcBitmap != src_bitmap) { 189 if (pSrcBitmap != src_bitmap) {
190 delete pSrcBitmap; 190 delete pSrcBitmap;
191 } 191 }
192 return pTempBitmap; 192 return pTempBitmap;
193 } 193 }
194 FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_ alpha, FX_DWORD color, 194 FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_ alpha, FX_DWORD color,
195 const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, 195 const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle,
196 int alpha_flag, void* pIccTransform, int blend_type) 196 int alpha_flag, void* pIccTransform, int blend_type)
197 { 197 {
198 if (bitmap_alpha < 255 || pSource->HasAlpha() || (pSource->IsAlphaMask() && (pSource->GetBPP() != 1 || !m_bSupportROP))) { 198 if (bitmap_alpha < 255 || pSource->HasAlpha() || (pSource->IsAlphaMask() && (pSource->GetBPP() != 1 || !m_bSupportROP))) {
199 return FALSE; 199 return FALSE;
200 } 200 }
201 CFX_FloatRect unit_rect = pMatrix->GetUnitRect(); 201 CFX_FloatRect unit_rect = pMatrix->GetUnitRect();
202 FX_RECT full_rect = unit_rect.GetOutterRect(); 202 FX_RECT full_rect = unit_rect.GetOutterRect();
203 if (FXSYS_fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 && FXSYS_fabs(pMatrix-> c) < 0.5f && pMatrix->d != 0) { 203 if (FXSYS_fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 && FXSYS_fabs(pMatrix-> c) < 0.5f && pMatrix->d != 0) {
204 FX_BOOL bFlipX = pMatrix->a < 0; 204 FX_BOOL bFlipX = pMatrix->a < 0;
205 FX_BOOL bFlipY = pMatrix->d > 0; 205 FX_BOOL bFlipY = pMatrix->d > 0;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 CPSOutput::~CPSOutput() 243 CPSOutput::~CPSOutput()
244 { 244 {
245 if (m_pBuf) { 245 if (m_pBuf) {
246 FX_Free(m_pBuf); 246 FX_Free(m_pBuf);
247 } 247 }
248 } 248 }
249 void CPSOutput::Init() 249 void CPSOutput::Init()
250 { 250 {
251 m_pBuf = FX_Alloc(FX_CHAR, 1026); 251 m_pBuf = FX_Alloc(FX_CHAR, 1026);
252 } 252 }
253 void CPSOutput::OutputPS(FX_LPCSTR string, int len) 253 void CPSOutput::OutputPS(const FX_CHAR* string, int len)
254 { 254 {
255 if (len < 0) { 255 if (len < 0) {
256 len = (int)FXSYS_strlen(string); 256 len = (int)FXSYS_strlen(string);
257 } 257 }
258 int sent_len = 0; 258 int sent_len = 0;
259 while (len > 0) { 259 while (len > 0) {
260 int send_len = len > 1024 ? 1024 : len; 260 int send_len = len > 1024 ? 1024 : len;
261 *(FX_WORD*)m_pBuf = send_len; 261 *(FX_WORD*)m_pBuf = send_len;
262 FXSYS_memcpy(m_pBuf + 2, string + sent_len, send_len); 262 FXSYS_memcpy(m_pBuf + 2, string + sent_len, send_len);
263 int ret = ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, m_pBuf, 0, NULL); 263 int ret = ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, m_pBuf, 0, NULL);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 FX_BOOL CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD c olor, int dest_left, int dest_top, 386 FX_BOOL CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD c olor, int dest_left, int dest_top,
387 int dest_width, int dest_height, const F X_RECT* pClipRect, FX_DWORD flags, 387 int dest_width, int dest_height, const F X_RECT* pClipRect, FX_DWORD flags,
388 int alpha_flag, void* pIccTransform, int blend_type) 388 int alpha_flag, void* pIccTransform, int blend_type)
389 { 389 {
390 if (blend_type != FXDIB_BLEND_NORMAL) { 390 if (blend_type != FXDIB_BLEND_NORMAL) {
391 return FALSE; 391 return FALSE;
392 } 392 }
393 return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top, dest_ width, dest_height, flags, alpha_flag, pIccTransform); 393 return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top, dest_ width, dest_height, flags, alpha_flag, pIccTransform);
394 } 394 }
395 FX_BOOL CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_a lpha, FX_DWORD color, 395 FX_BOOL CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_a lpha, FX_DWORD color,
396 const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, FX_LPVOID& handle, 396 const CFX_AffineMatrix* pMatrix, FX_DWORD render_flags, void*& handle,
397 int alpha_flag, void* pIccTransform, int b lend_type) 397 int alpha_flag, void* pIccTransform, int b lend_type)
398 { 398 {
399 if (blend_type != FXDIB_BLEND_NORMAL) { 399 if (blend_type != FXDIB_BLEND_NORMAL) {
400 return FALSE; 400 return FALSE;
401 } 401 }
402 if (bitmap_alpha < 255) { 402 if (bitmap_alpha < 255) {
403 return FALSE; 403 return FALSE;
404 } 404 }
405 handle = NULL; 405 handle = NULL;
406 return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags, alpha_ flag, pIccTransform); 406 return m_PSRenderer.DrawDIBits(pBitmap, color, pMatrix, render_flags, alpha_ flag, pIccTransform);
407 } 407 }
408 FX_BOOL CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pChar Pos, CFX_Font* pFont, 408 FX_BOOL CPSPrinterDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pChar Pos, CFX_Font* pFont,
409 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, 409 CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, FX_FLOAT font_size, FX_DWORD color,
410 int alpha_flag, void* pIccTransform) 410 int alpha_flag, void* pIccTransform)
411 { 411 {
412 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device , font_size, color, alpha_flag, pIccTransform); 412 return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device , font_size, color, alpha_flag, pIccTransform);
413 } 413 }
414 #endif 414 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/win32/fx_win32_gdipext.cpp ('k') | core/src/fxge/win32/win32_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698