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 | 9 |
10 const int SDP_Table[513] = { | 10 const int SDP_Table[513] = { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 FX_BOOL bYFlip, | 72 FX_BOOL bYFlip, |
73 const FX_RECT* pDestClip) const { | 73 const FX_RECT* pDestClip) const { |
74 FX_RECT dest_clip(0, 0, m_Height, m_Width); | 74 FX_RECT dest_clip(0, 0, m_Height, m_Width); |
75 if (pDestClip) { | 75 if (pDestClip) { |
76 dest_clip.Intersect(*pDestClip); | 76 dest_clip.Intersect(*pDestClip); |
77 } | 77 } |
78 if (dest_clip.IsEmpty()) { | 78 if (dest_clip.IsEmpty()) { |
79 return NULL; | 79 return NULL; |
80 } | 80 } |
81 CFX_DIBitmap* pTransBitmap = new CFX_DIBitmap; | 81 CFX_DIBitmap* pTransBitmap = new CFX_DIBitmap; |
82 if (!pTransBitmap) { | |
83 return NULL; | |
84 } | |
85 int result_height = dest_clip.Height(), result_width = dest_clip.Width(); | 82 int result_height = dest_clip.Height(), result_width = dest_clip.Width(); |
86 if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { | 83 if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { |
87 delete pTransBitmap; | 84 delete pTransBitmap; |
88 return NULL; | 85 return NULL; |
89 } | 86 } |
90 pTransBitmap->CopyPalette(m_pPalette); | 87 pTransBitmap->CopyPalette(m_pPalette); |
91 int dest_pitch = pTransBitmap->GetPitch(); | 88 int dest_pitch = pTransBitmap->GetPitch(); |
92 uint8_t* dest_buf = pTransBitmap->GetBuffer(); | 89 uint8_t* dest_buf = pTransBitmap->GetBuffer(); |
93 int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; | 90 int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; |
94 int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; | 91 int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 if (m_Storer.GetBitmap() == NULL) { | 414 if (m_Storer.GetBitmap() == NULL) { |
418 return FALSE; | 415 return FALSE; |
419 } | 416 } |
420 const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); | 417 const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); |
421 const uint8_t* stretch_buf_mask = NULL; | 418 const uint8_t* stretch_buf_mask = NULL; |
422 if (m_Storer.GetBitmap()->m_pAlphaMask) { | 419 if (m_Storer.GetBitmap()->m_pAlphaMask) { |
423 stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer(); | 420 stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer(); |
424 } | 421 } |
425 int stretch_pitch = m_Storer.GetBitmap()->GetPitch(); | 422 int stretch_pitch = m_Storer.GetBitmap()->GetPitch(); |
426 CFX_DIBitmap* pTransformed = new CFX_DIBitmap; | 423 CFX_DIBitmap* pTransformed = new CFX_DIBitmap; |
427 if (!pTransformed) { | |
428 return FALSE; | |
429 } | |
430 FXDIB_Format transformF = _GetTransformedFormat(m_Stretcher.m_pSource); | 424 FXDIB_Format transformF = _GetTransformedFormat(m_Stretcher.m_pSource); |
431 if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { | 425 if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { |
432 delete pTransformed; | 426 delete pTransformed; |
433 return FALSE; | 427 return FALSE; |
434 } | 428 } |
435 pTransformed->Clear(0); | 429 pTransformed->Clear(0); |
436 if (pTransformed->m_pAlphaMask) { | 430 if (pTransformed->m_pAlphaMask) { |
437 pTransformed->m_pAlphaMask->Clear(0); | 431 pTransformed->m_pAlphaMask->Clear(0); |
438 } | 432 } |
439 CFX_AffineMatrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, | 433 CFX_AffineMatrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 } | 930 } |
937 dest_pos += destBpp; | 931 dest_pos += destBpp; |
938 } | 932 } |
939 } | 933 } |
940 } | 934 } |
941 } | 935 } |
942 } | 936 } |
943 m_Storer.Replace(pTransformed); | 937 m_Storer.Replace(pTransformed); |
944 return FALSE; | 938 return FALSE; |
945 } | 939 } |
OLD | NEW |