Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: fpdfsdk/src/fpdfview.cpp

Issue 1551563002: Fix partial information printed with blank window covering the center (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "public/fpdfview.h" 7 #include "public/fpdfview.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 int rotate, 329 int rotate,
330 int flags) { 330 int flags) {
331 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 331 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
332 if (!pPage) 332 if (!pPage)
333 return; 333 return;
334 334
335 CRenderContext* pContext = new CRenderContext; 335 CRenderContext* pContext = new CRenderContext;
336 pPage->SetPrivateData((void*)1, pContext, DropContext); 336 pPage->SetPrivateData((void*)1, pContext, DropContext);
337 337
338 #ifndef _WIN32_WCE 338 #ifndef _WIN32_WCE
339 CFX_DIBitmap* pBitmap = NULL; 339 CFX_DIBitmap* pBitmap = nullptr;
340 FX_BOOL bBackgroundAlphaNeeded = FALSE; 340 FX_BOOL bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded();
341 bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded(); 341 FX_BOOL bHasImageMask = pPage->HasImageMask();
342 if (bBackgroundAlphaNeeded) { 342 if (bBackgroundAlphaNeeded || bHasImageMask) {
343 pBitmap = new CFX_DIBitmap; 343 pBitmap = new CFX_DIBitmap;
344 pBitmap->Create(size_x, size_y, FXDIB_Argb); 344 pBitmap->Create(size_x, size_y, FXDIB_Argb);
345 pBitmap->Clear(0x00ffffff); 345 pBitmap->Clear(0x00ffffff);
346 #ifdef _SKIA_SUPPORT_ 346 #ifdef _SKIA_SUPPORT_
347 pContext->m_pDevice = new CFX_SkiaDevice; 347 pContext->m_pDevice = new CFX_SkiaDevice;
348 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap); 348 ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap);
349 #else 349 #else
350 pContext->m_pDevice = new CFX_FxgeDevice; 350 pContext->m_pDevice = new CFX_FxgeDevice;
351 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap); 351 ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap);
352 #endif 352 #endif
353 } else 353 } else {
354 pContext->m_pDevice = new CFX_WindowsDevice(dc); 354 pContext->m_pDevice = new CFX_WindowsDevice(dc);
355 }
355 356
356 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, 357 FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
357 rotate, flags, TRUE, NULL); 358 rotate, flags, TRUE, NULL);
358 359
359 if (bBackgroundAlphaNeeded) { 360 if (bBackgroundAlphaNeeded || bHasImageMask) {
360 if (pBitmap) { 361 if (pBitmap) {
361 CFX_WindowsDevice WinDC(dc); 362 CFX_WindowsDevice WinDC(dc);
362 363
363 if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) { 364 if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) {
364 CFX_DIBitmap* pDst = new CFX_DIBitmap; 365 CFX_DIBitmap* pDst = new CFX_DIBitmap;
365 int pitch = pBitmap->GetPitch(); 366 int pitch = pBitmap->GetPitch();
366 pDst->Create(size_x, size_y, FXDIB_Rgb32); 367 pDst->Create(size_x, size_y, FXDIB_Rgb32);
367 FXSYS_memset(pDst->GetBuffer(), -1, pitch * size_y); 368 FXSYS_memset(pDst->GetBuffer(), -1, pitch * size_y);
368 pDst->CompositeBitmap(0, 0, size_x, size_y, pBitmap, 0, 0, 369 pDst->CompositeBitmap(0, 0, size_x, size_y, pBitmap, 0, 0,
369 FXDIB_BLEND_NORMAL, NULL, FALSE, NULL); 370 FXDIB_BLEND_NORMAL, NULL, FALSE, NULL);
370 WinDC.StretchDIBits(pDst, 0, 0, size_x, size_y); 371 WinDC.StretchDIBits(pDst, 0, 0, size_x, size_y);
371 delete pDst; 372 delete pDst;
372 } else 373 } else {
373 WinDC.SetDIBits(pBitmap, 0, 0); 374 WinDC.SetDIBits(pBitmap, 0, 0);
375 }
374 } 376 }
375 } 377 }
376 #else 378 #else
377 // get clip region 379 // get clip region
378 RECT rect, cliprect; 380 RECT rect, cliprect;
379 rect.left = start_x; 381 rect.left = start_x;
380 rect.top = start_y; 382 rect.top = start_y;
381 rect.right = start_x + size_x; 383 rect.right = start_x + size_x;
382 rect.bottom = start_y + size_y; 384 rect.bottom = start_y + size_y;
383 GetClipBox(dc, &cliprect); 385 GetClipBox(dc, &cliprect);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 466
465 BitBlt(dc, rect.left, rect.top, width, height, hMemDC, 0, 0, SRCCOPY); 467 BitBlt(dc, rect.left, rect.top, width, height, hMemDC, 0, 0, SRCCOPY);
466 SelectObject(hMemDC, hOldBitmap); 468 SelectObject(hMemDC, hOldBitmap);
467 DeleteDC(hMemDC); 469 DeleteDC(hMemDC);
468 470
469 #ifdef DEBUG_TRACE 471 #ifdef DEBUG_TRACE
470 CPDF_ModuleMgr::Get()->ReportError(999, "Finished screen rendering"); 472 CPDF_ModuleMgr::Get()->ReportError(999, "Finished screen rendering");
471 #endif 473 #endif
472 474
473 #endif 475 #endif
474 if (bBackgroundAlphaNeeded) { 476 if (bBackgroundAlphaNeeded || bHasImageMask)
475 delete pBitmap; 477 delete pBitmap;
476 pBitmap = NULL; 478
477 }
478 delete pContext; 479 delete pContext;
479 pPage->RemovePrivateData((void*)1); 480 pPage->RemovePrivateData((void*)1);
480 } 481 }
481 #endif 482 #endif
482 483
483 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, 484 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
484 FPDF_PAGE page, 485 FPDF_PAGE page,
485 int start_x, 486 int start_x,
486 int start_y, 487 int start_y,
487 int size_x, 488 int size_x,
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 if (!buffer) { 905 if (!buffer) {
905 *buflen = len; 906 *buflen = len;
906 } else if (*buflen >= len) { 907 } else if (*buflen >= len) {
907 memcpy(buffer, utf16Name.c_str(), len); 908 memcpy(buffer, utf16Name.c_str(), len);
908 *buflen = len; 909 *buflen = len;
909 } else { 910 } else {
910 *buflen = -1; 911 *buflen = -1;
911 } 912 }
912 return (FPDF_DEST)pDestObj; 913 return (FPDF_DEST)pDestObj;
913 } 914 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698