| 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 "../../../include/fxge/fx_ge.h" | 8 #include "../../../include/fxge/fx_ge.h" |
| 9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
| 10 #include "dib_int.h" | 10 #include "dib_int.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 CFX_DIBitmap* CFX_DIBSource::Clone(const FX_RECT* pClip) const | 158 CFX_DIBitmap* CFX_DIBSource::Clone(const FX_RECT* pClip) const |
| 159 { | 159 { |
| 160 FX_RECT rect(0, 0, m_Width, m_Height); | 160 FX_RECT rect(0, 0, m_Width, m_Height); |
| 161 if (pClip) { | 161 if (pClip) { |
| 162 rect.Intersect(*pClip); | 162 rect.Intersect(*pClip); |
| 163 if (rect.IsEmpty()) { | 163 if (rect.IsEmpty()) { |
| 164 return NULL; | 164 return NULL; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 CFX_DIBitmap* pNewBitmap = FX_NEW CFX_DIBitmap; | 167 CFX_DIBitmap* pNewBitmap = new CFX_DIBitmap; |
| 168 if (!pNewBitmap) { | |
| 169 return NULL; | |
| 170 } | |
| 171 if (!pNewBitmap->Create(rect.Width(), rect.Height(), GetFormat())) { | 168 if (!pNewBitmap->Create(rect.Width(), rect.Height(), GetFormat())) { |
| 172 delete pNewBitmap; | 169 delete pNewBitmap; |
| 173 return NULL; | 170 return NULL; |
| 174 } | 171 } |
| 175 pNewBitmap->CopyPalette(m_pPalette); | 172 pNewBitmap->CopyPalette(m_pPalette); |
| 176 pNewBitmap->CopyAlphaMask(m_pAlphaMask, pClip); | 173 pNewBitmap->CopyAlphaMask(m_pAlphaMask, pClip); |
| 177 if (GetBPP() == 1 && rect.left % 8 != 0) { | 174 if (GetBPP() == 1 && rect.left % 8 != 0) { |
| 178 int left_shift = rect.left % 32; | 175 int left_shift = rect.left % 32; |
| 179 int right_shift = 32 - left_shift; | 176 int right_shift = 32 - left_shift; |
| 180 int dword_count = pNewBitmap->m_Pitch / 4; | 177 int dword_count = pNewBitmap->m_Pitch / 4; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 m_pPalette[i] = 0xff000000 | (i * 0x10101); | 226 m_pPalette[i] = 0xff000000 | (i * 0x10101); |
| 230 } | 227 } |
| 231 } | 228 } |
| 232 } | 229 } |
| 233 } | 230 } |
| 234 FX_BOOL CFX_DIBSource::BuildAlphaMask() | 231 FX_BOOL CFX_DIBSource::BuildAlphaMask() |
| 235 { | 232 { |
| 236 if (m_pAlphaMask) { | 233 if (m_pAlphaMask) { |
| 237 return TRUE; | 234 return TRUE; |
| 238 } | 235 } |
| 239 m_pAlphaMask = FX_NEW CFX_DIBitmap; | 236 m_pAlphaMask = new CFX_DIBitmap; |
| 240 if (!m_pAlphaMask) { | |
| 241 return FALSE; | |
| 242 } | |
| 243 if (!m_pAlphaMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { | 237 if (!m_pAlphaMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { |
| 244 delete m_pAlphaMask; | 238 delete m_pAlphaMask; |
| 245 m_pAlphaMask = NULL; | 239 m_pAlphaMask = NULL; |
| 246 return FALSE; | 240 return FALSE; |
| 247 } | 241 } |
| 248 FXSYS_memset8(m_pAlphaMask->GetBuffer(), 0xff, m_pAlphaMask->GetHeight()*m_p
AlphaMask->GetPitch()); | 242 FXSYS_memset8(m_pAlphaMask->GetBuffer(), 0xff, m_pAlphaMask->GetHeight()*m_p
AlphaMask->GetPitch()); |
| 249 return TRUE; | 243 return TRUE; |
| 250 } | 244 } |
| 251 FX_DWORD CFX_DIBSource::GetPaletteEntry(int index) const | 245 FX_DWORD CFX_DIBSource::GetPaletteEntry(int index) const |
| 252 { | 246 { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 CFX_DIBitmap* CFX_DIBSource::GetAlphaMask(const FX_RECT* pClip) const | 561 CFX_DIBitmap* CFX_DIBSource::GetAlphaMask(const FX_RECT* pClip) const |
| 568 { | 562 { |
| 569 ASSERT(GetFormat() == FXDIB_Argb); | 563 ASSERT(GetFormat() == FXDIB_Argb); |
| 570 FX_RECT rect(0, 0, m_Width, m_Height); | 564 FX_RECT rect(0, 0, m_Width, m_Height); |
| 571 if (pClip) { | 565 if (pClip) { |
| 572 rect.Intersect(*pClip); | 566 rect.Intersect(*pClip); |
| 573 if (rect.IsEmpty()) { | 567 if (rect.IsEmpty()) { |
| 574 return NULL; | 568 return NULL; |
| 575 } | 569 } |
| 576 } | 570 } |
| 577 CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap; | 571 CFX_DIBitmap* pMask = new CFX_DIBitmap; |
| 578 if (!pMask) { | |
| 579 return NULL; | |
| 580 } | |
| 581 if (!pMask->Create(rect.Width(), rect.Height(), FXDIB_8bppMask)) { | 572 if (!pMask->Create(rect.Width(), rect.Height(), FXDIB_8bppMask)) { |
| 582 delete pMask; | 573 delete pMask; |
| 583 return NULL; | 574 return NULL; |
| 584 } | 575 } |
| 585 for (int row = rect.top; row < rect.bottom; row ++) { | 576 for (int row = rect.top; row < rect.bottom; row ++) { |
| 586 FX_LPCBYTE src_scan = GetScanline(row) + rect.left * 4 + 3; | 577 FX_LPCBYTE src_scan = GetScanline(row) + rect.left * 4 + 3; |
| 587 FX_LPBYTE dest_scan = (FX_LPBYTE)pMask->GetScanline(row - rect.top); | 578 FX_LPBYTE dest_scan = (FX_LPBYTE)pMask->GetScanline(row - rect.top); |
| 588 for (int col = rect.left; col < rect.right; col ++) { | 579 for (int col = rect.left; col < rect.right; col ++) { |
| 589 *dest_scan ++ = *src_scan; | 580 *dest_scan ++ = *src_scan; |
| 590 src_scan += 4; | 581 src_scan += 4; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 if (m_pPalette == NULL) { | 886 if (m_pPalette == NULL) { |
| 896 return FALSE; | 887 return FALSE; |
| 897 } | 888 } |
| 898 FX_BYTE gray[2]; | 889 FX_BYTE gray[2]; |
| 899 for (int i = 0; i < 2; i ++) { | 890 for (int i = 0; i < 2; i ++) { |
| 900 int r = (FX_BYTE)(m_pPalette[i] >> 16); | 891 int r = (FX_BYTE)(m_pPalette[i] >> 16); |
| 901 int g = (FX_BYTE)(m_pPalette[i] >> 8); | 892 int g = (FX_BYTE)(m_pPalette[i] >> 8); |
| 902 int b = (FX_BYTE)m_pPalette[i]; | 893 int b = (FX_BYTE)m_pPalette[i]; |
| 903 gray[i] = (FX_BYTE)FXRGB2GRAY(r, g, b); | 894 gray[i] = (FX_BYTE)FXRGB2GRAY(r, g, b); |
| 904 } | 895 } |
| 905 CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap; | 896 CFX_DIBitmap* pMask = new CFX_DIBitmap; |
| 906 if (!pMask) { | |
| 907 return FALSE; | |
| 908 } | |
| 909 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { | 897 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { |
| 910 delete pMask; | 898 delete pMask; |
| 911 return FALSE; | 899 return FALSE; |
| 912 } | 900 } |
| 913 FXSYS_memset8(pMask->GetBuffer(), gray[0], pMask->GetPitch() * m
_Height); | 901 FXSYS_memset8(pMask->GetBuffer(), gray[0], pMask->GetPitch() * m
_Height); |
| 914 for (int row = 0; row < m_Height; row ++) { | 902 for (int row = 0; row < m_Height; row ++) { |
| 915 FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; | 903 FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; |
| 916 FX_LPBYTE dest_pos = (FX_LPBYTE)pMask->GetScanline(row); | 904 FX_LPBYTE dest_pos = (FX_LPBYTE)pMask->GetScanline(row); |
| 917 for (int col = 0; col < m_Width; col ++) { | 905 for (int col = 0; col < m_Width; col ++) { |
| 918 if (src_pos[col / 8] & (1 << (7 - col % 8))) { | 906 if (src_pos[col / 8] & (1 << (7 - col % 8))) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 929 if (m_pPalette == NULL) { | 917 if (m_pPalette == NULL) { |
| 930 return FALSE; | 918 return FALSE; |
| 931 } | 919 } |
| 932 FX_BYTE gray[256]; | 920 FX_BYTE gray[256]; |
| 933 for (int i = 0; i < 256; i ++) { | 921 for (int i = 0; i < 256; i ++) { |
| 934 int r = (FX_BYTE)(m_pPalette[i] >> 16); | 922 int r = (FX_BYTE)(m_pPalette[i] >> 16); |
| 935 int g = (FX_BYTE)(m_pPalette[i] >> 8); | 923 int g = (FX_BYTE)(m_pPalette[i] >> 8); |
| 936 int b = (FX_BYTE)m_pPalette[i]; | 924 int b = (FX_BYTE)m_pPalette[i]; |
| 937 gray[i] = (FX_BYTE)FXRGB2GRAY(r, g, b); | 925 gray[i] = (FX_BYTE)FXRGB2GRAY(r, g, b); |
| 938 } | 926 } |
| 939 CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap; | 927 CFX_DIBitmap* pMask = new CFX_DIBitmap; |
| 940 if (!pMask) { | |
| 941 return FALSE; | |
| 942 } | |
| 943 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { | 928 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { |
| 944 delete pMask; | 929 delete pMask; |
| 945 return FALSE; | 930 return FALSE; |
| 946 } | 931 } |
| 947 for (int row = 0; row < m_Height; row ++) { | 932 for (int row = 0; row < m_Height; row ++) { |
| 948 FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPi
tch(); | 933 FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPi
tch(); |
| 949 FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; | 934 FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; |
| 950 for (int col = 0; col < m_Width; col ++) { | 935 for (int col = 0; col < m_Width; col ++) { |
| 951 *dest_pos ++ = gray[*src_pos ++]; | 936 *dest_pos ++ = gray[*src_pos ++]; |
| 952 } | 937 } |
| 953 } | 938 } |
| 954 TakeOver(pMask); | 939 TakeOver(pMask); |
| 955 delete pMask; | 940 delete pMask; |
| 956 break; | 941 break; |
| 957 } | 942 } |
| 958 case FXDIB_Rgb: { | 943 case FXDIB_Rgb: { |
| 959 CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap; | 944 CFX_DIBitmap* pMask = new CFX_DIBitmap; |
| 960 if (!pMask) { | |
| 961 return FALSE; | |
| 962 } | |
| 963 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { | 945 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { |
| 964 delete pMask; | 946 delete pMask; |
| 965 return FALSE; | 947 return FALSE; |
| 966 } | 948 } |
| 967 for (int row = 0; row < m_Height; row ++) { | 949 for (int row = 0; row < m_Height; row ++) { |
| 968 FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; | 950 FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; |
| 969 FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPi
tch(); | 951 FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPi
tch(); |
| 970 for (int col = 0; col < m_Width; col ++) { | 952 for (int col = 0; col < m_Width; col ++) { |
| 971 *dest_pos ++ = FXRGB2GRAY(src_pos[2], src_pos[1], *src_p
os); | 953 *dest_pos ++ = FXRGB2GRAY(src_pos[2], src_pos[1], *src_p
os); |
| 972 src_pos += 3; | 954 src_pos += 3; |
| 973 } | 955 } |
| 974 } | 956 } |
| 975 TakeOver(pMask); | 957 TakeOver(pMask); |
| 976 delete pMask; | 958 delete pMask; |
| 977 break; | 959 break; |
| 978 } | 960 } |
| 979 case FXDIB_Rgb32: { | 961 case FXDIB_Rgb32: { |
| 980 CFX_DIBitmap* pMask = FX_NEW CFX_DIBitmap; | 962 CFX_DIBitmap* pMask = new CFX_DIBitmap; |
| 981 if (!pMask) { | |
| 982 return FALSE; | |
| 983 } | |
| 984 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { | 963 if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { |
| 985 delete pMask; | 964 delete pMask; |
| 986 return FALSE; | 965 return FALSE; |
| 987 } | 966 } |
| 988 for (int row = 0; row < m_Height; row ++) { | 967 for (int row = 0; row < m_Height; row ++) { |
| 989 FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; | 968 FX_LPBYTE src_pos = m_pBuffer + row * m_Pitch; |
| 990 FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPi
tch(); | 969 FX_LPBYTE dest_pos = pMask->GetBuffer() + row * pMask->GetPi
tch(); |
| 991 for (int col = 0; col < m_Width; col ++) { | 970 for (int col = 0; col < m_Width; col ++) { |
| 992 *dest_pos ++ = FXRGB2GRAY(src_pos[2], src_pos[1], *src_p
os); | 971 *dest_pos ++ = FXRGB2GRAY(src_pos[2], src_pos[1], *src_p
os); |
| 993 src_pos += 4; | 972 src_pos += 4; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 } else { | 1386 } else { |
| 1408 next_scan[col - 1] = src; | 1387 next_scan[col - 1] = src; |
| 1409 } | 1388 } |
| 1410 } | 1389 } |
| 1411 } | 1390 } |
| 1412 } | 1391 } |
| 1413 return TRUE; | 1392 return TRUE; |
| 1414 } | 1393 } |
| 1415 CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const | 1394 CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const |
| 1416 { | 1395 { |
| 1417 CFX_DIBitmap* pFlipped = FX_NEW CFX_DIBitmap; | 1396 CFX_DIBitmap* pFlipped = new CFX_DIBitmap; |
| 1418 if (!pFlipped) { | |
| 1419 return NULL; | |
| 1420 } | |
| 1421 if (!pFlipped->Create(m_Width, m_Height, GetFormat())) { | 1397 if (!pFlipped->Create(m_Width, m_Height, GetFormat())) { |
| 1422 delete pFlipped; | 1398 delete pFlipped; |
| 1423 return NULL; | 1399 return NULL; |
| 1424 } | 1400 } |
| 1425 pFlipped->CopyPalette(m_pPalette); | 1401 pFlipped->CopyPalette(m_pPalette); |
| 1426 FX_LPBYTE pDestBuffer = pFlipped->GetBuffer(); | 1402 FX_LPBYTE pDestBuffer = pFlipped->GetBuffer(); |
| 1427 int Bpp = m_bpp / 8; | 1403 int Bpp = m_bpp / 8; |
| 1428 for (int row = 0; row < m_Height; row ++) { | 1404 for (int row = 0; row < m_Height; row ++) { |
| 1429 FX_LPCBYTE src_scan = GetScanline(row); | 1405 FX_LPCBYTE src_scan = GetScanline(row); |
| 1430 FX_LPBYTE dest_scan = pDestBuffer + m_Pitch * (bYFlip ? (m_Height - row
- 1) : row); | 1406 FX_LPBYTE dest_scan = pDestBuffer + m_Pitch * (bYFlip ? (m_Height - row
- 1) : row); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 } | 1460 } |
| 1485 } | 1461 } |
| 1486 return pFlipped; | 1462 return pFlipped; |
| 1487 } | 1463 } |
| 1488 CFX_DIBExtractor::CFX_DIBExtractor(const CFX_DIBSource* pSrc) | 1464 CFX_DIBExtractor::CFX_DIBExtractor(const CFX_DIBSource* pSrc) |
| 1489 { | 1465 { |
| 1490 m_pBitmap = NULL; | 1466 m_pBitmap = NULL; |
| 1491 if (pSrc->GetBuffer() == NULL) { | 1467 if (pSrc->GetBuffer() == NULL) { |
| 1492 m_pBitmap = pSrc->Clone(); | 1468 m_pBitmap = pSrc->Clone(); |
| 1493 } else { | 1469 } else { |
| 1494 m_pBitmap = FX_NEW CFX_DIBitmap; | 1470 m_pBitmap = new CFX_DIBitmap; |
| 1495 if (!m_pBitmap) { | |
| 1496 return; | |
| 1497 } | |
| 1498 if (!m_pBitmap->Create(pSrc->GetWidth(), pSrc->GetHeight(), pSrc->GetFor
mat(), pSrc->GetBuffer())) { | 1471 if (!m_pBitmap->Create(pSrc->GetWidth(), pSrc->GetHeight(), pSrc->GetFor
mat(), pSrc->GetBuffer())) { |
| 1499 delete m_pBitmap; | 1472 delete m_pBitmap; |
| 1500 m_pBitmap = NULL; | 1473 m_pBitmap = NULL; |
| 1501 return; | 1474 return; |
| 1502 } | 1475 } |
| 1503 m_pBitmap->CopyPalette(pSrc->GetPalette()); | 1476 m_pBitmap->CopyPalette(pSrc->GetPalette()); |
| 1504 m_pBitmap->CopyAlphaMask(pSrc->m_pAlphaMask); | 1477 m_pBitmap->CopyAlphaMask(pSrc->m_pAlphaMask); |
| 1505 } | 1478 } |
| 1506 } | 1479 } |
| 1507 CFX_DIBExtractor::~CFX_DIBExtractor() | 1480 CFX_DIBExtractor::~CFX_DIBExtractor() |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 bitmap_clip = _FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_heigh
t, m_Matrix.c > 0, m_Matrix.b < 0); | 1571 bitmap_clip = _FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_heigh
t, m_Matrix.c > 0, m_Matrix.b < 0); |
| 1599 m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_Cl
ipBox, TRUE, | 1572 m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_Cl
ipBox, TRUE, |
| 1600 m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder,
alpha_flag, pIccTransform, m_BlendType); | 1573 m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder,
alpha_flag, pIccTransform, m_BlendType); |
| 1601 if (!m_Stretcher.Start(&m_Composer, pSource, dest_height, dest_width
, bitmap_clip, dib_flags)) { | 1574 if (!m_Stretcher.Start(&m_Composer, pSource, dest_height, dest_width
, bitmap_clip, dib_flags)) { |
| 1602 return FALSE; | 1575 return FALSE; |
| 1603 } | 1576 } |
| 1604 m_Status = 1; | 1577 m_Status = 1; |
| 1605 return TRUE; | 1578 return TRUE; |
| 1606 } | 1579 } |
| 1607 m_Status = 2; | 1580 m_Status = 2; |
| 1608 m_pTransformer = FX_NEW CFX_ImageTransformer; | 1581 m_pTransformer = new CFX_ImageTransformer; |
| 1609 if (!m_pTransformer) { | |
| 1610 return FALSE; | |
| 1611 } | |
| 1612 m_pTransformer->Start(pSource, &m_Matrix, dib_flags, &m_ClipBox); | 1582 m_pTransformer->Start(pSource, &m_Matrix, dib_flags, &m_ClipBox); |
| 1613 return TRUE; | 1583 return TRUE; |
| 1614 } | 1584 } |
| 1615 int dest_width = image_rect.Width(); | 1585 int dest_width = image_rect.Width(); |
| 1616 if (m_Matrix.a < 0) { | 1586 if (m_Matrix.a < 0) { |
| 1617 dest_width = -dest_width; | 1587 dest_width = -dest_width; |
| 1618 } | 1588 } |
| 1619 int dest_height = image_rect.Height(); | 1589 int dest_height = image_rect.Height(); |
| 1620 if (m_Matrix.d > 0) { | 1590 if (m_Matrix.d > 0) { |
| 1621 dest_height = -dest_height; | 1591 dest_height = -dest_height; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 (FX_LPBYTE)m_pBitmap->m_pAlphaMask->GetScanline(l
ine) : NULL; | 1670 (FX_LPBYTE)m_pBitmap->m_pAlphaMask->GetScanline(l
ine) : NULL; |
| 1701 if (dest_buf) { | 1671 if (dest_buf) { |
| 1702 FXSYS_memcpy32(dest_buf, scanline, m_pBitmap->GetPitch()); | 1672 FXSYS_memcpy32(dest_buf, scanline, m_pBitmap->GetPitch()); |
| 1703 } | 1673 } |
| 1704 if (dest_alpha_buf) { | 1674 if (dest_alpha_buf) { |
| 1705 FXSYS_memcpy32(dest_alpha_buf, scan_extra_alpha, m_pBitmap->m_pAlphaMask
->GetPitch()); | 1675 FXSYS_memcpy32(dest_alpha_buf, scan_extra_alpha, m_pBitmap->m_pAlphaMask
->GetPitch()); |
| 1706 } | 1676 } |
| 1707 } | 1677 } |
| 1708 FX_BOOL CFX_BitmapStorer::SetInfo(int width, int height, FXDIB_Format src_format
, FX_DWORD* pSrcPalette) | 1678 FX_BOOL CFX_BitmapStorer::SetInfo(int width, int height, FXDIB_Format src_format
, FX_DWORD* pSrcPalette) |
| 1709 { | 1679 { |
| 1710 m_pBitmap = FX_NEW CFX_DIBitmap; | 1680 m_pBitmap = new CFX_DIBitmap; |
| 1711 if (!m_pBitmap) { | |
| 1712 return FALSE; | |
| 1713 } | |
| 1714 if (!m_pBitmap->Create(width, height, src_format)) { | 1681 if (!m_pBitmap->Create(width, height, src_format)) { |
| 1715 delete m_pBitmap; | 1682 delete m_pBitmap; |
| 1716 m_pBitmap = NULL; | 1683 m_pBitmap = NULL; |
| 1717 return FALSE; | 1684 return FALSE; |
| 1718 } | 1685 } |
| 1719 if (pSrcPalette) { | 1686 if (pSrcPalette) { |
| 1720 m_pBitmap->CopyPalette(pSrcPalette); | 1687 m_pBitmap->CopyPalette(pSrcPalette); |
| 1721 } | 1688 } |
| 1722 return TRUE; | 1689 return TRUE; |
| 1723 } | 1690 } |
| OLD | NEW |