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/include/fxge/fx_ge.h" | 7 #include "core/include/fxge/fx_ge.h" |
8 | 8 |
9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ | 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ |
10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 {"Helvetica", "Arial", FALSE, FALSE}, | 185 {"Helvetica", "Arial", FALSE, FALSE}, |
186 {"Helvetica-Bold", "Arial", TRUE, FALSE}, | 186 {"Helvetica-Bold", "Arial", TRUE, FALSE}, |
187 {"Helvetica-BoldOblique", "Arial", TRUE, TRUE}, | 187 {"Helvetica-BoldOblique", "Arial", TRUE, TRUE}, |
188 {"Helvetica-Oblique", "Arial", FALSE, TRUE}, | 188 {"Helvetica-Oblique", "Arial", FALSE, TRUE}, |
189 {"Times-Roman", "Times New Roman", FALSE, FALSE}, | 189 {"Times-Roman", "Times New Roman", FALSE, FALSE}, |
190 {"Times-Bold", "Times New Roman", TRUE, FALSE}, | 190 {"Times-Bold", "Times New Roman", TRUE, FALSE}, |
191 {"Times-BoldItalic", "Times New Roman", TRUE, TRUE}, | 191 {"Times-BoldItalic", "Times New Roman", TRUE, TRUE}, |
192 {"Times-Italic", "Times New Roman", FALSE, TRUE}, | 192 {"Times-Italic", "Times New Roman", FALSE, TRUE}, |
193 }; | 193 }; |
194 CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) { | 194 CFX_ByteString CFX_Win32FontInfo::FindFont(const CFX_ByteString& name) { |
195 if (m_pMapper == NULL) { | 195 if (!m_pMapper) { |
196 return name; | 196 return name; |
197 } | 197 } |
198 int nFonts = m_pMapper->m_InstalledTTFonts.GetSize(); | 198 int nFonts = m_pMapper->m_InstalledTTFonts.GetSize(); |
199 for (int i = 0; i < nFonts; i++) { | 199 for (int i = 0; i < nFonts; i++) { |
200 CFX_ByteString thisname = m_pMapper->m_InstalledTTFonts[i]; | 200 CFX_ByteString thisname = m_pMapper->m_InstalledTTFonts[i]; |
201 if (thisname[0] == ' ') { | 201 if (thisname[0] == ' ') { |
202 if (thisname.Mid(1, name.GetLength()) == name) { | 202 if (thisname.Mid(1, name.GetLength()) == name) { |
203 return m_pMapper->m_InstalledTTFonts[i + 1]; | 203 return m_pMapper->m_InstalledTTFonts[i + 1]; |
204 } | 204 } |
205 } else if (thisname.Left(name.GetLength()) == name) { | 205 } else if (thisname.Left(name.GetLength()) == name) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 return FXSYS_stricmp((const FX_CHAR*)key, | 244 return FXSYS_stricmp((const FX_CHAR*)key, |
245 ((_FontNameMap*)element)->m_pSrcFontName); | 245 ((_FontNameMap*)element)->m_pSrcFontName); |
246 } | 246 } |
247 } | 247 } |
248 FX_BOOL _GetSubFontName(CFX_ByteString& name) { | 248 FX_BOOL _GetSubFontName(CFX_ByteString& name) { |
249 int size = sizeof g_JpFontNameMap; | 249 int size = sizeof g_JpFontNameMap; |
250 void* pFontnameMap = (void*)g_JpFontNameMap; | 250 void* pFontnameMap = (void*)g_JpFontNameMap; |
251 _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch( | 251 _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch( |
252 name.c_str(), pFontnameMap, size / sizeof(_FontNameMap), | 252 name.c_str(), pFontnameMap, size / sizeof(_FontNameMap), |
253 sizeof(_FontNameMap), compareString); | 253 sizeof(_FontNameMap), compareString); |
254 if (found == NULL) { | 254 if (!found) { |
255 return FALSE; | 255 return FALSE; |
256 } | 256 } |
257 name = found->m_pSubFontName; | 257 name = found->m_pSubFontName; |
258 return TRUE; | 258 return TRUE; |
259 } | 259 } |
260 void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face, | 260 void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face, |
261 int weight, | 261 int weight, |
262 int picth_family) { | 262 int picth_family) { |
263 if (face.Find("KaiTi") >= 0 || face.Find("\xbf\xac") >= 0) { | 263 if (face.Find("KaiTi") >= 0 || face.Find("\xbf\xac") >= 0) { |
264 if (m_KaiTi.IsEmpty()) { | 264 if (m_KaiTi.IsEmpty()) { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 } | 521 } |
522 return (void*)hClipRgn; | 522 return (void*)hClipRgn; |
523 } | 523 } |
524 FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, | 524 FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, |
525 const FX_RECT* pSrcRect, | 525 const FX_RECT* pSrcRect, |
526 int left, | 526 int left, |
527 int top, | 527 int top, |
528 void* pIccTransform) { | 528 void* pIccTransform) { |
529 if (m_DeviceClass == FXDC_PRINTER) { | 529 if (m_DeviceClass == FXDC_PRINTER) { |
530 CFX_DIBitmap* pBitmap = pBitmap1->FlipImage(FALSE, TRUE); | 530 CFX_DIBitmap* pBitmap = pBitmap1->FlipImage(FALSE, TRUE); |
531 if (pBitmap == NULL) { | 531 if (!pBitmap) { |
532 return FALSE; | 532 return FALSE; |
533 } | 533 } |
534 if ((pBitmap->IsCmykImage() || pIccTransform) && | 534 if ((pBitmap->IsCmykImage() || pIccTransform) && |
535 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { | 535 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { |
536 return FALSE; | 536 return FALSE; |
537 } | 537 } |
538 int width = pSrcRect->Width(), height = pSrcRect->Height(); | 538 int width = pSrcRect->Width(), height = pSrcRect->Height(); |
539 LPBYTE pBuffer = pBitmap->GetBuffer(); | 539 LPBYTE pBuffer = pBitmap->GetBuffer(); |
540 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); | 540 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); |
541 ((BITMAPINFOHEADER*)info.c_str())->biHeight *= -1; | 541 ((BITMAPINFOHEADER*)info.c_str())->biHeight *= -1; |
(...skipping 26 matching lines...) Expand all Loading... |
568 return TRUE; | 568 return TRUE; |
569 } | 569 } |
570 FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, | 570 FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, |
571 int dest_left, | 571 int dest_left, |
572 int dest_top, | 572 int dest_top, |
573 int dest_width, | 573 int dest_width, |
574 int dest_height, | 574 int dest_height, |
575 FX_DWORD flags, | 575 FX_DWORD flags, |
576 void* pIccTransform) { | 576 void* pIccTransform) { |
577 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; | 577 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; |
578 if (pBitmap == NULL || dest_width == 0 || dest_height == 0) { | 578 if (!pBitmap || dest_width == 0 || dest_height == 0) { |
579 return FALSE; | 579 return FALSE; |
580 } | 580 } |
581 if ((pBitmap->IsCmykImage() || pIccTransform) && | 581 if ((pBitmap->IsCmykImage() || pIccTransform) && |
582 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { | 582 !pBitmap->ConvertFormat(FXDIB_Rgb, pIccTransform)) { |
583 return FALSE; | 583 return FALSE; |
584 } | 584 } |
585 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); | 585 CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); |
586 if ((int64_t)abs(dest_width) * abs(dest_height) < | 586 if ((int64_t)abs(dest_width) * abs(dest_height) < |
587 (int64_t)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 || | 587 (int64_t)pBitmap1->GetWidth() * pBitmap1->GetHeight() * 4 || |
588 (flags & FXDIB_INTERPOL) || (flags & FXDIB_BICUBIC_INTERPOL)) { | 588 (flags & FXDIB_INTERPOL) || (flags & FXDIB_BICUBIC_INTERPOL)) { |
(...skipping 24 matching lines...) Expand all Loading... |
613 FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, | 613 FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, |
614 int dest_left, | 614 int dest_left, |
615 int dest_top, | 615 int dest_top, |
616 int dest_width, | 616 int dest_width, |
617 int dest_height, | 617 int dest_height, |
618 FX_DWORD bitmap_color, | 618 FX_DWORD bitmap_color, |
619 FX_DWORD flags, | 619 FX_DWORD flags, |
620 int alpha_flag, | 620 int alpha_flag, |
621 void* pIccTransform) { | 621 void* pIccTransform) { |
622 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; | 622 CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; |
623 if (pBitmap == NULL || dest_width == 0 || dest_height == 0) { | 623 if (!pBitmap || dest_width == 0 || dest_height == 0) { |
624 return FALSE; | 624 return FALSE; |
625 } | 625 } |
626 _Color2Argb(bitmap_color, bitmap_color, alpha_flag | (1 << 24), | 626 _Color2Argb(bitmap_color, bitmap_color, alpha_flag | (1 << 24), |
627 pIccTransform); | 627 pIccTransform); |
628 int width = pBitmap->GetWidth(), height = pBitmap->GetHeight(); | 628 int width = pBitmap->GetWidth(), height = pBitmap->GetHeight(); |
629 struct { | 629 struct { |
630 BITMAPINFOHEADER bmiHeader; | 630 BITMAPINFOHEADER bmiHeader; |
631 FX_DWORD bmiColors[2]; | 631 FX_DWORD bmiColors[2]; |
632 } bmi; | 632 } bmi; |
633 FXSYS_memset(&bmi.bmiHeader, 0, sizeof(BITMAPINFOHEADER)); | 633 FXSYS_memset(&bmi.bmiHeader, 0, sizeof(BITMAPINFOHEADER)); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 int alpha_flag, | 848 int alpha_flag, |
849 void* pIccTransform, | 849 void* pIccTransform, |
850 int blend_type) { | 850 int blend_type) { |
851 if (blend_type != FXDIB_BLEND_NORMAL) { | 851 if (blend_type != FXDIB_BLEND_NORMAL) { |
852 return FALSE; | 852 return FALSE; |
853 } | 853 } |
854 _Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform); | 854 _Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform); |
855 _Color2Argb(stroke_color, stroke_color, alpha_flag, pIccTransform); | 855 _Color2Argb(stroke_color, stroke_color, alpha_flag, pIccTransform); |
856 CWin32Platform* pPlatform = | 856 CWin32Platform* pPlatform = |
857 (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); | 857 (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); |
858 if ((pGraphState == NULL || stroke_color == 0) && | 858 if (!(pGraphState || stroke_color == 0) && |
859 !pPlatform->m_GdiplusExt.IsAvailable()) { | 859 !pPlatform->m_GdiplusExt.IsAvailable()) { |
860 CFX_FloatRect bbox_f = pPathData->GetBoundingBox(); | 860 CFX_FloatRect bbox_f = pPathData->GetBoundingBox(); |
861 if (pMatrix) { | 861 if (pMatrix) { |
862 bbox_f.Transform(pMatrix); | 862 bbox_f.Transform(pMatrix); |
863 } | 863 } |
864 FX_RECT bbox = bbox_f.GetInnerRect(); | 864 FX_RECT bbox = bbox_f.GetInnerRect(); |
865 if (bbox.Width() <= 0) { | 865 if (bbox.Width() <= 0) { |
866 return DrawCosmeticLine((FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top), | 866 return DrawCosmeticLine((FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top), |
867 (FX_FLOAT)(bbox.left), | 867 (FX_FLOAT)(bbox.left), |
868 (FX_FLOAT)(bbox.bottom + 1), fill_color, | 868 (FX_FLOAT)(bbox.bottom + 1), fill_color, |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 FXSYS_memset(&bmi, 0, sizeof bmi); | 1059 FXSYS_memset(&bmi, 0, sizeof bmi); |
1060 bmi.bmiHeader.biSize = sizeof bmi.bmiHeader; | 1060 bmi.bmiHeader.biSize = sizeof bmi.bmiHeader; |
1061 bmi.bmiHeader.biBitCount = pBitmap->GetBPP(); | 1061 bmi.bmiHeader.biBitCount = pBitmap->GetBPP(); |
1062 bmi.bmiHeader.biHeight = -height; | 1062 bmi.bmiHeader.biHeight = -height; |
1063 bmi.bmiHeader.biPlanes = 1; | 1063 bmi.bmiHeader.biPlanes = 1; |
1064 bmi.bmiHeader.biWidth = width; | 1064 bmi.bmiHeader.biWidth = width; |
1065 if (!CFX_GEModule::Get()->GetCodecModule() || | 1065 if (!CFX_GEModule::Get()->GetCodecModule() || |
1066 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { | 1066 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { |
1067 pIccTransform = NULL; | 1067 pIccTransform = NULL; |
1068 } | 1068 } |
1069 if (pBitmap->GetBPP() > 8 && !pBitmap->IsCmykImage() && | 1069 if (pBitmap->GetBPP() > 8 && !pBitmap->IsCmykImage() && !pIccTransform) { |
1070 pIccTransform == NULL) { | |
1071 ret = ::GetDIBits(hDCMemory, hbmp, 0, height, pBitmap->GetBuffer(), &bmi, | 1070 ret = ::GetDIBits(hDCMemory, hbmp, 0, height, pBitmap->GetBuffer(), &bmi, |
1072 DIB_RGB_COLORS) == height; | 1071 DIB_RGB_COLORS) == height; |
1073 } else { | 1072 } else { |
1074 CFX_DIBitmap bitmap; | 1073 CFX_DIBitmap bitmap; |
1075 if (bitmap.Create(width, height, FXDIB_Rgb)) { | 1074 if (bitmap.Create(width, height, FXDIB_Rgb)) { |
1076 bmi.bmiHeader.biBitCount = 24; | 1075 bmi.bmiHeader.biBitCount = 24; |
1077 ::GetDIBits(hDCMemory, hbmp, 0, height, bitmap.GetBuffer(), &bmi, | 1076 ::GetDIBits(hDCMemory, hbmp, 0, height, bitmap.GetBuffer(), &bmi, |
1078 DIB_RGB_COLORS); | 1077 DIB_RGB_COLORS); |
1079 ret = pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0, | 1078 ret = pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0, |
1080 pIccTransform); | 1079 pIccTransform); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 FX_RECT bitmap_clip = *pClipRect; | 1157 FX_RECT bitmap_clip = *pClipRect; |
1159 if (dest_width < 0) { | 1158 if (dest_width < 0) { |
1160 dest_left += dest_width; | 1159 dest_left += dest_width; |
1161 } | 1160 } |
1162 if (dest_height < 0) { | 1161 if (dest_height < 0) { |
1163 dest_top += dest_height; | 1162 dest_top += dest_height; |
1164 } | 1163 } |
1165 bitmap_clip.Offset(-dest_left, -dest_top); | 1164 bitmap_clip.Offset(-dest_left, -dest_top); |
1166 CFX_DIBitmap* pStretched = | 1165 CFX_DIBitmap* pStretched = |
1167 pSource->StretchTo(dest_width, dest_height, render_flags, &bitmap_clip); | 1166 pSource->StretchTo(dest_width, dest_height, render_flags, &bitmap_clip); |
1168 if (pStretched == NULL) { | 1167 if (!pStretched) { |
1169 return TRUE; | 1168 return TRUE; |
1170 } | 1169 } |
1171 FX_RECT src_rect(0, 0, pStretched->GetWidth(), pStretched->GetHeight()); | 1170 FX_RECT src_rect(0, 0, pStretched->GetWidth(), pStretched->GetHeight()); |
1172 FX_BOOL ret = | 1171 FX_BOOL ret = |
1173 SetDIBits(pStretched, color, &src_rect, pClipRect->left, pClipRect->top, | 1172 SetDIBits(pStretched, color, &src_rect, pClipRect->left, pClipRect->top, |
1174 FXDIB_BLEND_NORMAL, alpha_flag, pIccTransform); | 1173 FXDIB_BLEND_NORMAL, alpha_flag, pIccTransform); |
1175 delete pStretched; | 1174 delete pStretched; |
1176 return ret; | 1175 return ret; |
1177 } | 1176 } |
1178 FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, | 1177 FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, |
(...skipping 19 matching lines...) Expand all Loading... |
1198 image_rect.left = dest_width > 0 ? dest_left : dest_left + dest_width; | 1197 image_rect.left = dest_width > 0 ? dest_left : dest_left + dest_width; |
1199 image_rect.right = dest_width > 0 ? dest_left + dest_width : dest_left; | 1198 image_rect.right = dest_width > 0 ? dest_left + dest_width : dest_left; |
1200 image_rect.top = dest_height > 0 ? dest_top : dest_top + dest_height; | 1199 image_rect.top = dest_height > 0 ? dest_top : dest_top + dest_height; |
1201 image_rect.bottom = dest_height > 0 ? dest_top + dest_height : dest_top; | 1200 image_rect.bottom = dest_height > 0 ? dest_top + dest_height : dest_top; |
1202 FX_RECT clip_rect = image_rect; | 1201 FX_RECT clip_rect = image_rect; |
1203 clip_rect.Intersect(*pClipRect); | 1202 clip_rect.Intersect(*pClipRect); |
1204 clip_rect.Offset(-image_rect.left, -image_rect.top); | 1203 clip_rect.Offset(-image_rect.left, -image_rect.top); |
1205 int clip_width = clip_rect.Width(), clip_height = clip_rect.Height(); | 1204 int clip_width = clip_rect.Width(), clip_height = clip_rect.Height(); |
1206 CFX_DIBitmap* pStretched = | 1205 CFX_DIBitmap* pStretched = |
1207 pSource->StretchTo(dest_width, dest_height, flags, &clip_rect); | 1206 pSource->StretchTo(dest_width, dest_height, flags, &clip_rect); |
1208 if (pStretched == NULL) { | 1207 if (!pStretched) { |
1209 return TRUE; | 1208 return TRUE; |
1210 } | 1209 } |
1211 CFX_DIBitmap background; | 1210 CFX_DIBitmap background; |
1212 if (!background.Create(clip_width, clip_height, FXDIB_Rgb32) || | 1211 if (!background.Create(clip_width, clip_height, FXDIB_Rgb32) || |
1213 !GetDIBits(&background, image_rect.left + clip_rect.left, | 1212 !GetDIBits(&background, image_rect.left + clip_rect.left, |
1214 image_rect.top + clip_rect.top, NULL) || | 1213 image_rect.top + clip_rect.top, NULL) || |
1215 !background.CompositeMask(0, 0, clip_width, clip_height, pStretched, | 1214 !background.CompositeMask(0, 0, clip_width, clip_height, pStretched, |
1216 color, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, | 1215 color, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, |
1217 alpha_flag, pIccTransform)) { | 1216 alpha_flag, pIccTransform)) { |
1218 delete pStretched; | 1217 delete pStretched; |
1219 return FALSE; | 1218 return FALSE; |
1220 } | 1219 } |
1221 FX_RECT src_rect(0, 0, clip_width, clip_height); | 1220 FX_RECT src_rect(0, 0, clip_width, clip_height); |
1222 FX_BOOL ret = | 1221 FX_BOOL ret = |
1223 SetDIBits(&background, 0, &src_rect, image_rect.left + clip_rect.left, | 1222 SetDIBits(&background, 0, &src_rect, image_rect.left + clip_rect.left, |
1224 image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL, 0, NULL); | 1223 image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL, 0, NULL); |
1225 delete pStretched; | 1224 delete pStretched; |
1226 return ret; | 1225 return ret; |
1227 } | 1226 } |
1228 if (pSource->HasAlpha()) { | 1227 if (pSource->HasAlpha()) { |
1229 CWin32Platform* pPlatform = | 1228 CWin32Platform* pPlatform = |
1230 (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); | 1229 (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); |
1231 if (pPlatform->m_GdiplusExt.IsAvailable() && pIccTransform == NULL && | 1230 if (pPlatform->m_GdiplusExt.IsAvailable() && !pIccTransform && |
1232 !pSource->IsCmykImage()) { | 1231 !pSource->IsCmykImage()) { |
1233 CFX_DIBExtractor temp(pSource); | 1232 CFX_DIBExtractor temp(pSource); |
1234 CFX_DIBitmap* pBitmap = temp; | 1233 CFX_DIBitmap* pBitmap = temp; |
1235 if (pBitmap == NULL) { | 1234 if (!pBitmap) { |
1236 return FALSE; | 1235 return FALSE; |
1237 } | 1236 } |
1238 return pPlatform->m_GdiplusExt.StretchDIBits( | 1237 return pPlatform->m_GdiplusExt.StretchDIBits( |
1239 m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height, | 1238 m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height, |
1240 pClipRect, flags); | 1239 pClipRect, flags); |
1241 } | 1240 } |
1242 return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, | 1241 return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, |
1243 dest_width, dest_height, pClipRect, flags, | 1242 dest_width, dest_height, pClipRect, flags, |
1244 alpha_flag, pIccTransform, blend_type); | 1243 alpha_flag, pIccTransform, blend_type); |
1245 } | 1244 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 BITMAPINFOHEADER bmih; | 1332 BITMAPINFOHEADER bmih; |
1334 FXSYS_memset(&bmih, 0, sizeof(BITMAPINFOHEADER)); | 1333 FXSYS_memset(&bmih, 0, sizeof(BITMAPINFOHEADER)); |
1335 bmih.biSize = sizeof(BITMAPINFOHEADER); | 1334 bmih.biSize = sizeof(BITMAPINFOHEADER); |
1336 bmih.biBitCount = format & 0xff; | 1335 bmih.biBitCount = format & 0xff; |
1337 bmih.biHeight = -height; | 1336 bmih.biHeight = -height; |
1338 bmih.biPlanes = 1; | 1337 bmih.biPlanes = 1; |
1339 bmih.biWidth = width; | 1338 bmih.biWidth = width; |
1340 uint8_t* pBuffer; | 1339 uint8_t* pBuffer; |
1341 m_hBitmap = CreateDIBSection(NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, | 1340 m_hBitmap = CreateDIBSection(NULL, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, |
1342 (void**)&pBuffer, NULL, 0); | 1341 (void**)&pBuffer, NULL, 0); |
1343 if (m_hBitmap == NULL) { | 1342 if (!m_hBitmap) { |
1344 return; | 1343 return; |
1345 } | 1344 } |
1346 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; | 1345 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; |
1347 pBitmap->Create(width, height, format, pBuffer); | 1346 pBitmap->Create(width, height, format, pBuffer); |
1348 SetBitmap(pBitmap); | 1347 SetBitmap(pBitmap); |
1349 m_hDC = ::CreateCompatibleDC(NULL); | 1348 m_hDC = ::CreateCompatibleDC(NULL); |
1350 m_hOldBitmap = (HBITMAP)SelectObject(m_hDC, m_hBitmap); | 1349 m_hOldBitmap = (HBITMAP)SelectObject(m_hDC, m_hBitmap); |
1351 IFX_RenderDeviceDriver* pDriver = new CGdiDisplayDriver(m_hDC); | 1350 IFX_RenderDeviceDriver* pDriver = new CGdiDisplayDriver(m_hDC); |
1352 SetDeviceDriver(pDriver); | 1351 SetDeviceDriver(pDriver); |
1353 } | 1352 } |
1354 CFX_WinBitmapDevice::~CFX_WinBitmapDevice() { | 1353 CFX_WinBitmapDevice::~CFX_WinBitmapDevice() { |
1355 if (m_hDC) { | 1354 if (m_hDC) { |
1356 SelectObject(m_hDC, m_hOldBitmap); | 1355 SelectObject(m_hDC, m_hOldBitmap); |
1357 DeleteDC(m_hDC); | 1356 DeleteDC(m_hDC); |
1358 } | 1357 } |
1359 if (m_hBitmap) { | 1358 if (m_hBitmap) { |
1360 DeleteObject(m_hBitmap); | 1359 DeleteObject(m_hBitmap); |
1361 } | 1360 } |
1362 delete GetBitmap(); | 1361 delete GetBitmap(); |
1363 } | 1362 } |
1364 | 1363 |
1365 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 1364 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
OLD | NEW |