| 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_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
| 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ | 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 #define CallFunc(funcname) ((FuncType_##funcname)GdiplusExt.m_Functions[FuncId_#
#funcname]) | 267 #define CallFunc(funcname) ((FuncType_##funcname)GdiplusExt.m_Functions[FuncId_#
#funcname]) |
| 268 typedef HANDLE (__stdcall *FuncType_GdiAddFontMemResourceEx)(PVOID pbFont, DWO
RD cbFont, PVOID pdv, DWORD *pcFonts); | 268 typedef HANDLE (__stdcall *FuncType_GdiAddFontMemResourceEx)(PVOID pbFont, DWO
RD cbFont, PVOID pdv, DWORD *pcFonts); |
| 269 typedef BOOL (__stdcall *FuncType_GdiRemoveFontMemResourceEx)(HANDLE handle)
; | 269 typedef BOOL (__stdcall *FuncType_GdiRemoveFontMemResourceEx)(HANDLE handle)
; |
| 270 void* CGdiplusExt::GdiAddFontMemResourceEx(void *pFontdata, FX_DWORD size, void*
pdv, FX_DWORD* num_face) | 270 void* CGdiplusExt::GdiAddFontMemResourceEx(void *pFontdata, FX_DWORD size, void*
pdv, FX_DWORD* num_face) |
| 271 { | 271 { |
| 272 if (m_pGdiAddFontMemResourceEx) { | 272 if (m_pGdiAddFontMemResourceEx) { |
| 273 return ((FuncType_GdiAddFontMemResourceEx)m_pGdiAddFontMemResourceEx)((P
VOID)pFontdata, (DWORD)size, (PVOID)pdv, (DWORD*)num_face); | 273 return ((FuncType_GdiAddFontMemResourceEx)m_pGdiAddFontMemResourceEx)((P
VOID)pFontdata, (DWORD)size, (PVOID)pdv, (DWORD*)num_face); |
| 274 } | 274 } |
| 275 return NULL; | 275 return NULL; |
| 276 } | 276 } |
| 277 FX_BOOL CGdiplusExt::GdiRemoveFontMemResourceEx(void* handle) | 277 bool CGdiplusExt::GdiRemoveFontMemResourceEx(void* handle) |
| 278 { | 278 { |
| 279 if (m_pGdiRemoveFontMemResourseEx) { | 279 if (m_pGdiRemoveFontMemResourseEx) { |
| 280 return ((FuncType_GdiRemoveFontMemResourceEx)m_pGdiRemoveFontMemResourse
Ex)((HANDLE)handle); | 280 return ((FuncType_GdiRemoveFontMemResourceEx)m_pGdiRemoveFontMemResourse
Ex)((HANDLE)handle); |
| 281 } | 281 } |
| 282 return FALSE; | 282 return false; |
| 283 } | 283 } |
| 284 static GpBrush* _GdipCreateBrush(DWORD argb) | 284 static GpBrush* _GdipCreateBrush(DWORD argb) |
| 285 { | 285 { |
| 286 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 286 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 287 GpSolidFill* solidBrush = NULL; | 287 GpSolidFill* solidBrush = NULL; |
| 288 CallFunc(GdipCreateSolidFill)((ARGB)argb, &solidBrush); | 288 CallFunc(GdipCreateSolidFill)((ARGB)argb, &solidBrush); |
| 289 return solidBrush; | 289 return solidBrush; |
| 290 } | 290 } |
| 291 static CFX_DIBitmap* _StretchMonoToGray(int dest_width, int dest_height, | 291 static CFX_DIBitmap* _StretchMonoToGray(int dest_width, int dest_height, |
| 292 const CFX_DIBitmap* pSource, FX_RECT* pC
lipRect) | 292 const CFX_DIBitmap* pSource, FX_RECT* pC
lipRect) |
| 293 { | 293 { |
| 294 FX_BOOL bFlipX = dest_width < 0; | 294 bool bFlipX = dest_width < 0; |
| 295 if (bFlipX) { | 295 if (bFlipX) { |
| 296 dest_width = -dest_width; | 296 dest_width = -dest_width; |
| 297 } | 297 } |
| 298 FX_BOOL bFlipY = dest_height < 0; | 298 bool bFlipY = dest_height < 0; |
| 299 if (bFlipY) { | 299 if (bFlipY) { |
| 300 dest_height = -dest_height; | 300 dest_height = -dest_height; |
| 301 } | 301 } |
| 302 int result_width = pClipRect->Width(); | 302 int result_width = pClipRect->Width(); |
| 303 int result_height = pClipRect->Height(); | 303 int result_height = pClipRect->Height(); |
| 304 int result_pitch = (result_width + 3) / 4 * 4; | 304 int result_pitch = (result_width + 3) / 4 * 4; |
| 305 CFX_DIBitmap* pStretched = new CFX_DIBitmap; | 305 CFX_DIBitmap* pStretched = new CFX_DIBitmap; |
| 306 if (!pStretched->Create(result_width, result_height, FXDIB_8bppRgb)) { | 306 if (!pStretched->Create(result_width, result_height, FXDIB_8bppRgb)) { |
| 307 delete pStretched; | 307 delete pStretched; |
| 308 return NULL; | 308 return NULL; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 FX_RECT image_clip = image_rect; | 375 FX_RECT image_clip = image_rect; |
| 376 image_clip.Intersect(*pClipRect); | 376 image_clip.Intersect(*pClipRect); |
| 377 if (image_clip.IsEmpty()) { | 377 if (image_clip.IsEmpty()) { |
| 378 return; | 378 return; |
| 379 } | 379 } |
| 380 image_clip.Offset(-image_rect.left, -image_rect.top); | 380 image_clip.Offset(-image_rect.left, -image_rect.top); |
| 381 CFX_DIBitmap* pStretched = NULL; | 381 CFX_DIBitmap* pStretched = NULL; |
| 382 if (src_width * src_height > 10000) { | 382 if (src_width * src_height > 10000) { |
| 383 pStretched = _StretchMonoToGray(dest_width, dest_height, pBitmap, &i
mage_clip); | 383 pStretched = _StretchMonoToGray(dest_width, dest_height, pBitmap, &i
mage_clip); |
| 384 } else { | 384 } else { |
| 385 pStretched = pBitmap->StretchTo(dest_width, dest_height, FALSE, &ima
ge_clip); | 385 pStretched = pBitmap->StretchTo(dest_width, dest_height, false, &ima
ge_clip); |
| 386 } | 386 } |
| 387 GpBitmap* bitmap; | 387 GpBitmap* bitmap; |
| 388 CallFunc(GdipCreateBitmapFromScan0)(image_clip.Width(), image_clip.Heigh
t(), | 388 CallFunc(GdipCreateBitmapFromScan0)(image_clip.Width(), image_clip.Heigh
t(), |
| 389 (image_clip.Width() + 3) / 4 * 4, Pi
xelFormat8bppIndexed, pStretched->GetBuffer(), &bitmap); | 389 (image_clip.Width() + 3) / 4 * 4, Pi
xelFormat8bppIndexed, pStretched->GetBuffer(), &bitmap); |
| 390 int a, r, g, b; | 390 int a, r, g, b; |
| 391 ArgbDecode(argb, a, r, g, b); | 391 ArgbDecode(argb, a, r, g, b); |
| 392 UINT pal[258]; | 392 UINT pal[258]; |
| 393 pal[0] = 0; | 393 pal[0] = 0; |
| 394 pal[1] = 256; | 394 pal[1] = 256; |
| 395 for (int i = 0; i < 256; i ++) { | 395 for (int i = 0; i < 256; i ++) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 return pCollection; | 529 return pCollection; |
| 530 } | 530 } |
| 531 CallFunc(GdipDeletePrivateFontCollection)(&pCollection); | 531 CallFunc(GdipDeletePrivateFontCollection)(&pCollection); |
| 532 return NULL; | 532 return NULL; |
| 533 } | 533 } |
| 534 void CGdiplusExt::DeleteMemFont(LPVOID pCollection) | 534 void CGdiplusExt::DeleteMemFont(LPVOID pCollection) |
| 535 { | 535 { |
| 536 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 536 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 537 CallFunc(GdipDeletePrivateFontCollection)((GpFontCollection**)&pCollection); | 537 CallFunc(GdipDeletePrivateFontCollection)((GpFontCollection**)&pCollection); |
| 538 } | 538 } |
| 539 FX_BOOL CGdiplusExt::GdipCreateBitmap(CFX_DIBitmap* pBitmap, void**bitmap) | 539 bool CGdiplusExt::GdipCreateBitmap(CFX_DIBitmap* pBitmap, void**bitmap) |
| 540 { | 540 { |
| 541 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 541 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 542 PixelFormat format; | 542 PixelFormat format; |
| 543 switch (pBitmap->GetFormat()) { | 543 switch (pBitmap->GetFormat()) { |
| 544 case FXDIB_Rgb: | 544 case FXDIB_Rgb: |
| 545 format = PixelFormat24bppRGB; | 545 format = PixelFormat24bppRGB; |
| 546 break; | 546 break; |
| 547 case FXDIB_Rgb32: | 547 case FXDIB_Rgb32: |
| 548 format = PixelFormat32bppRGB; | 548 format = PixelFormat32bppRGB; |
| 549 break; | 549 break; |
| 550 case FXDIB_Argb: | 550 case FXDIB_Argb: |
| 551 format = PixelFormat32bppARGB; | 551 format = PixelFormat32bppARGB; |
| 552 break; | 552 break; |
| 553 default: | 553 default: |
| 554 return FALSE; | 554 return false; |
| 555 } | 555 } |
| 556 GpStatus status = CallFunc(GdipCreateBitmapFromScan0)(pBitmap->GetWidth(), p
Bitmap->GetHeight(), | 556 GpStatus status = CallFunc(GdipCreateBitmapFromScan0)(pBitmap->GetWidth(), p
Bitmap->GetHeight(), |
| 557 pBitmap->GetPitch(), format, pBitmap->GetBuffer(), (GpBitm
ap**)bitmap); | 557 pBitmap->GetPitch(), format, pBitmap->GetBuffer(), (GpBitm
ap**)bitmap); |
| 558 if (status == Ok) { | 558 if (status == Ok) { |
| 559 return TRUE; | 559 return true; |
| 560 } | 560 } |
| 561 return FALSE; | 561 return false; |
| 562 } | 562 } |
| 563 FX_BOOL CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) | 563 bool CGdiplusExt::GdipCreateFromImage(void* bitmap, void** graphics) |
| 564 { | 564 { |
| 565 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 565 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 566 GpStatus status = CallFunc(GdipGetImageGraphicsContext)((GpBitmap*)bitmap, (
GpGraphics**)graphics); | 566 GpStatus status = CallFunc(GdipGetImageGraphicsContext)((GpBitmap*)bitmap, (
GpGraphics**)graphics); |
| 567 if (status == Ok) { | 567 if (status == Ok) { |
| 568 return TRUE; | 568 return true; |
| 569 } | 569 } |
| 570 return FALSE; | 570 return false; |
| 571 } | 571 } |
| 572 FX_BOOL CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name, void* pF
ontCollection, void**pFamily) | 572 bool CGdiplusExt::GdipCreateFontFamilyFromName(const FX_WCHAR* name, void* pFont
Collection, void**pFamily) |
| 573 { | 573 { |
| 574 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 574 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 575 GpStatus status = CallFunc(GdipCreateFontFamilyFromName)((GDIPCONST WCHAR *)
name, (GpFontCollection*)pFontCollection, (GpFontFamily**)pFamily); | 575 GpStatus status = CallFunc(GdipCreateFontFamilyFromName)((GDIPCONST WCHAR *)
name, (GpFontCollection*)pFontCollection, (GpFontFamily**)pFamily); |
| 576 if (status == Ok) { | 576 if (status == Ok) { |
| 577 return TRUE; | 577 return true; |
| 578 } | 578 } |
| 579 return FALSE; | 579 return false; |
| 580 } | 580 } |
| 581 FX_BOOL CGdiplusExt::GdipCreateFontFromFamily(void* pFamily, FX_FLOAT font_size,
int fontstyle, int flag, void** pFont) | 581 bool CGdiplusExt::GdipCreateFontFromFamily(void* pFamily, FX_FLOAT font_size, in
t fontstyle, int flag, void** pFont) |
| 582 { | 582 { |
| 583 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 583 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 584 GpStatus status = CallFunc(GdipCreateFont)((GpFontFamily*)pFamily, font_size
, fontstyle, Unit(flag), (GpFont**)pFont); | 584 GpStatus status = CallFunc(GdipCreateFont)((GpFontFamily*)pFamily, font_size
, fontstyle, Unit(flag), (GpFont**)pFont); |
| 585 if (status == Ok) { | 585 if (status == Ok) { |
| 586 return TRUE; | 586 return true; |
| 587 } | 587 } |
| 588 return FALSE; | 588 return false; |
| 589 } | 589 } |
| 590 void CGdiplusExt::GdipGetFontSize(void *pFont, FX_FLOAT *size) | 590 void CGdiplusExt::GdipGetFontSize(void *pFont, FX_FLOAT *size) |
| 591 { | 591 { |
| 592 REAL get_size; | 592 REAL get_size; |
| 593 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 593 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 594 GpStatus status = CallFunc(GdipGetFontSize)((GpFont *)pFont, (REAL*)&get_siz
e); | 594 GpStatus status = CallFunc(GdipGetFontSize)((GpFont *)pFont, (REAL*)&get_siz
e); |
| 595 if (status == Ok) { | 595 if (status == Ok) { |
| 596 *size = (FX_FLOAT)get_size; | 596 *size = (FX_FLOAT)get_size; |
| 597 } else { | 597 } else { |
| 598 *size = 0; | 598 *size = 0; |
| 599 } | 599 } |
| 600 } | 600 } |
| 601 void CGdiplusExt::GdipSetTextRenderingHint(void* graphics, int mode) | 601 void CGdiplusExt::GdipSetTextRenderingHint(void* graphics, int mode) |
| 602 { | 602 { |
| 603 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 603 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 604 CallFunc(GdipSetTextRenderingHint)((GpGraphics*)graphics, (TextRenderingHint
)mode); | 604 CallFunc(GdipSetTextRenderingHint)((GpGraphics*)graphics, (TextRenderingHint
)mode); |
| 605 } | 605 } |
| 606 void CGdiplusExt::GdipSetPageUnit(void* graphics, FX_DWORD unit) | 606 void CGdiplusExt::GdipSetPageUnit(void* graphics, FX_DWORD unit) |
| 607 { | 607 { |
| 608 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 608 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 609 CallFunc(GdipSetPageUnit)((GpGraphics*)graphics, (GpUnit)unit); | 609 CallFunc(GdipSetPageUnit)((GpGraphics*)graphics, (GpUnit)unit); |
| 610 } | 610 } |
| 611 FX_BOOL CGdiplusExt::GdipDrawDriverString(void *graphics, unsigned short *text,
int length, | 611 bool CGdiplusExt::GdipDrawDriverString(void *graphics, unsigned short *text, in
t length, |
| 612 void *font, void* brush, void *positions, int flags, const void *matrix) | 612 void *font, void* brush, void *positions, int flags, const void *matrix) |
| 613 { | 613 { |
| 614 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 614 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 615 GpStatus status = CallFunc(GdipDrawDriverString)((GpGraphics*)graphics, (GDI
PCONST UINT16 *)text, (INT)length, (GDIPCONST GpFont *)font, (GDIPCONST GpBrush*
)brush, | 615 GpStatus status = CallFunc(GdipDrawDriverString)((GpGraphics*)graphics, (GDI
PCONST UINT16 *)text, (INT)length, (GDIPCONST GpFont *)font, (GDIPCONST GpBrush*
)brush, |
| 616 (GDIPCONST PointF *)positions, (INT)flags, (GDIPCONST GpMa
trix *)matrix); | 616 (GDIPCONST PointF *)positions, (INT)flags, (GDIPCONST GpMa
trix *)matrix); |
| 617 if (status == Ok) { | 617 if (status == Ok) { |
| 618 return TRUE; | 618 return true; |
| 619 } | 619 } |
| 620 return FALSE; | 620 return false; |
| 621 } | 621 } |
| 622 void CGdiplusExt::GdipCreateBrush(FX_DWORD fill_argb, void** pBrush) | 622 void CGdiplusExt::GdipCreateBrush(FX_DWORD fill_argb, void** pBrush) |
| 623 { | 623 { |
| 624 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 624 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 625 CallFunc(GdipCreateSolidFill)((ARGB)fill_argb, (GpSolidFill**)pBrush); | 625 CallFunc(GdipCreateSolidFill)((ARGB)fill_argb, (GpSolidFill**)pBrush); |
| 626 } | 626 } |
| 627 void CGdiplusExt::GdipDeleteBrush(void* pBrush) | 627 void CGdiplusExt::GdipDeleteBrush(void* pBrush) |
| 628 { | 628 { |
| 629 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 629 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 630 CallFunc(GdipDeleteBrush)((GpSolidFill*)pBrush); | 630 CallFunc(GdipDeleteBrush)((GpSolidFill*)pBrush); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 void CGdiplusExt::GdipDisposeImage(void* bitmap) | 677 void CGdiplusExt::GdipDisposeImage(void* bitmap) |
| 678 { | 678 { |
| 679 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 679 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 680 CallFunc(GdipDisposeImage)((GpBitmap*)bitmap); | 680 CallFunc(GdipDisposeImage)((GpBitmap*)bitmap); |
| 681 } | 681 } |
| 682 void CGdiplusExt::GdipDeleteGraphics(void* graphics) | 682 void CGdiplusExt::GdipDeleteGraphics(void* graphics) |
| 683 { | 683 { |
| 684 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 684 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 685 CallFunc(GdipDeleteGraphics)((GpGraphics*)graphics); | 685 CallFunc(GdipDeleteGraphics)((GpGraphics*)graphics); |
| 686 } | 686 } |
| 687 FX_BOOL CGdiplusExt::StretchBitMask(HDC hDC, BOOL bMonoDevice, const CFX_DIBitma
p* pBitmap, int dest_left, int dest_top, | 687 bool CGdiplusExt::StretchBitMask(HDC hDC, BOOL bMonoDevice, const CFX_DIBitmap*
pBitmap, int dest_left, int dest_top, |
| 688 int dest_width, int dest_height, FX_DWORD ar
gb, const FX_RECT* pClipRect, int flags) | 688 int dest_width, int dest_height, FX_DWORD ar
gb, const FX_RECT* pClipRect, int flags) |
| 689 { | 689 { |
| 690 ASSERT(pBitmap->GetBPP() == 1); | 690 ASSERT(pBitmap->GetBPP() == 1); |
| 691 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 691 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 692 GpGraphics* pGraphics = NULL; | 692 GpGraphics* pGraphics = NULL; |
| 693 CallFunc(GdipCreateFromHDC)(hDC, &pGraphics); | 693 CallFunc(GdipCreateFromHDC)(hDC, &pGraphics); |
| 694 CallFunc(GdipSetPageUnit)(pGraphics, UnitPixel); | 694 CallFunc(GdipSetPageUnit)(pGraphics, UnitPixel); |
| 695 if (flags & FXDIB_NOSMOOTH) { | 695 if (flags & FXDIB_NOSMOOTH) { |
| 696 CallFunc(GdipSetInterpolationMode)(pGraphics, InterpolationModeNearestNe
ighbor); | 696 CallFunc(GdipSetInterpolationMode)(pGraphics, InterpolationModeNearestNe
ighbor); |
| 697 } else { | 697 } else { |
| 698 CallFunc(GdipSetInterpolationMode)(pGraphics, InterpolationModeHighQuali
ty); | 698 CallFunc(GdipSetInterpolationMode)(pGraphics, InterpolationModeHighQuali
ty); |
| 699 } | 699 } |
| 700 OutputImageMask(pGraphics, bMonoDevice, pBitmap, dest_left, dest_top, dest_w
idth, dest_height, argb, pClipRect); | 700 OutputImageMask(pGraphics, bMonoDevice, pBitmap, dest_left, dest_top, dest_w
idth, dest_height, argb, pClipRect); |
| 701 CallFunc(GdipDeleteGraphics)(pGraphics); | 701 CallFunc(GdipDeleteGraphics)(pGraphics); |
| 702 return TRUE; | 702 return true; |
| 703 } | 703 } |
| 704 FX_BOOL CGdiplusExt::StretchDIBits(HDC hDC, const CFX_DIBitmap* pBitmap, int des
t_left, int dest_top, | 704 bool CGdiplusExt::StretchDIBits(HDC hDC, const CFX_DIBitmap* pBitmap, int dest_l
eft, int dest_top, |
| 705 int dest_width, int dest_height, const FX_REC
T* pClipRect, int flags) | 705 int dest_width, int dest_height, const FX_REC
T* pClipRect, int flags) |
| 706 { | 706 { |
| 707 GpGraphics* pGraphics; | 707 GpGraphics* pGraphics; |
| 708 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 708 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 709 CallFunc(GdipCreateFromHDC)(hDC, &pGraphics); | 709 CallFunc(GdipCreateFromHDC)(hDC, &pGraphics); |
| 710 CallFunc(GdipSetPageUnit)(pGraphics, UnitPixel); | 710 CallFunc(GdipSetPageUnit)(pGraphics, UnitPixel); |
| 711 if (flags & FXDIB_NOSMOOTH) { | 711 if (flags & FXDIB_NOSMOOTH) { |
| 712 CallFunc(GdipSetInterpolationMode)(pGraphics, InterpolationModeNearestNe
ighbor); | 712 CallFunc(GdipSetInterpolationMode)(pGraphics, InterpolationModeNearestNe
ighbor); |
| 713 } else if (pBitmap->GetWidth() > abs(dest_width) / 2 || pBitmap->GetHeight()
> abs(dest_height) / 2) { | 713 } else if (pBitmap->GetWidth() > abs(dest_width) / 2 || pBitmap->GetHeight()
> abs(dest_height) / 2) { |
| 714 CallFunc(GdipSetInterpolationMode)(pGraphics, InterpolationModeHighQuali
ty); | 714 CallFunc(GdipSetInterpolationMode)(pGraphics, InterpolationModeHighQuali
ty); |
| 715 } else { | 715 } else { |
| 716 CallFunc(GdipSetInterpolationMode)(pGraphics, InterpolationModeBilinear)
; | 716 CallFunc(GdipSetInterpolationMode)(pGraphics, InterpolationModeBilinear)
; |
| 717 } | 717 } |
| 718 FX_RECT src_rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); | 718 FX_RECT src_rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); |
| 719 OutputImage(pGraphics, pBitmap, &src_rect, dest_left, dest_top, dest_width,
dest_height); | 719 OutputImage(pGraphics, pBitmap, &src_rect, dest_left, dest_top, dest_width,
dest_height); |
| 720 CallFunc(GdipDeleteGraphics)(pGraphics); | 720 CallFunc(GdipDeleteGraphics)(pGraphics); |
| 721 CallFunc(GdipDeleteGraphics)(pGraphics); | 721 CallFunc(GdipDeleteGraphics)(pGraphics); |
| 722 return TRUE; | 722 return true; |
| 723 } | 723 } |
| 724 static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, const CFX_Af
fineMatrix* pMatrix, DWORD argb, FX_BOOL bTextMode = FALSE) | 724 static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, const CFX_Af
fineMatrix* pMatrix, DWORD argb, bool bTextMode = false) |
| 725 { | 725 { |
| 726 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 726 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 727 FX_FLOAT width = pGraphState ? pGraphState->m_LineWidth : 1.0f; | 727 FX_FLOAT width = pGraphState ? pGraphState->m_LineWidth : 1.0f; |
| 728 if (!bTextMode) { | 728 if (!bTextMode) { |
| 729 FX_FLOAT unit = pMatrix == NULL ? 1.0f : FXSYS_Div(1.0f, (pMatrix->GetXU
nit() + pMatrix->GetYUnit()) / 2); | 729 FX_FLOAT unit = pMatrix == NULL ? 1.0f : FXSYS_Div(1.0f, (pMatrix->GetXU
nit() + pMatrix->GetYUnit()) / 2); |
| 730 if (width < unit) { | 730 if (width < unit) { |
| 731 width = unit; | 731 width = unit; |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 GpPen* pPen = NULL; | 734 GpPen* pPen = NULL; |
| 735 CallFunc(GdipCreatePen1)((ARGB)argb, width, UnitWorld, &pPen); | 735 CallFunc(GdipCreatePen1)((ARGB)argb, width, UnitWorld, &pPen); |
| 736 LineCap lineCap; | 736 LineCap lineCap; |
| 737 DashCap dashCap = DashCapFlat; | 737 DashCap dashCap = DashCapFlat; |
| 738 FX_BOOL bDashExtend = FALSE; | 738 bool bDashExtend = false; |
| 739 switch(pGraphState->m_LineCap) { | 739 switch(pGraphState->m_LineCap) { |
| 740 case CFX_GraphStateData::LineCapButt: | 740 case CFX_GraphStateData::LineCapButt: |
| 741 lineCap = LineCapFlat; | 741 lineCap = LineCapFlat; |
| 742 break; | 742 break; |
| 743 case CFX_GraphStateData::LineCapRound: | 743 case CFX_GraphStateData::LineCapRound: |
| 744 lineCap = LineCapRound; | 744 lineCap = LineCapRound; |
| 745 dashCap = DashCapRound; | 745 dashCap = DashCapRound; |
| 746 bDashExtend = TRUE; | 746 bDashExtend = true; |
| 747 break; | 747 break; |
| 748 case CFX_GraphStateData::LineCapSquare: | 748 case CFX_GraphStateData::LineCapSquare: |
| 749 lineCap = LineCapSquare; | 749 lineCap = LineCapSquare; |
| 750 bDashExtend = TRUE; | 750 bDashExtend = true; |
| 751 break; | 751 break; |
| 752 } | 752 } |
| 753 CallFunc(GdipSetPenLineCap197819)(pPen, lineCap, lineCap, dashCap); | 753 CallFunc(GdipSetPenLineCap197819)(pPen, lineCap, lineCap, dashCap); |
| 754 LineJoin lineJoin; | 754 LineJoin lineJoin; |
| 755 switch(pGraphState->m_LineJoin) { | 755 switch(pGraphState->m_LineJoin) { |
| 756 case CFX_GraphStateData::LineJoinMiter: | 756 case CFX_GraphStateData::LineJoinMiter: |
| 757 lineJoin = LineJoinMiterClipped; | 757 lineJoin = LineJoinMiterClipped; |
| 758 break; | 758 break; |
| 759 case CFX_GraphStateData::LineJoinRound: | 759 case CFX_GraphStateData::LineJoinRound: |
| 760 lineJoin = LineJoinRound; | 760 lineJoin = LineJoinRound; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 if (pMatrix) { | 832 if (pMatrix) { |
| 833 pMatrix->Transform(x1, y1); | 833 pMatrix->Transform(x1, y1); |
| 834 pMatrix->Transform(x2, y2); | 834 pMatrix->Transform(x2, y2); |
| 835 } | 835 } |
| 836 FX_FLOAT dx = x1 - x2; | 836 FX_FLOAT dx = x1 - x2; |
| 837 FX_FLOAT dy = y1 - y2; | 837 FX_FLOAT dy = y1 - y2; |
| 838 FX_FLOAT distance_square = FXSYS_Mul(dx, dx) + FXSYS_Mul(dy, dy); | 838 FX_FLOAT distance_square = FXSYS_Mul(dx, dx) + FXSYS_Mul(dy, dy); |
| 839 if (distance_square < (1.0f * 2 + 1.0f / 4)) { | 839 if (distance_square < (1.0f * 2 + 1.0f / 4)) { |
| 840 v1 = i; | 840 v1 = i; |
| 841 v2 = pair1; | 841 v2 = pair1; |
| 842 return TRUE; | 842 return true; |
| 843 } | 843 } |
| 844 } | 844 } |
| 845 return FALSE; | 845 return false; |
| 846 } | 846 } |
| 847 BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, | 847 BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, |
| 848 const CFX_AffineMatrix* pObject2Device, | 848 const CFX_AffineMatrix* pObject2Device, |
| 849 const CFX_GraphStateData* pGraphState, | 849 const CFX_GraphStateData* pGraphState, |
| 850 FX_DWORD fill_argb, | 850 FX_DWORD fill_argb, |
| 851 FX_DWORD stroke_argb, | 851 FX_DWORD stroke_argb, |
| 852 int fill_mode | 852 int fill_mode |
| 853 ) | 853 ) |
| 854 { | 854 { |
| 855 int nPoints = pPathData->GetPointCount(); | 855 int nPoints = pPathData->GetPointCount(); |
| 856 if (nPoints == 0) { | 856 if (nPoints == 0) { |
| 857 return TRUE; | 857 return true; |
| 858 } | 858 } |
| 859 FX_PATHPOINT* pPoints = pPathData->GetPoints(); | 859 FX_PATHPOINT* pPoints = pPathData->GetPoints(); |
| 860 GpGraphics* pGraphics = NULL; | 860 GpGraphics* pGraphics = NULL; |
| 861 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 861 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 862 CallFunc(GdipCreateFromHDC)(hDC, &pGraphics); | 862 CallFunc(GdipCreateFromHDC)(hDC, &pGraphics); |
| 863 CallFunc(GdipSetPageUnit)(pGraphics, UnitPixel); | 863 CallFunc(GdipSetPageUnit)(pGraphics, UnitPixel); |
| 864 CallFunc(GdipSetPixelOffsetMode)(pGraphics, PixelOffsetModeHalf); | 864 CallFunc(GdipSetPixelOffsetMode)(pGraphics, PixelOffsetModeHalf); |
| 865 GpMatrix* pMatrix = NULL; | 865 GpMatrix* pMatrix = NULL; |
| 866 if (pObject2Device) { | 866 if (pObject2Device) { |
| 867 CallFunc(GdipCreateMatrix2)(pObject2Device->a, pObject2Device->b, pObjec
t2Device->c, pObject2Device->d, pObject2Device->e, pObject2Device->f, &pMatrix); | 867 CallFunc(GdipCreateMatrix2)(pObject2Device->a, pObject2Device->b, pObjec
t2Device->c, pObject2Device->d, pObject2Device->e, pObject2Device->f, &pMatrix); |
| 868 CallFunc(GdipSetWorldTransform)(pGraphics, pMatrix); | 868 CallFunc(GdipSetWorldTransform)(pGraphics, pMatrix); |
| 869 } | 869 } |
| 870 PointF *points = FX_Alloc(PointF, nPoints); | 870 PointF *points = FX_Alloc(PointF, nPoints); |
| 871 BYTE * types = FX_Alloc(BYTE, nPoints); | 871 BYTE * types = FX_Alloc(BYTE, nPoints); |
| 872 int nSubPathes = 0; | 872 int nSubPathes = 0; |
| 873 FX_BOOL bSubClose = FALSE; | 873 bool bSubClose = false; |
| 874 int pos_subclose = 0; | 874 int pos_subclose = 0; |
| 875 FX_BOOL bSmooth = FALSE; | 875 bool bSmooth = false; |
| 876 int startpoint = 0; | 876 int startpoint = 0; |
| 877 for(int i = 0; i < nPoints; i++) { | 877 for(int i = 0; i < nPoints; i++) { |
| 878 points[i].X = pPoints[i].m_PointX; | 878 points[i].X = pPoints[i].m_PointX; |
| 879 points[i].Y = pPoints[i].m_PointY; | 879 points[i].Y = pPoints[i].m_PointY; |
| 880 FX_FLOAT x, y; | 880 FX_FLOAT x, y; |
| 881 if (pObject2Device) { | 881 if (pObject2Device) { |
| 882 pObject2Device->Transform(pPoints[i].m_PointX, pPoints[i].m_PointY,
x, y); | 882 pObject2Device->Transform(pPoints[i].m_PointX, pPoints[i].m_PointY,
x, y); |
| 883 } else { | 883 } else { |
| 884 x = pPoints[i].m_PointX; | 884 x = pPoints[i].m_PointX; |
| 885 y = pPoints[i].m_PointY; | 885 y = pPoints[i].m_PointY; |
| 886 } | 886 } |
| 887 if (x > 50000 * 1.0f) { | 887 if (x > 50000 * 1.0f) { |
| 888 points[i].X = 50000 * 1.0f; | 888 points[i].X = 50000 * 1.0f; |
| 889 } | 889 } |
| 890 if (x < -50000 * 1.0f) { | 890 if (x < -50000 * 1.0f) { |
| 891 points[i].X = -50000 * 1.0f; | 891 points[i].X = -50000 * 1.0f; |
| 892 } | 892 } |
| 893 if (y > 50000 * 1.0f) { | 893 if (y > 50000 * 1.0f) { |
| 894 points[i].Y = 50000 * 1.0f; | 894 points[i].Y = 50000 * 1.0f; |
| 895 } | 895 } |
| 896 if (y < -50000 * 1.0f) { | 896 if (y < -50000 * 1.0f) { |
| 897 points[i].Y = -50000 * 1.0f; | 897 points[i].Y = -50000 * 1.0f; |
| 898 } | 898 } |
| 899 int point_type = pPoints[i].m_Flag & FXPT_TYPE; | 899 int point_type = pPoints[i].m_Flag & FXPT_TYPE; |
| 900 if(point_type == FXPT_MOVETO) { | 900 if(point_type == FXPT_MOVETO) { |
| 901 types[i] = PathPointTypeStart; | 901 types[i] = PathPointTypeStart; |
| 902 nSubPathes ++; | 902 nSubPathes ++; |
| 903 bSubClose = FALSE; | 903 bSubClose = false; |
| 904 startpoint = i; | 904 startpoint = i; |
| 905 } else if (point_type == FXPT_LINETO) { | 905 } else if (point_type == FXPT_LINETO) { |
| 906 types[i] = PathPointTypeLine; | 906 types[i] = PathPointTypeLine; |
| 907 if (pPoints[i - 1].m_Flag == FXPT_MOVETO && (i == nPoints - 1 || pPo
ints[i + 1].m_Flag == FXPT_MOVETO) && | 907 if (pPoints[i - 1].m_Flag == FXPT_MOVETO && (i == nPoints - 1 || pPo
ints[i + 1].m_Flag == FXPT_MOVETO) && |
| 908 points[i].Y == points[i - 1].Y && points[i].X == points[i -
1].X) { | 908 points[i].Y == points[i - 1].Y && points[i].X == points[i -
1].X) { |
| 909 points[i].X += 0.01f; | 909 points[i].X += 0.01f; |
| 910 continue; | 910 continue; |
| 911 } | 911 } |
| 912 if (!bSmooth && points[i].X != points[i - 1].X && points[i].Y != poi
nts[i - 1].Y) { | 912 if (!bSmooth && points[i].X != points[i - 1].X && points[i].Y != poi
nts[i - 1].Y) { |
| 913 bSmooth = TRUE; | 913 bSmooth = true; |
| 914 } | 914 } |
| 915 } else if (point_type == FXPT_BEZIERTO) { | 915 } else if (point_type == FXPT_BEZIERTO) { |
| 916 types[i] = PathPointTypeBezier; | 916 types[i] = PathPointTypeBezier; |
| 917 bSmooth = TRUE; | 917 bSmooth = true; |
| 918 } | 918 } |
| 919 if (pPoints[i].m_Flag & FXPT_CLOSEFIGURE) { | 919 if (pPoints[i].m_Flag & FXPT_CLOSEFIGURE) { |
| 920 if (bSubClose) { | 920 if (bSubClose) { |
| 921 types[pos_subclose] &= ~PathPointTypeCloseSubpath; | 921 types[pos_subclose] &= ~PathPointTypeCloseSubpath; |
| 922 } else { | 922 } else { |
| 923 bSubClose = TRUE; | 923 bSubClose = true; |
| 924 } | 924 } |
| 925 pos_subclose = i; | 925 pos_subclose = i; |
| 926 types[i] |= PathPointTypeCloseSubpath; | 926 types[i] |= PathPointTypeCloseSubpath; |
| 927 if (!bSmooth && points[i].X != points[startpoint].X && points[i].Y !
= points[startpoint].Y) { | 927 if (!bSmooth && points[i].X != points[startpoint].X && points[i].Y !
= points[startpoint].Y) { |
| 928 bSmooth = TRUE; | 928 bSmooth = true; |
| 929 } | 929 } |
| 930 } | 930 } |
| 931 } | 931 } |
| 932 if (fill_mode & FXFILL_NOPATHSMOOTH) { | 932 if (fill_mode & FXFILL_NOPATHSMOOTH) { |
| 933 bSmooth = FALSE; | 933 bSmooth = false; |
| 934 CallFunc(GdipSetSmoothingMode)(pGraphics, SmoothingModeNone); | 934 CallFunc(GdipSetSmoothingMode)(pGraphics, SmoothingModeNone); |
| 935 } else if (!(fill_mode & FXFILL_FULLCOVER)) { | 935 } else if (!(fill_mode & FXFILL_FULLCOVER)) { |
| 936 if (!bSmooth && (fill_mode & 3)) { | 936 if (!bSmooth && (fill_mode & 3)) { |
| 937 bSmooth = TRUE; | 937 bSmooth = true; |
| 938 } | 938 } |
| 939 if (bSmooth || (pGraphState && pGraphState->m_LineWidth > 2)) { | 939 if (bSmooth || (pGraphState && pGraphState->m_LineWidth > 2)) { |
| 940 CallFunc(GdipSetSmoothingMode)(pGraphics, SmoothingModeAntiAlias); | 940 CallFunc(GdipSetSmoothingMode)(pGraphics, SmoothingModeAntiAlias); |
| 941 } | 941 } |
| 942 } | 942 } |
| 943 int new_fill_mode = fill_mode & 3; | 943 int new_fill_mode = fill_mode & 3; |
| 944 if (nPoints == 4 && pGraphState == NULL) { | 944 if (nPoints == 4 && pGraphState == NULL) { |
| 945 int v1, v2; | 945 int v1, v2; |
| 946 if (IsSmallTriangle(points, pObject2Device, v1, v2)) { | 946 if (IsSmallTriangle(points, pObject2Device, v1, v2)) { |
| 947 GpPen* pPen = NULL; | 947 GpPen* pPen = NULL; |
| 948 CallFunc(GdipCreatePen1)(fill_argb, 1.0f, UnitPixel, &pPen); | 948 CallFunc(GdipCreatePen1)(fill_argb, 1.0f, UnitPixel, &pPen); |
| 949 CallFunc(GdipDrawLineI)(pGraphics, pPen, FXSYS_round(points[v1].X),
FXSYS_round(points[v1].Y), | 949 CallFunc(GdipDrawLineI)(pGraphics, pPen, FXSYS_round(points[v1].X),
FXSYS_round(points[v1].Y), |
| 950 FXSYS_round(points[v2].X), FXSYS_round(point
s[v2].Y)); | 950 FXSYS_round(points[v2].X), FXSYS_round(point
s[v2].Y)); |
| 951 CallFunc(GdipDeletePen)(pPen); | 951 CallFunc(GdipDeletePen)(pPen); |
| 952 return TRUE; | 952 return true; |
| 953 } | 953 } |
| 954 } | 954 } |
| 955 GpPath* pGpPath = NULL; | 955 GpPath* pGpPath = NULL; |
| 956 CallFunc(GdipCreatePath2)(points, types, nPoints, GdiFillType2Gdip(new_fill_
mode), &pGpPath); | 956 CallFunc(GdipCreatePath2)(points, types, nPoints, GdiFillType2Gdip(new_fill_
mode), &pGpPath); |
| 957 if (!pGpPath) { | 957 if (!pGpPath) { |
| 958 if (pMatrix) { | 958 if (pMatrix) { |
| 959 CallFunc(GdipDeleteMatrix)(pMatrix); | 959 CallFunc(GdipDeleteMatrix)(pMatrix); |
| 960 } | 960 } |
| 961 FX_Free(points); | 961 FX_Free(points); |
| 962 FX_Free(types); | 962 FX_Free(types); |
| 963 CallFunc(GdipDeleteGraphics)(pGraphics); | 963 CallFunc(GdipDeleteGraphics)(pGraphics); |
| 964 return FALSE; | 964 return false; |
| 965 } | 965 } |
| 966 if (new_fill_mode) { | 966 if (new_fill_mode) { |
| 967 GpBrush* pBrush = _GdipCreateBrush(fill_argb); | 967 GpBrush* pBrush = _GdipCreateBrush(fill_argb); |
| 968 CallFunc(GdipSetPathFillMode)(pGpPath, GdiFillType2Gdip(new_fill_mode)); | 968 CallFunc(GdipSetPathFillMode)(pGpPath, GdiFillType2Gdip(new_fill_mode)); |
| 969 CallFunc(GdipFillPath)(pGraphics, pBrush, pGpPath); | 969 CallFunc(GdipFillPath)(pGraphics, pBrush, pGpPath); |
| 970 CallFunc(GdipDeleteBrush)(pBrush); | 970 CallFunc(GdipDeleteBrush)(pBrush); |
| 971 } | 971 } |
| 972 if (pGraphState && stroke_argb) { | 972 if (pGraphState && stroke_argb) { |
| 973 GpPen* pPen = _GdipCreatePen(pGraphState, pObject2Device, stroke_argb, f
ill_mode & FX_STROKE_TEXT_MODE); | 973 GpPen* pPen = _GdipCreatePen(pGraphState, pObject2Device, stroke_argb, f
ill_mode & FX_STROKE_TEXT_MODE); |
| 974 if (nSubPathes == 1) { | 974 if (nSubPathes == 1) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 987 } | 987 } |
| 988 CallFunc(GdipDeletePen)(pPen); | 988 CallFunc(GdipDeletePen)(pPen); |
| 989 } | 989 } |
| 990 if (pMatrix) { | 990 if (pMatrix) { |
| 991 CallFunc(GdipDeleteMatrix)(pMatrix); | 991 CallFunc(GdipDeleteMatrix)(pMatrix); |
| 992 } | 992 } |
| 993 FX_Free(points); | 993 FX_Free(points); |
| 994 FX_Free(types); | 994 FX_Free(types); |
| 995 CallFunc(GdipDeletePath)(pGpPath); | 995 CallFunc(GdipDeletePath)(pGpPath); |
| 996 CallFunc(GdipDeleteGraphics)(pGraphics); | 996 CallFunc(GdipDeleteGraphics)(pGraphics); |
| 997 return TRUE; | 997 return true; |
| 998 } | 998 } |
| 999 class GpStream final : public IStream | 999 class GpStream final : public IStream |
| 1000 { | 1000 { |
| 1001 LONG m_RefCount; | 1001 LONG m_RefCount; |
| 1002 int m_ReadPos; | 1002 int m_ReadPos; |
| 1003 CFX_ByteTextBuf m_InterStream; | 1003 CFX_ByteTextBuf m_InterStream; |
| 1004 public: | 1004 public: |
| 1005 GpStream() | 1005 GpStream() |
| 1006 { | 1006 { |
| 1007 m_RefCount = 1; | 1007 m_RefCount = 1; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; | 1222 CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatform
Data())->m_GdiplusExt; |
| 1223 CallFunc(GdipBitmapUnlockBits)(pInfo->pBitmap, pInfo->pBitmapData); | 1223 CallFunc(GdipBitmapUnlockBits)(pInfo->pBitmap, pInfo->pBitmapData); |
| 1224 CallFunc(GdipDisposeImage)(pInfo->pBitmap); | 1224 CallFunc(GdipDisposeImage)(pInfo->pBitmap); |
| 1225 FX_Free(pInfo->pBitmapData); | 1225 FX_Free(pInfo->pBitmapData); |
| 1226 FX_Free((LPBYTE)pInfo->pbmi); | 1226 FX_Free((LPBYTE)pInfo->pbmi); |
| 1227 if (pInfo->pStream) { | 1227 if (pInfo->pStream) { |
| 1228 pInfo->pStream->Release(); | 1228 pInfo->pStream->Release(); |
| 1229 } | 1229 } |
| 1230 FX_Free(pInfo); | 1230 FX_Free(pInfo); |
| 1231 } | 1231 } |
| 1232 CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, FX_BOOL
bAlpha); | 1232 CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, bool bA
lpha); |
| 1233 CFX_DIBitmap* CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) | 1233 CFX_DIBitmap* CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) |
| 1234 { | 1234 { |
| 1235 PREVIEW3_DIBITMAP* pInfo = ::LoadDIBitmap(args); | 1235 PREVIEW3_DIBITMAP* pInfo = ::LoadDIBitmap(args); |
| 1236 if (pInfo == NULL) { | 1236 if (pInfo == NULL) { |
| 1237 return NULL; | 1237 return NULL; |
| 1238 } | 1238 } |
| 1239 int height = abs(pInfo->pbmi->bmiHeader.biHeight); | 1239 int height = abs(pInfo->pbmi->bmiHeader.biHeight); |
| 1240 int width = pInfo->pbmi->bmiHeader.biWidth; | 1240 int width = pInfo->pbmi->bmiHeader.biWidth; |
| 1241 int dest_pitch = (width * pInfo->pbmi->bmiHeader.biBitCount + 31) / 32 * 4; | 1241 int dest_pitch = (width * pInfo->pbmi->bmiHeader.biBitCount + 31) / 32 * 4; |
| 1242 LPBYTE pData = FX_Alloc2D(BYTE, dest_pitch, height); | 1242 LPBYTE pData = FX_Alloc2D(BYTE, dest_pitch, height); |
| 1243 if (dest_pitch == pInfo->Stride) { | 1243 if (dest_pitch == pInfo->Stride) { |
| 1244 FXSYS_memcpy(pData, pInfo->pScan0, dest_pitch * height); | 1244 FXSYS_memcpy(pData, pInfo->pScan0, dest_pitch * height); |
| 1245 } else { | 1245 } else { |
| 1246 for (int i = 0; i < height; i ++) { | 1246 for (int i = 0; i < height; i ++) { |
| 1247 FXSYS_memcpy(pData + dest_pitch * i, pInfo->pScan0 + pInfo->Stride *
i, dest_pitch); | 1247 FXSYS_memcpy(pData + dest_pitch * i, pInfo->pScan0 + pInfo->Stride *
i, dest_pitch); |
| 1248 } | 1248 } |
| 1249 } | 1249 } |
| 1250 CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf(pInfo->pbmi, pData, pIn
fo->pbmi->bmiHeader.biBitCount == 32); | 1250 CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf(pInfo->pbmi, pData, pIn
fo->pbmi->bmiHeader.biBitCount == 32); |
| 1251 FX_Free(pData); | 1251 FX_Free(pData); |
| 1252 FreeDIBitmap(pInfo); | 1252 FreeDIBitmap(pInfo); |
| 1253 return pDIBitmap; | 1253 return pDIBitmap; |
| 1254 } | 1254 } |
| 1255 #endif | 1255 #endif |
| OLD | NEW |