| 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 "../../../include/fxge/fx_dib.h" | 7 #include "../../../include/fxge/fx_dib.h" |
| 8 #include "dib_int.h" | 8 #include "dib_int.h" |
| 9 int SDP_Table[513] = { | 9 int SDP_Table[513] = { |
| 10 256, 256, 256, 256, 256, 256, 256, 256, 256, 255, 255, 255, 255, 255, 255, 2
54, 254, 254, 254, | 10 256, 256, 256, 256, 256, 256, 256, 256, 256, 255, 255, 255, 255, 255, 255, 2
54, 254, 254, 254, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 }; | 56 }; |
| 57 CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC
T* pDestClip) const | 57 CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_BOOL bYFlip, const FX_REC
T* pDestClip) const |
| 58 { | 58 { |
| 59 FX_RECT dest_clip(0, 0, m_Height, m_Width); | 59 FX_RECT dest_clip(0, 0, m_Height, m_Width); |
| 60 if (pDestClip) { | 60 if (pDestClip) { |
| 61 dest_clip.Intersect(*pDestClip); | 61 dest_clip.Intersect(*pDestClip); |
| 62 } | 62 } |
| 63 if (dest_clip.IsEmpty()) { | 63 if (dest_clip.IsEmpty()) { |
| 64 return NULL; | 64 return NULL; |
| 65 } | 65 } |
| 66 CFX_DIBitmap* pTransBitmap = FX_NEW CFX_DIBitmap; | 66 CFX_DIBitmap* pTransBitmap = new CFX_DIBitmap; |
| 67 if (!pTransBitmap) { | |
| 68 return NULL; | |
| 69 } | |
| 70 int result_height = dest_clip.Height(), result_width = dest_clip.Width(); | 67 int result_height = dest_clip.Height(), result_width = dest_clip.Width(); |
| 71 if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { | 68 if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { |
| 72 delete pTransBitmap; | 69 delete pTransBitmap; |
| 73 return NULL; | 70 return NULL; |
| 74 } | 71 } |
| 75 pTransBitmap->CopyPalette(m_pPalette); | 72 pTransBitmap->CopyPalette(m_pPalette); |
| 76 int src_pitch = m_Pitch; | 73 int src_pitch = m_Pitch; |
| 77 int dest_pitch = pTransBitmap->GetPitch(); | 74 int dest_pitch = pTransBitmap->GetPitch(); |
| 78 FX_LPBYTE dest_buf = pTransBitmap->GetBuffer(); | 75 FX_LPBYTE dest_buf = pTransBitmap->GetBuffer(); |
| 79 int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; | 76 int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 int stretch_height = m_StretchClip.Height(); | 359 int stretch_height = m_StretchClip.Height(); |
| 363 if (m_Storer.GetBitmap() == NULL) { | 360 if (m_Storer.GetBitmap() == NULL) { |
| 364 return FALSE; | 361 return FALSE; |
| 365 } | 362 } |
| 366 FX_LPCBYTE stretch_buf = m_Storer.GetBitmap()->GetBuffer(); | 363 FX_LPCBYTE stretch_buf = m_Storer.GetBitmap()->GetBuffer(); |
| 367 FX_LPCBYTE stretch_buf_mask = NULL; | 364 FX_LPCBYTE stretch_buf_mask = NULL; |
| 368 if (m_Storer.GetBitmap()->m_pAlphaMask) { | 365 if (m_Storer.GetBitmap()->m_pAlphaMask) { |
| 369 stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer(); | 366 stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer(); |
| 370 } | 367 } |
| 371 int stretch_pitch = m_Storer.GetBitmap()->GetPitch(); | 368 int stretch_pitch = m_Storer.GetBitmap()->GetPitch(); |
| 372 CFX_DIBitmap* pTransformed = FX_NEW CFX_DIBitmap; | 369 CFX_DIBitmap* pTransformed = new CFX_DIBitmap; |
| 373 if (!pTransformed) { | |
| 374 return FALSE; | |
| 375 } | |
| 376 FXDIB_Format transformF = _GetTransformedFormat(m_Stretcher.m_pSource); | 370 FXDIB_Format transformF = _GetTransformedFormat(m_Stretcher.m_pSource); |
| 377 if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { | 371 if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { |
| 378 delete pTransformed; | 372 delete pTransformed; |
| 379 return FALSE; | 373 return FALSE; |
| 380 } | 374 } |
| 381 pTransformed->Clear(0); | 375 pTransformed->Clear(0); |
| 382 if (pTransformed->m_pAlphaMask) { | 376 if (pTransformed->m_pAlphaMask) { |
| 383 pTransformed->m_pAlphaMask->Clear(0); | 377 pTransformed->m_pAlphaMask->Clear(0); |
| 384 } | 378 } |
| 385 CFX_AffineMatrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (FX_FLOAT)(m_ResultL
eft), (FX_FLOAT)(m_ResultTop)); | 379 CFX_AffineMatrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (FX_FLOAT)(m_ResultL
eft), (FX_FLOAT)(m_ResultTop)); |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 } | 781 } |
| 788 dest_pos += destBpp; | 782 dest_pos += destBpp; |
| 789 } | 783 } |
| 790 } | 784 } |
| 791 } | 785 } |
| 792 } | 786 } |
| 793 } | 787 } |
| 794 m_Storer.Replace(pTransformed); | 788 m_Storer.Replace(pTransformed); |
| 795 return FALSE; | 789 return FALSE; |
| 796 } | 790 } |
| OLD | NEW |