| 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 | 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 <windows.h> | 10 #include <windows.h> |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 CFX_DIBitmap* pStretched = new CFX_DIBitmap; | 477 CFX_DIBitmap* pStretched = new CFX_DIBitmap; |
| 478 if (!pStretched->Create(result_width, result_height, FXDIB_8bppRgb)) { | 478 if (!pStretched->Create(result_width, result_height, FXDIB_8bppRgb)) { |
| 479 delete pStretched; | 479 delete pStretched; |
| 480 return NULL; | 480 return NULL; |
| 481 } | 481 } |
| 482 LPBYTE dest_buf = pStretched->GetBuffer(); | 482 LPBYTE dest_buf = pStretched->GetBuffer(); |
| 483 int src_width = pSource->GetWidth(); | 483 int src_width = pSource->GetWidth(); |
| 484 int src_height = pSource->GetHeight(); | 484 int src_height = pSource->GetHeight(); |
| 485 int src_count = src_width * src_height; | 485 int src_count = src_width * src_height; |
| 486 int dest_count = dest_width * dest_height; | 486 int dest_count = dest_width * dest_height; |
| 487 int ratio = 255 * dest_count / src_count; | |
| 488 int y_unit = src_height / dest_height; | 487 int y_unit = src_height / dest_height; |
| 489 int x_unit = src_width / dest_width; | 488 int x_unit = src_width / dest_width; |
| 490 int area_unit = y_unit * x_unit; | 489 int area_unit = y_unit * x_unit; |
| 491 LPBYTE src_buf = pSource->GetBuffer(); | 490 LPBYTE src_buf = pSource->GetBuffer(); |
| 492 int src_pitch = pSource->GetPitch(); | 491 int src_pitch = pSource->GetPitch(); |
| 493 for (int dest_y = 0; dest_y < result_height; dest_y++) { | 492 for (int dest_y = 0; dest_y < result_height; dest_y++) { |
| 494 LPBYTE dest_scan = dest_buf + dest_y * result_pitch; | 493 LPBYTE dest_scan = dest_buf + dest_y * result_pitch; |
| 495 int src_y_start = bFlipY ? (dest_height - 1 - dest_y - pClipRect->top) | 494 int src_y_start = bFlipY ? (dest_height - 1 - dest_y - pClipRect->top) |
| 496 : (dest_y + pClipRect->top); | 495 : (dest_y + pClipRect->top); |
| 497 src_y_start = src_y_start * src_height / dest_height; | 496 src_y_start = src_y_start * src_height / dest_height; |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 dest_pitch); | 1509 dest_pitch); |
| 1511 } | 1510 } |
| 1512 } | 1511 } |
| 1513 CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf( | 1512 CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf( |
| 1514 pInfo->pbmi, pData, pInfo->pbmi->bmiHeader.biBitCount == 32); | 1513 pInfo->pbmi, pData, pInfo->pbmi->bmiHeader.biBitCount == 32); |
| 1515 FX_Free(pData); | 1514 FX_Free(pData); |
| 1516 FreeDIBitmap(pInfo); | 1515 FreeDIBitmap(pInfo); |
| 1517 return pDIBitmap; | 1516 return pDIBitmap; |
| 1518 } | 1517 } |
| 1519 #endif | 1518 #endif |
| OLD | NEW |