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

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

Issue 2103573002: Use const variable instead of using a macro to store a constant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | 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 (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
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 using printing::ConvertUnit; 61 using printing::ConvertUnit;
62 using printing::ConvertUnitDouble; 62 using printing::ConvertUnitDouble;
63 using printing::kPointsPerInch; 63 using printing::kPointsPerInch;
64 using printing::kPixelsPerInch; 64 using printing::kPixelsPerInch;
65 65
66 namespace chrome_pdf { 66 namespace chrome_pdf {
67 67
68 namespace { 68 namespace {
69 69
70 #define kPageShadowTop 3 70 const int32_t kPageShadowTop = 3;
71 #define kPageShadowBottom 7 71 const int32_t kPageShadowBottom = 7;
72 #define kPageShadowLeft 5 72 const int32_t kPageShadowLeft = 5;
73 #define kPageShadowRight 5 73 const int32_t kPageShadowRight = 5;
74 74
75 #define kPageSeparatorThickness 4 75 const int32_t kPageSeparatorThickness = 4;
76 #define kHighlightColorR 153 76 const int32_t kHighlightColorR = 153;
77 #define kHighlightColorG 193 77 const int32_t kHighlightColorG = 193;
78 #define kHighlightColorB 218 78 const int32_t kHighlightColorB = 218;
79 79
80 const uint32_t kPendingPageColor = 0xFFEEEEEE; 80 const uint32_t kPendingPageColor = 0xFFEEEEEE;
81 81
82 #define kFormHighlightColor 0xFFE4DD 82 const uint32_t kFormHighlightColor = 0xFFE4DD;
83 #define kFormHighlightAlpha 100 83 const int32_t kFormHighlightAlpha = 100;
84 84
85 #define kMaxPasswordTries 3 85 const int32_t kMaxPasswordTries = 3;
86 86
87 // See Table 3.20 in 87 // See Table 3.20 in
88 // http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference_1-7.pdf 88 // http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference_1-7.pdf
89 #define kPDFPermissionPrintLowQualityMask 1 << 2 89 const uint32_t kPDFPermissionPrintLowQualityMask = 1 << 2;
90 #define kPDFPermissionPrintHighQualityMask 1 << 11 90 const uint32_t kPDFPermissionPrintHighQualityMask = 1 << 11;
91 #define kPDFPermissionCopyMask 1 << 4 91 const uint32_t kPDFPermissionCopyMask = 1 << 4;
92 #define kPDFPermissionCopyAccessibleMask 1 << 9 92 const uint32_t kPDFPermissionCopyAccessibleMask = 1 << 9;
93 93
94 #define kLoadingTextVerticalOffset 50 94 const int32_t kLoadingTextVerticalOffset = 50;
95 95
96 // The maximum amount of time we'll spend doing a paint before we give back 96 // The maximum amount of time we'll spend doing a paint before we give back
97 // control of the thread. 97 // control of the thread.
98 #define kMaxProgressivePaintTimeMs 300 98 const int32_t kMaxProgressivePaintTimeMs = 300;
Lei Zhang 2016/06/27 21:28:07 This is a test comment.
jaepark 2016/06/27 21:31:36 Done.
99 99
100 // The maximum amount of time we'll spend doing the first paint. This is less 100 // The maximum amount of time we'll spend doing the first paint. This is less
101 // than the above to keep things smooth if the user is scrolling quickly. This 101 // than the above to keep things smooth if the user is scrolling quickly. This
102 // is set to 250 ms to give enough time for most PDFs to render, while avoiding 102 // is set to 250 ms to give enough time for most PDFs to render, while avoiding
103 // adding too much latency to the display of the final image when the user 103 // adding too much latency to the display of the final image when the user
104 // stops scrolling. 104 // stops scrolling.
105 // Setting a higher value has minimal benefit (scrolling at less than 4 fps will 105 // Setting a higher value has minimal benefit (scrolling at less than 4 fps will
106 // never be a great experience) and there is some cost, since when the user 106 // never be a great experience) and there is some cost, since when the user
107 // stops scrolling the in-progress painting has to complete or timeout before 107 // stops scrolling the in-progress painting has to complete or timeout before
108 // the final painting can start. 108 // the final painting can start.
109 // The scrollbar will always be responsive since it is managed by a separate 109 // The scrollbar will always be responsive since it is managed by a separate
110 // process. 110 // process.
111 #define kMaxInitialProgressivePaintTimeMs 250 111 const int32_t kMaxInitialProgressivePaintTimeMs = 250;
Lei Zhang 2016/06/27 21:28:07 This is another test comment.
jaepark 2016/06/27 21:31:36 This is a test reply.
112 112
113 std::vector<uint32_t> GetPageNumbersFromPrintPageNumberRange( 113 std::vector<uint32_t> GetPageNumbersFromPrintPageNumberRange(
114 const PP_PrintPageNumberRange_Dev* page_ranges, 114 const PP_PrintPageNumberRange_Dev* page_ranges,
115 uint32_t page_range_count) { 115 uint32_t page_range_count) {
116 std::vector<uint32_t> page_numbers; 116 std::vector<uint32_t> page_numbers;
117 for (uint32_t index = 0; index < page_range_count; ++index) { 117 for (uint32_t index = 0; index < page_range_count; ++index) {
118 for (uint32_t page_number = page_ranges[index].first_page_number; 118 for (uint32_t page_number = page_ranges[index].first_page_number;
119 page_number <= page_ranges[index].last_page_number; ++page_number) { 119 page_number <= page_ranges[index].last_page_number; ++page_number) {
120 page_numbers.push_back(page_number); 120 page_numbers.push_back(page_number);
121 } 121 }
(...skipping 3790 matching lines...) Expand 10 before | Expand all | Expand 10 after
3912 FPDF_DOCUMENT doc = 3912 FPDF_DOCUMENT doc =
3913 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); 3913 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr);
3914 if (!doc) 3914 if (!doc)
3915 return false; 3915 return false;
3916 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 3916 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
3917 FPDF_CloseDocument(doc); 3917 FPDF_CloseDocument(doc);
3918 return success; 3918 return success;
3919 } 3919 }
3920 3920
3921 } // namespace chrome_pdf 3921 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698