| 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/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/fpdfapi/fpdf_render/render_int.h" |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 FX_ARGB mask_argb, | 41 FX_ARGB mask_argb, |
| 42 int bitmap_alpha, | 42 int bitmap_alpha, |
| 43 int blend_mode, | 43 int blend_mode, |
| 44 int Transparency) { | 44 int Transparency) { |
| 45 if (!pDIBitmap) { | 45 if (!pDIBitmap) { |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 if (blend_mode == FXDIB_BLEND_NORMAL) { | 48 if (blend_mode == FXDIB_BLEND_NORMAL) { |
| 49 if (!pDIBitmap->IsAlphaMask()) { | 49 if (!pDIBitmap->IsAlphaMask()) { |
| 50 if (bitmap_alpha < 255) { | 50 if (bitmap_alpha < 255) { |
| 51 #ifdef _SKIA_SUPPORT_ |
| 52 void* dummy; |
| 53 CFX_Matrix m(pDIBitmap->GetWidth(), 0, 0, -pDIBitmap->GetHeight(), left, |
| 54 top + pDIBitmap->GetHeight()); |
| 55 m_pDevice->StartDIBits(pDIBitmap, bitmap_alpha, 0, &m, 0, dummy); |
| 56 return; |
| 57 #else |
| 51 pDIBitmap->MultiplyAlpha(bitmap_alpha); | 58 pDIBitmap->MultiplyAlpha(bitmap_alpha); |
| 59 #endif |
| 52 } | 60 } |
| 53 if (m_pDevice->SetDIBits(pDIBitmap, left, top)) { | 61 if (m_pDevice->SetDIBits(pDIBitmap, left, top)) { |
| 54 return; | 62 return; |
| 55 } | 63 } |
| 56 } else { | 64 } else { |
| 57 uint32_t fill_argb = m_Options.TranslateColor(mask_argb); | 65 uint32_t fill_argb = m_Options.TranslateColor(mask_argb); |
| 58 if (bitmap_alpha < 255) { | 66 if (bitmap_alpha < 255) { |
| 59 ((uint8_t*)&fill_argb)[3] = | 67 ((uint8_t*)&fill_argb)[3] = |
| 60 ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; | 68 ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; |
| 61 } | 69 } |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 *dest_scan++ = orig; | 694 *dest_scan++ = orig; |
| 687 dest_scan++; | 695 dest_scan++; |
| 688 } else { | 696 } else { |
| 689 dest_scan += 4; | 697 dest_scan += 4; |
| 690 } | 698 } |
| 691 } | 699 } |
| 692 } | 700 } |
| 693 } | 701 } |
| 694 bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask); | 702 bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask); |
| 695 bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap()); | 703 bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap()); |
| 704 #ifdef _SKIA_SUPPORT_ |
| 705 bitmap_device1.PreMultiply(); // convert unpremultiplied to premultiplied |
| 706 #endif |
| 696 if (m_BitmapAlpha < 255) { | 707 if (m_BitmapAlpha < 255) { |
| 697 bitmap_device1.GetBitmap()->MultiplyAlpha(m_BitmapAlpha); | 708 bitmap_device1.GetBitmap()->MultiplyAlpha(m_BitmapAlpha); |
| 698 } | 709 } |
| 699 } | 710 } |
| 700 m_pRenderStatus->m_pDevice->SetDIBitsWithBlend( | 711 m_pRenderStatus->m_pDevice->SetDIBitsWithBlend( |
| 701 bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType); | 712 bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType); |
| 702 return FALSE; | 713 return FALSE; |
| 703 } | 714 } |
| 704 | 715 |
| 705 FX_BOOL CPDF_ImageRenderer::StartDIBSource() { | 716 FX_BOOL CPDF_ImageRenderer::StartDIBSource() { |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 } else if (pFunc) { | 1008 } else if (pFunc) { |
| 998 int size = dest_pitch * height; | 1009 int size = dest_pitch * height; |
| 999 for (int i = 0; i < size; i++) { | 1010 for (int i = 0; i < size; i++) { |
| 1000 dest_buf[i] = transfers[src_buf[i]]; | 1011 dest_buf[i] = transfers[src_buf[i]]; |
| 1001 } | 1012 } |
| 1002 } else { | 1013 } else { |
| 1003 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); | 1014 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); |
| 1004 } | 1015 } |
| 1005 return pMask.release(); | 1016 return pMask.release(); |
| 1006 } | 1017 } |
| OLD | NEW |