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/fxge/include/fx_ge.h" | 7 #include "core/fxge/include/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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL); | 500 m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL); |
501 m_Width = ::GetDeviceCaps(m_hDC, HORZRES); | 501 m_Width = ::GetDeviceCaps(m_hDC, HORZRES); |
502 m_Height = ::GetDeviceCaps(m_hDC, VERTRES); | 502 m_Height = ::GetDeviceCaps(m_hDC, VERTRES); |
503 } | 503 } |
504 if (m_DeviceClass != FXDC_DISPLAY) { | 504 if (m_DeviceClass != FXDC_DISPLAY) { |
505 m_RenderCaps = FXRC_BIT_MASK; | 505 m_RenderCaps = FXRC_BIT_MASK; |
506 } else { | 506 } else { |
507 m_RenderCaps = FXRC_GET_BITS | FXRC_BIT_MASK; | 507 m_RenderCaps = FXRC_GET_BITS | FXRC_BIT_MASK; |
508 } | 508 } |
509 } | 509 } |
| 510 |
510 int CGdiDeviceDriver::GetDeviceCaps(int caps_id) { | 511 int CGdiDeviceDriver::GetDeviceCaps(int caps_id) { |
511 switch (caps_id) { | 512 switch (caps_id) { |
512 case FXDC_DEVICE_CLASS: | 513 case FXDC_DEVICE_CLASS: |
513 return m_DeviceClass; | 514 return m_DeviceClass; |
514 case FXDC_PIXEL_WIDTH: | 515 case FXDC_PIXEL_WIDTH: |
515 return m_Width; | 516 return m_Width; |
516 case FXDC_PIXEL_HEIGHT: | 517 case FXDC_PIXEL_HEIGHT: |
517 return m_Height; | 518 return m_Height; |
518 case FXDC_BITS_PIXEL: | 519 case FXDC_BITS_PIXEL: |
519 return m_nBitsPerPixel; | 520 return m_nBitsPerPixel; |
520 case FXDC_RENDER_CAPS: | 521 case FXDC_RENDER_CAPS: |
521 return m_RenderCaps; | 522 return m_RenderCaps; |
522 } | 523 } |
523 return 0; | 524 return 0; |
524 } | 525 } |
| 526 |
| 527 void CGdiDeviceDriver::SaveState() { |
| 528 SaveDC(m_hDC); |
| 529 } |
| 530 |
| 531 void CGdiDeviceDriver::RestoreState(bool bKeepSaved) { |
| 532 RestoreDC(m_hDC, -1); |
| 533 if (bKeepSaved) |
| 534 SaveDC(m_hDC); |
| 535 } |
| 536 |
525 void* CGdiDeviceDriver::GetClipRgn() { | 537 void* CGdiDeviceDriver::GetClipRgn() { |
526 HRGN hClipRgn = CreateRectRgn(0, 0, 1, 1); | 538 HRGN hClipRgn = CreateRectRgn(0, 0, 1, 1); |
527 if (::GetClipRgn(m_hDC, hClipRgn) == 0) { | 539 if (::GetClipRgn(m_hDC, hClipRgn) == 0) { |
528 DeleteObject(hClipRgn); | 540 DeleteObject(hClipRgn); |
529 hClipRgn = NULL; | 541 hClipRgn = NULL; |
530 } | 542 } |
531 return (void*)hClipRgn; | 543 return (void*)hClipRgn; |
532 } | 544 } |
533 FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, | 545 FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, |
534 const FX_RECT* pSrcRect, | 546 const FX_RECT* pSrcRect, |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 SelectObject(m_hDC, m_hOldBitmap); | 1488 SelectObject(m_hDC, m_hOldBitmap); |
1477 DeleteDC(m_hDC); | 1489 DeleteDC(m_hDC); |
1478 } | 1490 } |
1479 if (m_hBitmap) { | 1491 if (m_hBitmap) { |
1480 DeleteObject(m_hBitmap); | 1492 DeleteObject(m_hBitmap); |
1481 } | 1493 } |
1482 delete GetBitmap(); | 1494 delete GetBitmap(); |
1483 } | 1495 } |
1484 | 1496 |
1485 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 1497 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
OLD | NEW |