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 "render_int.h" | 7 #include "render_int.h" |
8 | 8 |
9 #include "core/include/fpdfapi/fpdf_module.h" | 9 #include "core/include/fpdfapi/fpdf_module.h" |
10 #include "core/include/fpdfapi/fpdf_pageobj.h" | 10 #include "core/include/fpdfapi/fpdf_pageobj.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 dest_width = -dest_width; | 337 dest_width = -dest_width; |
338 } | 338 } |
339 if (m_ImageMatrix.d > 0) { | 339 if (m_ImageMatrix.d > 0) { |
340 dest_height = -dest_height; | 340 dest_height = -dest_height; |
341 } | 341 } |
342 if (m_Loader.StartLoadImage( | 342 if (m_Loader.StartLoadImage( |
343 m_pImageObject, m_pRenderStatus->m_pContext->m_pPageCache, | 343 m_pImageObject, m_pRenderStatus->m_pContext->m_pPageCache, |
344 m_LoadHandle, m_bStdCS, m_pRenderStatus->m_GroupFamily, | 344 m_LoadHandle, m_bStdCS, m_pRenderStatus->m_GroupFamily, |
345 m_pRenderStatus->m_bLoadMask, m_pRenderStatus, dest_width, | 345 m_pRenderStatus->m_bLoadMask, m_pRenderStatus, dest_width, |
346 dest_height)) { | 346 dest_height)) { |
347 if (m_LoadHandle != NULL) { | 347 if (m_LoadHandle) { |
348 m_Status = 4; | 348 m_Status = 4; |
349 return TRUE; | 349 return TRUE; |
350 } | 350 } |
351 return FALSE; | 351 return FALSE; |
352 } | 352 } |
353 return FALSE; | 353 return FALSE; |
354 } | 354 } |
355 FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { | 355 FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { |
356 if (m_Loader.m_pBitmap == NULL) { | 356 if (m_Loader.m_pBitmap == NULL) { |
357 return FALSE; | 357 return FALSE; |
(...skipping 24 matching lines...) Expand all Loading... |
382 m_Loader.m_bCached = FALSE; | 382 m_Loader.m_bCached = FALSE; |
383 } | 383 } |
384 } | 384 } |
385 m_FillArgb = 0; | 385 m_FillArgb = 0; |
386 m_bPatternColor = FALSE; | 386 m_bPatternColor = FALSE; |
387 m_pPattern = NULL; | 387 m_pPattern = NULL; |
388 if (m_pDIBSource->IsAlphaMask()) { | 388 if (m_pDIBSource->IsAlphaMask()) { |
389 CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor(); | 389 CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor(); |
390 if (pColor && pColor->IsPattern()) { | 390 if (pColor && pColor->IsPattern()) { |
391 m_pPattern = pColor->GetPattern(); | 391 m_pPattern = pColor->GetPattern(); |
392 if (m_pPattern != NULL) { | 392 if (m_pPattern) { |
393 m_bPatternColor = TRUE; | 393 m_bPatternColor = TRUE; |
394 } | 394 } |
395 } | 395 } |
396 m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject); | 396 m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject); |
397 } else if (m_pRenderStatus->m_Options.m_ColorMode == RENDER_COLOR_GRAY) { | 397 } else if (m_pRenderStatus->m_Options.m_ColorMode == RENDER_COLOR_GRAY) { |
398 m_pClone = m_pDIBSource->Clone(); | 398 m_pClone = m_pDIBSource->Clone(); |
399 m_pClone->ConvertColorScale(m_pRenderStatus->m_Options.m_BackColor, | 399 m_pClone->ConvertColorScale(m_pRenderStatus->m_Options.m_BackColor, |
400 m_pRenderStatus->m_Options.m_ForeColor); | 400 m_pRenderStatus->m_Options.m_ForeColor); |
401 m_pDIBSource = m_pClone; | 401 m_pDIBSource = m_pClone; |
402 } | 402 } |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 int image_size = m_pDIBSource->GetBPP() / 8 * m_pDIBSource->GetWidth() * | 704 int image_size = m_pDIBSource->GetBPP() / 8 * m_pDIBSource->GetWidth() * |
705 m_pDIBSource->GetHeight(); | 705 m_pDIBSource->GetHeight(); |
706 if (image_size > FPDF_HUGE_IMAGE_SIZE && | 706 if (image_size > FPDF_HUGE_IMAGE_SIZE && |
707 !(m_Flags & RENDER_FORCE_HALFTONE)) { | 707 !(m_Flags & RENDER_FORCE_HALFTONE)) { |
708 m_Flags |= RENDER_FORCE_DOWNSAMPLE; | 708 m_Flags |= RENDER_FORCE_DOWNSAMPLE; |
709 } | 709 } |
710 } | 710 } |
711 if (m_pRenderStatus->m_pDevice->StartDIBits( | 711 if (m_pRenderStatus->m_pDevice->StartDIBits( |
712 m_pDIBSource, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags, | 712 m_pDIBSource, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags, |
713 m_DeviceHandle, 0, NULL, m_BlendType)) { | 713 m_DeviceHandle, 0, NULL, m_BlendType)) { |
714 if (m_DeviceHandle != NULL) { | 714 if (m_DeviceHandle) { |
715 m_Status = 3; | 715 m_Status = 3; |
716 return TRUE; | 716 return TRUE; |
717 } | 717 } |
718 return FALSE; | 718 return FALSE; |
719 } | 719 } |
720 CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); | 720 CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); |
721 FX_RECT image_rect = image_rect_f.GetOutterRect(); | 721 FX_RECT image_rect = image_rect_f.GetOutterRect(); |
722 int dest_width = image_rect.Width(); | 722 int dest_width = image_rect.Width(); |
723 int dest_height = image_rect.Height(); | 723 int dest_height = image_rect.Height(); |
724 if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) || | 724 if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) || |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 } else if (pFunc) { | 1159 } else if (pFunc) { |
1160 int size = dest_pitch * height; | 1160 int size = dest_pitch * height; |
1161 for (int i = 0; i < size; i++) { | 1161 for (int i = 0; i < size; i++) { |
1162 dest_buf[i] = transfers[src_buf[i]]; | 1162 dest_buf[i] = transfers[src_buf[i]]; |
1163 } | 1163 } |
1164 } else { | 1164 } else { |
1165 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); | 1165 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); |
1166 } | 1166 } |
1167 return pMask.release(); | 1167 return pMask.release(); |
1168 } | 1168 } |
OLD | NEW |