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

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

Issue 1513363002: Remove CFX_AffineMatrix/CPDF_Matrix (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits Created 5 years 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 | « fpdfsdk/src/fpdfformfill.cpp ('k') | fpdfsdk/src/fsdk_annothandler.cpp » ('j') | 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 "core/include/fxcodec/fx_codec.h" 9 #include "core/include/fxcodec/fx_codec.h"
10 #include "core/include/fxcrt/fx_safe_types.h" 10 #include "core/include/fxcrt/fx_safe_types.h"
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 int size_y, 555 int size_y,
556 int rotate, 556 int rotate,
557 int device_x, 557 int device_x,
558 int device_y, 558 int device_y,
559 double* page_x, 559 double* page_x,
560 double* page_y) { 560 double* page_y) {
561 if (page == NULL || page_x == NULL || page_y == NULL) 561 if (page == NULL || page_x == NULL || page_y == NULL)
562 return; 562 return;
563 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); 563 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
564 564
565 CPDF_Matrix page2device; 565 CFX_Matrix page2device;
566 pPage->GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, 566 pPage->GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y,
567 rotate); 567 rotate);
568 CPDF_Matrix device2page; 568 CFX_Matrix device2page;
569 device2page.SetReverse(page2device); 569 device2page.SetReverse(page2device);
570 570
571 FX_FLOAT page_x_f, page_y_f; 571 FX_FLOAT page_x_f, page_y_f;
572 device2page.Transform((FX_FLOAT)(device_x), (FX_FLOAT)(device_y), page_x_f, 572 device2page.Transform((FX_FLOAT)(device_x), (FX_FLOAT)(device_y), page_x_f,
573 page_y_f); 573 page_y_f);
574 574
575 *page_x = (page_x_f); 575 *page_x = (page_x_f);
576 *page_y = (page_y_f); 576 *page_y = (page_y_f);
577 } 577 }
578 578
579 DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, 579 DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
580 int start_x, 580 int start_x,
581 int start_y, 581 int start_y,
582 int size_x, 582 int size_x,
583 int size_y, 583 int size_y,
584 int rotate, 584 int rotate,
585 double page_x, 585 double page_x,
586 double page_y, 586 double page_y,
587 int* device_x, 587 int* device_x,
588 int* device_y) { 588 int* device_y) {
589 if (!device_x || !device_y) 589 if (!device_x || !device_y)
590 return; 590 return;
591 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); 591 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
592 if (!pPage) 592 if (!pPage)
593 return; 593 return;
594 CPDF_Matrix page2device; 594 CFX_Matrix page2device;
595 pPage->GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, 595 pPage->GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y,
596 rotate); 596 rotate);
597 597
598 FX_FLOAT device_x_f, device_y_f; 598 FX_FLOAT device_x_f, device_y_f;
599 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f, 599 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f,
600 device_y_f); 600 device_y_f);
601 601
602 *device_x = FXSYS_round(device_x_f); 602 *device_x = FXSYS_round(device_x_f);
603 *device_y = FXSYS_round(device_y_f); 603 *device_y = FXSYS_round(device_y_f);
604 } 604 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 pContext->m_pOptions->m_ColorMode = RENDER_COLOR_GRAY; 726 pContext->m_pOptions->m_ColorMode = RENDER_COLOR_GRAY;
727 pContext->m_pOptions->m_ForeColor = 0; 727 pContext->m_pOptions->m_ForeColor = 0;
728 pContext->m_pOptions->m_BackColor = 0xffffff; 728 pContext->m_pOptions->m_BackColor = 0xffffff;
729 } 729 }
730 const CPDF_OCContext::UsageType usage = 730 const CPDF_OCContext::UsageType usage =
731 (flags & FPDF_PRINTING) ? CPDF_OCContext::Print : CPDF_OCContext::View; 731 (flags & FPDF_PRINTING) ? CPDF_OCContext::Print : CPDF_OCContext::View;
732 pContext->m_pOptions->m_AddFlags = flags >> 8; 732 pContext->m_pOptions->m_AddFlags = flags >> 8;
733 pContext->m_pOptions->m_pOCContext = 733 pContext->m_pOptions->m_pOCContext =
734 new CPDF_OCContext(pPage->m_pDocument, usage); 734 new CPDF_OCContext(pPage->m_pDocument, usage);
735 735
736 CFX_AffineMatrix matrix; 736 CFX_Matrix matrix;
737 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); 737 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate);
738 738
739 FX_RECT clip; 739 FX_RECT clip;
740 clip.left = start_x; 740 clip.left = start_x;
741 clip.right = start_x + size_x; 741 clip.right = start_x + size_x;
742 clip.top = start_y; 742 clip.top = start_y;
743 clip.bottom = start_y + size_y; 743 clip.bottom = start_y + size_y;
744 pContext->m_pDevice->SaveState(); 744 pContext->m_pDevice->SaveState();
745 pContext->m_pDevice->SetClip_Rect(&clip); 745 pContext->m_pDevice->SetClip_Rect(&clip);
746 746
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 if (!buffer) { 912 if (!buffer) {
913 *buflen = len; 913 *buflen = len;
914 } else if (*buflen >= len) { 914 } else if (*buflen >= len) {
915 memcpy(buffer, utf16Name.c_str(), len); 915 memcpy(buffer, utf16Name.c_str(), len);
916 *buflen = len; 916 *buflen = len;
917 } else { 917 } else {
918 *buflen = -1; 918 *buflen = -1;
919 } 919 }
920 return (FPDF_DEST)pDestObj; 920 return (FPDF_DEST)pDestObj;
921 } 921 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfformfill.cpp ('k') | fpdfsdk/src/fsdk_annothandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698