 Chromium Code Reviews
 Chromium Code Reviews Issue 2612243005:
  Add postscript path  (Closed)
    
  
    Issue 2612243005:
  Add postscript path  (Closed) 
  | OLD | NEW | 
|---|---|
| 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 "core/fxge/win32/cfx_psrenderer.h" | 7 #include "core/fxge/win32/cfx_psrenderer.h" | 
| 8 | 8 | 
| 9 #include <memory> | 9 #include <memory> | 
| 10 | 10 | 
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 m_bInited = false; | 36 m_bInited = false; | 
| 37 } | 37 } | 
| 38 | 38 | 
| 39 CFX_PSRenderer::~CFX_PSRenderer() { | 39 CFX_PSRenderer::~CFX_PSRenderer() { | 
| 40 for (int i = 0; i < static_cast<int>(m_PSFontList.GetSize()); i++) { | 40 for (int i = 0; i < static_cast<int>(m_PSFontList.GetSize()); i++) { | 
| 41 CPSFont* pFont = m_PSFontList[i]; | 41 CPSFont* pFont = m_PSFontList[i]; | 
| 42 delete pFont; | 42 delete pFont; | 
| 43 } | 43 } | 
| 44 } | 44 } | 
| 45 | 45 | 
| 46 #define OUTPUT_PS(str) m_pOutput->OutputPS(str, sizeof str - 1) | 46 #define OUTPUT_PS(str) m_pOutput->OutputPS(str, sizeof(str) - 1) | 
| 47 | 47 | 
| 48 void CFX_PSRenderer::Init(CPSOutput* pOutput, | 48 void CFX_PSRenderer::Init(CPSOutput* pOutput, | 
| 49 int pslevel, | 49 int pslevel, | 
| 50 int width, | 50 int width, | 
| 51 int height, | 51 int height, | 
| 52 bool bCmykOutput) { | 52 bool bCmykOutput) { | 
| 53 m_PSLevel = pslevel; | 53 m_PSLevel = pslevel; | 
| 54 m_pOutput = pOutput; | 54 m_pOutput = pOutput; | 
| 55 m_ClipBox.left = m_ClipBox.top = 0; | 55 m_ClipBox.left = m_ClipBox.top = 0; | 
| 56 m_ClipBox.right = width; | 56 m_ClipBox.right = width; | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 FX_FLOAT y = pPathData->GetPointY(i); | 123 FX_FLOAT y = pPathData->GetPointY(i); | 
| 124 if (pObject2Device) { | 124 if (pObject2Device) { | 
| 125 pObject2Device->Transform(x, y); | 125 pObject2Device->Transform(x, y); | 
| 126 } | 126 } | 
| 127 buf << x << " " << y; | 127 buf << x << " " << y; | 
| 128 switch (flag & FXPT_TYPE) { | 128 switch (flag & FXPT_TYPE) { | 
| 129 case FXPT_MOVETO: | 129 case FXPT_MOVETO: | 
| 130 buf << " m "; | 130 buf << " m "; | 
| 131 break; | 131 break; | 
| 132 case FXPT_LINETO: | 132 case FXPT_LINETO: | 
| 133 if (flag & FXPT_CLOSEFIGURE) { | 133 buf << " l "; | 
| 134 buf << " l h "; | 134 if (flag & FXPT_CLOSEFIGURE) | 
| 135 } else { | 135 buf << "h "; | 
| 136 buf << " l "; | |
| 137 } | |
| 138 break; | 136 break; | 
| 139 case FXPT_BEZIERTO: { | 137 case FXPT_BEZIERTO: { | 
| 140 FX_FLOAT x1 = pPathData->GetPointX(i + 1); | 138 FX_FLOAT x1 = pPathData->GetPointX(i + 1); | 
| 141 FX_FLOAT x2 = pPathData->GetPointX(i + 2); | 139 FX_FLOAT x2 = pPathData->GetPointX(i + 2); | 
| 142 FX_FLOAT y1 = pPathData->GetPointY(i + 1); | 140 FX_FLOAT y1 = pPathData->GetPointY(i + 1); | 
| 143 FX_FLOAT y2 = pPathData->GetPointY(i + 2); | 141 FX_FLOAT y2 = pPathData->GetPointY(i + 2); | 
| 144 if (pObject2Device) { | 142 if (pObject2Device) { | 
| 145 pObject2Device->Transform(x1, y1); | 143 pObject2Device->Transform(x1, y1); | 
| 146 pObject2Device->Transform(x2, y2); | 144 pObject2Device->Transform(x2, y2); | 
| 147 } | 145 } | 
| 148 buf << " " << x1 << " " << y1 << " " << x2 << " " << y2; | 146 buf << " " << x1 << " " << y1 << " " << x2 << " " << y2 << " c"; | 
| 149 if (flag & FXPT_CLOSEFIGURE) { | 147 if (flag & FXPT_CLOSEFIGURE) | 
| 150 buf << " c h\n"; | 148 buf << " h"; | 
| 151 } else { | 149 buf << "\n"; | 
| 152 buf << " c\n"; | |
| 153 } | |
| 154 i += 2; | 150 i += 2; | 
| 155 break; | 151 break; | 
| 156 } | 152 } | 
| 157 } | 153 } | 
| 158 } | 154 } | 
| 159 m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); | 155 m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); | 
| 160 } | 156 } | 
| 161 | 157 | 
| 162 void CFX_PSRenderer::SetClip_PathFill(const CFX_PathData* pPathData, | 158 void CFX_PSRenderer::SetClip_PathFill(const CFX_PathData* pPathData, | 
| 163 const CFX_Matrix* pObject2Device, | 159 const CFX_Matrix* pObject2Device, | 
| 164 int fill_mode) { | 160 int fill_mode) { | 
| 165 StartRendering(); | 161 StartRendering(); | 
| 166 OutputPath(pPathData, pObject2Device); | 162 OutputPath(pPathData, pObject2Device); | 
| 167 CFX_FloatRect rect = pPathData->GetBoundingBox(); | 163 CFX_FloatRect rect = pPathData->GetBoundingBox(); | 
| 168 if (pObject2Device) { | 164 if (pObject2Device) | 
| 169 rect.Transform(pObject2Device); | 165 rect.Transform(pObject2Device); | 
| 170 } | 166 m_ClipBox.left = static_cast<int>(rect.left); | 
| 171 m_ClipBox.Intersect(rect.GetOuterRect()); | 167 m_ClipBox.right = static_cast<int>(rect.left + rect.right); | 
| 168 m_ClipBox.top = static_cast<int>(rect.top + rect.bottom); | |
| 169 m_ClipBox.bottom = static_cast<int>(rect.bottom); | |
| 172 if ((fill_mode & 3) == FXFILL_WINDING) { | 170 if ((fill_mode & 3) == FXFILL_WINDING) { | 
| 173 OUTPUT_PS("W n\n"); | 171 OUTPUT_PS("W n\n"); | 
| 174 } else { | 172 } else { | 
| 175 OUTPUT_PS("W* n\n"); | 173 OUTPUT_PS("W* n\n"); | 
| 176 } | 174 } | 
| 177 } | 175 } | 
| 178 | 176 | 
| 179 void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData, | 177 void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData, | 
| 180 const CFX_Matrix* pObject2Device, | 178 const CFX_Matrix* pObject2Device, | 
| 181 const CFX_GraphStateData* pGraphState) { | 179 const CFX_GraphStateData* pGraphState) { | 
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 CFX_ByteTextBuf buf; | 259 CFX_ByteTextBuf buf; | 
| 262 if (!m_bGraphStateSet || | 260 if (!m_bGraphStateSet || | 
| 263 m_CurGraphState.m_LineCap != pGraphState->m_LineCap) { | 261 m_CurGraphState.m_LineCap != pGraphState->m_LineCap) { | 
| 264 buf << pGraphState->m_LineCap << " J\n"; | 262 buf << pGraphState->m_LineCap << " J\n"; | 
| 265 } | 263 } | 
| 266 if (!m_bGraphStateSet || | 264 if (!m_bGraphStateSet || | 
| 267 m_CurGraphState.m_DashCount != pGraphState->m_DashCount || | 265 m_CurGraphState.m_DashCount != pGraphState->m_DashCount || | 
| 268 FXSYS_memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray, | 266 FXSYS_memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray, | 
| 269 sizeof(FX_FLOAT) * m_CurGraphState.m_DashCount)) { | 267 sizeof(FX_FLOAT) * m_CurGraphState.m_DashCount)) { | 
| 270 buf << "["; | 268 buf << "["; | 
| 271 for (int i = 0; i < pGraphState->m_DashCount; i++) { | 269 for (int i = 0; i < pGraphState->m_DashCount; ++i) { | 
| 272 buf << pGraphState->m_DashArray[i] << " "; | 270 buf << pGraphState->m_DashArray[i] << " "; | 
| 273 } | 271 } | 
| 274 buf << "]" << pGraphState->m_DashPhase << " d\n"; | 272 buf << "]" << pGraphState->m_DashPhase << " d\n"; | 
| 275 } | 273 } | 
| 276 if (!m_bGraphStateSet || | 274 if (!m_bGraphStateSet || | 
| 277 m_CurGraphState.m_LineJoin != pGraphState->m_LineJoin) { | 275 m_CurGraphState.m_LineJoin != pGraphState->m_LineJoin) { | 
| 278 buf << pGraphState->m_LineJoin << " j\n"; | 276 buf << pGraphState->m_LineJoin << " j\n"; | 
| 279 } | 277 } | 
| 280 if (!m_bGraphStateSet || | 278 if (!m_bGraphStateSet || | 
| 281 m_CurGraphState.m_LineWidth != pGraphState->m_LineWidth) { | 279 m_CurGraphState.m_LineWidth != pGraphState->m_LineWidth) { | 
| 282 buf << pGraphState->m_LineWidth << " w\n"; | 280 buf << pGraphState->m_LineWidth << " w\n"; | 
| 283 } | 281 } | 
| 284 if (!m_bGraphStateSet || | 282 if (!m_bGraphStateSet || | 
| 285 m_CurGraphState.m_MiterLimit != pGraphState->m_MiterLimit) { | 283 m_CurGraphState.m_MiterLimit != pGraphState->m_MiterLimit) { | 
| 286 buf << pGraphState->m_MiterLimit << " M\n"; | 284 buf << pGraphState->m_MiterLimit << " M\n"; | 
| 287 } | 285 } | 
| 288 m_CurGraphState.Copy(*pGraphState); | 286 m_CurGraphState.Copy(*pGraphState); | 
| 289 m_bGraphStateSet = TRUE; | 287 m_bGraphStateSet = true; | 
| 290 if (buf.GetSize()) { | 288 if (buf.GetSize()) { | 
| 291 m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); | 289 m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); | 
| 292 } | 290 } | 
| 293 } | 291 } | 
| 294 | 292 | 
| 295 static void FaxCompressData(uint8_t* src_buf, | 293 static void FaxCompressData(uint8_t* src_buf, | 
| 296 int width, | 294 int width, | 
| 297 int height, | 295 int height, | 
| 298 std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf, | 296 std::unique_ptr<uint8_t, FxFreeDeleter>* dest_buf, | 
| 299 uint32_t* dest_size) { | 297 uint32_t* dest_size) { | 
| 300 if (width * height > 128) { | 298 if (width * height > 128) { | 
| 301 CCodec_FaxModule::FaxEncode(src_buf, width, height, (width + 7) / 8, | 299 CCodec_FaxModule::FaxEncode(src_buf, width, height, (width + 7) / 8, | 
| 302 dest_buf, dest_size); | 300 dest_buf, dest_size); | 
| 303 FX_Free(src_buf); | 301 FX_Free(src_buf); | 
| 304 } else { | 302 } else { | 
| 305 (*dest_buf).reset(src_buf); | 303 dest_buf->reset(src_buf); | 
| 306 *dest_size = (width + 7) / 8 * height; | 304 *dest_size = (width + 7) / 8 * height; | 
| 307 } | 305 } | 
| 308 } | 306 } | 
| 309 | 307 | 
| 310 static void PSCompressData(int PSLevel, | 308 static void PSCompressData(int PSLevel, | 
| 311 uint8_t* src_buf, | 309 uint8_t* src_buf, | 
| 312 uint32_t src_size, | 310 uint32_t src_size, | 
| 313 uint8_t** output_buf, | 311 uint8_t** output_buf, | 
| 314 uint32_t* output_size, | 312 uint32_t* output_size, | 
| 315 const FX_CHAR** filter) { | 313 const FX_CHAR** filter) { | 
| 316 *output_buf = src_buf; | 314 *output_buf = src_buf; | 
| 317 *output_size = src_size; | 315 *output_size = src_size; | 
| 318 *filter = ""; | 316 *filter = ""; | 
| 319 if (src_size < 1024) { | 317 if (src_size < 1024) { | 
| 320 return; | 318 return; | 
| 321 } | 319 } | 
| 322 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); | 320 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); | 
| 323 uint8_t* dest_buf = NULL; | 321 uint8_t* dest_buf = nullptr; | 
| 324 uint32_t dest_size = src_size; | 322 uint32_t dest_size = src_size; | 
| 325 if (PSLevel >= 3) { | 323 if (PSLevel >= 3) { | 
| 326 if (pEncoders && | 324 if (pEncoders && | 
| 327 pEncoders->GetFlateModule()->Encode(src_buf, src_size, &dest_buf, | 325 pEncoders->GetFlateModule()->Encode(src_buf, src_size, &dest_buf, | 
| 328 &dest_size)) { | 326 &dest_size)) { | 
| 329 *filter = "/FlateDecode filter "; | 327 *filter = "/FlateDecode filter "; | 
| 330 } | 328 } | 
| 331 } else { | 329 } else { | 
| 332 if (pEncoders && | 330 if (pEncoders && | 
| 333 pEncoders->GetBasicModule()->RunLengthEncode(src_buf, src_size, | 331 pEncoders->GetBasicModule()->RunLengthEncode(src_buf, src_size, | 
| 334 &dest_buf, &dest_size)) { | 332 &dest_buf, &dest_size)) { | 
| 335 *filter = "/RunLengthDecode filter "; | 333 *filter = "/RunLengthDecode filter "; | 
| 336 } | 334 } | 
| 337 } | 335 } | 
| 338 if (dest_size < src_size) { | 336 if (dest_size < src_size) { | 
| 339 *output_buf = dest_buf; | 337 *output_buf = dest_buf; | 
| 340 *output_size = dest_size; | 338 *output_size = dest_size; | 
| 341 } else { | 339 } else { | 
| 342 *filter = NULL; | 340 *filter = nullptr; | 
| 343 FX_Free(dest_buf); | 341 FX_Free(dest_buf); | 
| 344 } | 342 } | 
| 345 } | 343 } | 
| 346 | 344 | 
| 347 bool CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource, | 345 bool CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource, | 
| 348 uint32_t color, | 346 uint32_t color, | 
| 349 int left, | 347 int left, | 
| 350 int top) { | 348 int top) { | 
| 351 StartRendering(); | 349 StartRendering(); | 
| 352 CFX_Matrix matrix((FX_FLOAT)(pSource->GetWidth()), 0.0f, 0.0f, | 350 CFX_Matrix matrix((FX_FLOAT)(pSource->GetWidth()), 0.0f, 0.0f, | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 FaxCompressData(src_buf, width, height, &output_buf, &output_size); | 403 FaxCompressData(src_buf, width, height, &output_buf, &output_size); | 
| 406 if (pSource->IsAlphaMask()) { | 404 if (pSource->IsAlphaMask()) { | 
| 407 SetColor(color); | 405 SetColor(color); | 
| 408 m_bColorSet = false; | 406 m_bColorSet = false; | 
| 409 buf << " true["; | 407 buf << " true["; | 
| 410 } else { | 408 } else { | 
| 411 buf << " 1["; | 409 buf << " 1["; | 
| 412 } | 410 } | 
| 413 buf << width << " 0 0 -" << height << " 0 " << height | 411 buf << width << " 0 0 -" << height << " 0 " << height | 
| 414 << "]currentfile/ASCII85Decode filter "; | 412 << "]currentfile/ASCII85Decode filter "; | 
| 415 if (output_buf.get() != src_buf) | 413 if (output_buf.get() != src_buf) { | 
| 416 buf << "<</K -1/EndOfBlock false/Columns " << width << "/Rows " << height | 414 buf << "<</K -1/EndOfBlock false/Columns " << width << "/Rows " << height | 
| 417 << ">>/CCITTFaxDecode filter "; | 415 << ">>/CCITTFaxDecode filter "; | 
| 416 } | |
| 418 if (pSource->IsAlphaMask()) { | 417 if (pSource->IsAlphaMask()) { | 
| 419 buf << "iM\n"; | 418 buf << "iM\n"; | 
| 420 } else { | 419 } else { | 
| 421 buf << "false 1 colorimage\n"; | 420 buf << "false 1 colorimage\n"; | 
| 422 } | 421 } | 
| 423 m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); | 422 m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); | 
| 424 WritePSBinary(output_buf.get(), output_size); | 423 WritePSBinary(output_buf.get(), output_size); | 
| 425 output_buf.release(); | 424 output_buf.release(); | 
| 426 } else { | 425 } else { | 
| 427 CFX_MaybeOwned<CFX_DIBSource> pConverted((CFX_DIBSource*)pSource); | 426 CFX_DIBExtractor source_extractor(pSource); | 
| 427 CFX_MaybeOwned<CFX_DIBSource> pConverted(source_extractor.GetBitmap()); | |
| 428 if (!pConverted.Get()) | |
| 429 return false; | |
| 428 switch (pSource->GetFormat()) { | 430 switch (pSource->GetFormat()) { | 
| 429 case FXDIB_1bppRgb: | 431 case FXDIB_1bppRgb: | 
| 430 case FXDIB_Rgb32: | 432 case FXDIB_Rgb32: | 
| 431 pConverted = pSource->CloneConvert(FXDIB_Rgb); | 433 pConverted = pConverted->CloneConvert(FXDIB_Rgb).release(); | 
| 432 break; | 434 break; | 
| 433 case FXDIB_8bppRgb: | 435 case FXDIB_8bppRgb: | 
| 434 if (pSource->GetPalette()) { | 436 if (pSource->GetPalette()) { | 
| 435 pConverted = pSource->CloneConvert(FXDIB_Rgb); | 437 pConverted = pConverted->CloneConvert(FXDIB_Rgb).release(); | 
| 436 } | 438 } | 
| 437 break; | 439 break; | 
| 438 case FXDIB_1bppCmyk: | 440 case FXDIB_1bppCmyk: | 
| 439 pConverted = pSource->CloneConvert(FXDIB_Cmyk); | 441 pConverted = pConverted->CloneConvert(FXDIB_Cmyk).release(); | 
| 440 break; | 442 break; | 
| 441 case FXDIB_8bppCmyk: | 443 case FXDIB_8bppCmyk: | 
| 442 if (pSource->GetPalette()) { | 444 if (pSource->GetPalette()) { | 
| 443 pConverted = pSource->CloneConvert(FXDIB_Cmyk); | 445 pConverted = pConverted->CloneConvert(FXDIB_Cmyk).release(); | 
| 444 } | 446 } | 
| 445 break; | 447 break; | 
| 446 default: | 448 default: | 
| 447 break; | 449 break; | 
| 448 } | 450 } | 
| 449 if (!pConverted) { | 451 if (!pConverted) { | 
| 450 OUTPUT_PS("\nQ\n"); | 452 OUTPUT_PS("\nQ\n"); | 
| 451 return false; | 453 return false; | 
| 452 } | 454 } | 
| 453 int Bpp = pConverted->GetBPP() / 8; | 455 int bpp = pConverted->GetBPP() / 8; | 
| 454 uint8_t* output_buf = nullptr; | 456 uint8_t* output_buf = nullptr; | 
| 455 FX_STRSIZE output_size = 0; | 457 FX_STRSIZE output_size = 0; | 
| 456 const FX_CHAR* filter = nullptr; | 458 const FX_CHAR* filter = nullptr; | 
| 457 if (flags & FXRENDER_IMAGE_LOSSY) { | 459 if ((/*m_PSLevel == 2 || */ flags & FXRENDER_IMAGE_LOSSY) && | 
| 
Tom Sepez
2017/01/10 21:08:41
Just remove it, we have source control if we want
 
rbpotter
2017/01/11 20:34:49
This was actually commented out to test something,
 | |
| 458 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); | 460 CCodec_JpegModule::JpegEncode(pConverted.Get(), &output_buf, | 
| 459 if (pEncoders && | 461 &output_size)) { | 
| 460 pEncoders->GetJpegModule()->JpegEncode(pConverted.Get(), &output_buf, | 462 filter = "/DCTDecode filter "; | 
| 461 &output_size)) { | |
| 462 filter = "/DCTDecode filter "; | |
| 463 } | |
| 464 } | 463 } | 
| 465 if (!filter) { | 464 if (!filter) { | 
| 466 int src_pitch = width * Bpp; | 465 int src_pitch = width * bpp; | 
| 467 output_size = height * src_pitch; | 466 output_size = height * src_pitch; | 
| 468 output_buf = FX_Alloc(uint8_t, output_size); | 467 output_buf = FX_Alloc(uint8_t, output_size); | 
| 469 for (int row = 0; row < height; row++) { | 468 for (int row = 0; row < height; row++) { | 
| 470 const uint8_t* src_scan = pConverted->GetScanline(row); | 469 const uint8_t* src_scan = pConverted->GetScanline(row); | 
| 471 uint8_t* dest_scan = output_buf + row * src_pitch; | 470 uint8_t* dest_scan = output_buf + row * src_pitch; | 
| 472 if (Bpp == 3) { | 471 if (bpp == 3) { | 
| 473 for (int col = 0; col < width; col++) { | 472 for (int col = 0; col < width; col++) { | 
| 474 *dest_scan++ = src_scan[2]; | 473 *dest_scan++ = src_scan[2]; | 
| 475 *dest_scan++ = src_scan[1]; | 474 *dest_scan++ = src_scan[1]; | 
| 476 *dest_scan++ = *src_scan; | 475 *dest_scan++ = *src_scan; | 
| 477 src_scan += 3; | 476 src_scan += 3; | 
| 478 } | 477 } | 
| 479 } else { | 478 } else { | 
| 480 FXSYS_memcpy(dest_scan, src_scan, src_pitch); | 479 FXSYS_memcpy(dest_scan, src_scan, src_pitch); | 
| 481 } | 480 } | 
| 482 } | 481 } | 
| 483 uint8_t* compressed_buf; | 482 uint8_t* compressed_buf; | 
| 484 uint32_t compressed_size; | 483 uint32_t compressed_size; | 
| 485 PSCompressData(m_PSLevel, output_buf, output_size, &compressed_buf, | 484 PSCompressData(m_PSLevel, output_buf, output_size, &compressed_buf, | 
| 486 &compressed_size, &filter); | 485 &compressed_size, &filter); | 
| 487 if (output_buf != compressed_buf) { | 486 if (output_buf != compressed_buf) { | 
| 488 FX_Free(output_buf); | 487 FX_Free(output_buf); | 
| 489 } | 488 } | 
| 490 output_buf = compressed_buf; | 489 output_buf = compressed_buf; | 
| 491 output_size = compressed_size; | 490 output_size = compressed_size; | 
| 492 } | 491 } | 
| 493 CFX_DIBSource* converted = pConverted.Get(); | |
| 494 if (converted != pSource) { | |
| 495 delete converted; | |
| 496 pConverted.Reset(); | |
| 497 } | |
| 498 buf << " 8["; | 492 buf << " 8["; | 
| 499 buf << width << " 0 0 -" << height << " 0 " << height << "]"; | 493 buf << width << " 0 0 -" << height << " 0 " << height << "]"; | 
| 500 buf << "currentfile/ASCII85Decode filter "; | 494 buf << "currentfile/ASCII85Decode filter "; | 
| 501 if (filter) { | 495 if (filter) { | 
| 502 buf << filter; | 496 buf << filter; | 
| 503 } | 497 } | 
| 504 buf << "false " << Bpp; | 498 buf << "false " << bpp; | 
| 505 buf << " colorimage\n"; | 499 buf << " colorimage\n"; | 
| 506 m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); | 500 m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); | 
| 507 WritePSBinary(output_buf, output_size); | 501 WritePSBinary(output_buf, output_size); | 
| 508 FX_Free(output_buf); | 502 FX_Free(output_buf); | 
| 509 } | 503 } | 
| 510 OUTPUT_PS("\nQ\n"); | 504 OUTPUT_PS("\nQ\n"); | 
| 511 return true; | 505 return true; | 
| 512 } | 506 } | 
| 513 | 507 | 
| 514 void CFX_PSRenderer::SetColor(uint32_t color) { | 508 void CFX_PSRenderer::SetColor(uint32_t color) { | 
| (...skipping 15 matching lines...) Expand all Loading... | |
| 530 } | 524 } | 
| 531 m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); | 525 m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); | 
| 532 } | 526 } | 
| 533 } | 527 } | 
| 534 | 528 | 
| 535 void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, | 529 void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, | 
| 536 CFX_Font* pFont, | 530 CFX_Font* pFont, | 
| 537 const FXTEXT_CHARPOS& charpos, | 531 const FXTEXT_CHARPOS& charpos, | 
| 538 int* ps_fontnum, | 532 int* ps_fontnum, | 
| 539 int* ps_glyphindex) { | 533 int* ps_glyphindex) { | 
| 540 for (int i = 0; i < m_PSFontList.GetSize(); i++) { | 534 for (int i = 0; i < (int)m_PSFontList.GetSize(); i++) { | 
| 541 CPSFont* pPSFont = m_PSFontList[i]; | 535 CPSFont* pPSFont = m_PSFontList[i]; | 
| 542 for (int j = 0; j < pPSFont->m_nGlyphs; j++) | 536 for (int j = 0; j < pPSFont->m_nGlyphs; j++) | 
| 543 if (pPSFont->m_Glyphs[j].m_pFont == pFont && | 537 if (pPSFont->m_Glyphs[j].m_pFont == pFont && | 
| 544 pPSFont->m_Glyphs[j].m_GlyphIndex == charpos.m_GlyphIndex) { | 538 pPSFont->m_Glyphs[j].m_GlyphIndex == charpos.m_GlyphIndex) { | 
| 545 if ((!pPSFont->m_Glyphs[j].m_bGlyphAdjust && !charpos.m_bGlyphAdjust) || | 539 if ((!pPSFont->m_Glyphs[j].m_bGlyphAdjust && !charpos.m_bGlyphAdjust) || | 
| 546 (pPSFont->m_Glyphs[j].m_bGlyphAdjust && charpos.m_bGlyphAdjust && | 540 (pPSFont->m_Glyphs[j].m_bGlyphAdjust && charpos.m_bGlyphAdjust && | 
| 547 (FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[0] - | 541 (FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[0] - | 
| 548 charpos.m_AdjustMatrix[0]) < 0.01 && | 542 charpos.m_AdjustMatrix[0]) < 0.01 && | 
| 549 FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[1] - | 543 FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[1] - | 
| 550 charpos.m_AdjustMatrix[1]) < 0.01 && | 544 charpos.m_AdjustMatrix[1]) < 0.01 && | 
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 684 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); | 678 CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); | 
| 685 if (pEncoders && | 679 if (pEncoders && | 
| 686 pEncoders->GetBasicModule()->A85Encode(data, len, &dest_buf, | 680 pEncoders->GetBasicModule()->A85Encode(data, len, &dest_buf, | 
| 687 &dest_size)) { | 681 &dest_size)) { | 
| 688 m_pOutput->OutputPS((const FX_CHAR*)dest_buf, dest_size); | 682 m_pOutput->OutputPS((const FX_CHAR*)dest_buf, dest_size); | 
| 689 FX_Free(dest_buf); | 683 FX_Free(dest_buf); | 
| 690 } else { | 684 } else { | 
| 691 m_pOutput->OutputPS((const FX_CHAR*)data, len); | 685 m_pOutput->OutputPS((const FX_CHAR*)data, len); | 
| 692 } | 686 } | 
| 693 } | 687 } | 
| OLD | NEW |