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

Side by Side Diff: pdf/pdfium/pdfium_engine.cc

Issue 2270463003: Turn on enforce-in-pdf Clang plugin flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win clang Created 4 years, 3 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 | « pdf/pdfium/pdfium_engine.h ('k') | pdf/pdfium/pdfium_page.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 #include "pdf/pdfium/pdfium_engine.h" 5 #include "pdf/pdfium/pdfium_engine.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <algorithm>
11 #include <memory> 12 #include <memory>
12 #include <set> 13 #include <set>
13 14
14 #include "base/i18n/encoding_detection.h" 15 #include "base/i18n/encoding_detection.h"
15 #include "base/i18n/icu_string_conversions.h" 16 #include "base/i18n/icu_string_conversions.h"
16 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/macros.h" 19 #include "base/macros.h"
19 #include "base/numerics/safe_conversions.h" 20 #include "base/numerics/safe_conversions.h"
20 #include "base/stl_util.h" 21 #include "base/stl_util.h"
(...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2293 } 2294 }
2294 2295
2295 pp::Rect PDFiumEngine::GetPageBoundsRect(int index) { 2296 pp::Rect PDFiumEngine::GetPageBoundsRect(int index) {
2296 return pages_[index]->rect(); 2297 return pages_[index]->rect();
2297 } 2298 }
2298 2299
2299 pp::Rect PDFiumEngine::GetPageContentsRect(int index) { 2300 pp::Rect PDFiumEngine::GetPageContentsRect(int index) {
2300 return GetScreenRect(pages_[index]->rect()); 2301 return GetScreenRect(pages_[index]->rect());
2301 } 2302 }
2302 2303
2304 int PDFiumEngine::GetVerticalScrollbarYPosition() {
2305 return position_.y();
2306 }
2307
2303 void PDFiumEngine::SetGrayscale(bool grayscale) { 2308 void PDFiumEngine::SetGrayscale(bool grayscale) {
2304 render_grayscale_ = grayscale; 2309 render_grayscale_ = grayscale;
2305 } 2310 }
2306 2311
2307 void PDFiumEngine::OnCallback(int id) { 2312 void PDFiumEngine::OnCallback(int id) {
2308 if (!timers_.count(id)) 2313 if (!timers_.count(id))
2309 return; 2314 return;
2310 2315
2311 timers_[id].second(id); 2316 timers_[id].second(id);
2312 if (timers_.count(id)) // The callback might delete the timer. 2317 if (timers_.count(id)) // The callback might delete the timer.
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
3770 if (settings.center_in_bounds) { 3775 if (settings.center_in_bounds) {
3771 pp::Point offset((settings.bounds.width() - dest->width()) / 2, 3776 pp::Point offset((settings.bounds.width() - dest->width()) / 2,
3772 (settings.bounds.height() - dest->height()) / 2); 3777 (settings.bounds.height() - dest->height()) / 2);
3773 dest->Offset(offset); 3778 dest->Offset(offset);
3774 } 3779 }
3775 return rotate; 3780 return rotate;
3776 } 3781 }
3777 3782
3778 } // namespace 3783 } // namespace
3779 3784
3785 PDFEngineExports::RenderingSettings::RenderingSettings(int dpi_x,
3786 int dpi_y,
3787 const pp::Rect& bounds,
3788 bool fit_to_bounds,
3789 bool stretch_to_bounds,
3790 bool keep_aspect_ratio,
3791 bool center_in_bounds,
3792 bool autorotate)
3793 : dpi_x(dpi_x),
3794 dpi_y(dpi_y),
3795 bounds(bounds),
3796 fit_to_bounds(fit_to_bounds),
3797 stretch_to_bounds(stretch_to_bounds),
3798 keep_aspect_ratio(keep_aspect_ratio),
3799 center_in_bounds(center_in_bounds),
3800 autorotate(autorotate) {}
3801
3802 PDFEngineExports::RenderingSettings::RenderingSettings(
3803 const RenderingSettings& that) = default;
3804
3780 PDFEngineExports* PDFEngineExports::Get() { 3805 PDFEngineExports* PDFEngineExports::Get() {
3781 return g_pdf_engine_exports.Pointer(); 3806 return g_pdf_engine_exports.Pointer();
3782 } 3807 }
3783 3808
3784 #if defined(OS_WIN) 3809 #if defined(OS_WIN)
3785 bool PDFiumEngineExports::RenderPDFPageToDC(const void* pdf_buffer, 3810 bool PDFiumEngineExports::RenderPDFPageToDC(const void* pdf_buffer,
3786 int buffer_size, 3811 int buffer_size,
3787 int page_number, 3812 int page_number,
3788 const RenderingSettings& settings, 3813 const RenderingSettings& settings,
3789 HDC dc) { 3814 HDC dc) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3925 FPDF_DOCUMENT doc = 3950 FPDF_DOCUMENT doc =
3926 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); 3951 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
3927 if (!doc) 3952 if (!doc)
3928 return false; 3953 return false;
3929 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 3954 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
3930 FPDF_CloseDocument(doc); 3955 FPDF_CloseDocument(doc);
3931 return success; 3956 return success;
3932 } 3957 }
3933 3958
3934 } // namespace chrome_pdf 3959 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « pdf/pdfium/pdfium_engine.h ('k') | pdf/pdfium/pdfium_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698