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 "dib_int.h" | 7 #include "dib_int.h" |
8 | 8 |
9 #include "core/include/fxge/fx_dib.h" | 9 #include "core/include/fxge/fx_dib.h" |
10 | 10 |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 return m_Stretcher.Continue(pPause); | 416 return m_Stretcher.Continue(pPause); |
417 } | 417 } |
418 if (m_Status != 3) { | 418 if (m_Status != 3) { |
419 return FALSE; | 419 return FALSE; |
420 } | 420 } |
421 if (m_Stretcher.Continue(pPause)) { | 421 if (m_Stretcher.Continue(pPause)) { |
422 return TRUE; | 422 return TRUE; |
423 } | 423 } |
424 int stretch_width = m_StretchClip.Width(); | 424 int stretch_width = m_StretchClip.Width(); |
425 int stretch_height = m_StretchClip.Height(); | 425 int stretch_height = m_StretchClip.Height(); |
426 if (m_Storer.GetBitmap() == NULL) { | 426 if (!m_Storer.GetBitmap()) { |
427 return FALSE; | 427 return FALSE; |
428 } | 428 } |
429 const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); | 429 const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); |
430 const uint8_t* stretch_buf_mask = NULL; | 430 const uint8_t* stretch_buf_mask = NULL; |
431 if (m_Storer.GetBitmap()->m_pAlphaMask) { | 431 if (m_Storer.GetBitmap()->m_pAlphaMask) { |
432 stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer(); | 432 stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer(); |
433 } | 433 } |
434 int stretch_pitch = m_Storer.GetBitmap()->GetPitch(); | 434 int stretch_pitch = m_Storer.GetBitmap()->GetPitch(); |
435 CFX_DIBitmap* pTransformed = new CFX_DIBitmap; | 435 CFX_DIBitmap* pTransformed = new CFX_DIBitmap; |
436 FXDIB_Format transformF = GetTransformedFormat(m_Stretcher.m_pSource); | 436 FXDIB_Format transformF = GetTransformedFormat(m_Stretcher.m_pSource); |
437 if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { | 437 if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { |
438 delete pTransformed; | 438 delete pTransformed; |
439 return FALSE; | 439 return FALSE; |
440 } | 440 } |
441 pTransformed->Clear(0); | 441 pTransformed->Clear(0); |
442 if (pTransformed->m_pAlphaMask) { | 442 if (pTransformed->m_pAlphaMask) { |
443 pTransformed->m_pAlphaMask->Clear(0); | 443 pTransformed->m_pAlphaMask->Clear(0); |
444 } | 444 } |
445 CFX_Matrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (FX_FLOAT)(m_ResultLeft), | 445 CFX_Matrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (FX_FLOAT)(m_ResultLeft), |
446 (FX_FLOAT)(m_ResultTop)); | 446 (FX_FLOAT)(m_ResultTop)); |
447 result2stretch.Concat(m_dest2stretch); | 447 result2stretch.Concat(m_dest2stretch); |
448 result2stretch.TranslateI(-m_StretchClip.left, -m_StretchClip.top); | 448 result2stretch.TranslateI(-m_StretchClip.left, -m_StretchClip.top); |
449 if (stretch_buf_mask == NULL && pTransformed->m_pAlphaMask) { | 449 if (!stretch_buf_mask && pTransformed->m_pAlphaMask) { |
450 pTransformed->m_pAlphaMask->Clear(0xff000000); | 450 pTransformed->m_pAlphaMask->Clear(0xff000000); |
451 } else if (pTransformed->m_pAlphaMask) { | 451 } else if (pTransformed->m_pAlphaMask) { |
452 int stretch_pitch_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetPitch(); | 452 int stretch_pitch_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetPitch(); |
453 if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { | 453 if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { |
454 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); | 454 CFX_BilinearMatrix result2stretch_fix(result2stretch, 8); |
455 for (int row = 0; row < m_ResultHeight; row++) { | 455 for (int row = 0; row < m_ResultHeight; row++) { |
456 uint8_t* dest_pos_mask = | 456 uint8_t* dest_pos_mask = |
457 (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row); | 457 (uint8_t*)pTransformed->m_pAlphaMask->GetScanline(row); |
458 for (int col = 0; col < m_ResultWidth; col++) { | 458 for (int col = 0; col < m_ResultWidth; col++) { |
459 int src_col_l, src_row_l, res_x, res_y; | 459 int src_col_l, src_row_l, res_x, res_y; |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 } | 939 } |
940 dest_pos += destBpp; | 940 dest_pos += destBpp; |
941 } | 941 } |
942 } | 942 } |
943 } | 943 } |
944 } | 944 } |
945 } | 945 } |
946 m_Storer.Replace(pTransformed); | 946 m_Storer.Replace(pTransformed); |
947 return FALSE; | 947 return FALSE; |
948 } | 948 } |
OLD | NEW |