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

Side by Side Diff: xfa/fxbarcode/qrcode/BC_QRDataMask.cpp

Issue 2067903002: Make code compile with clang_use_chrome_plugin (part III) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 6 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 | « xfa/fxbarcode/qrcode/BC_QRCodeWriter.h ('k') | xfa/fxbarcode/qrcode/BC_QRFinderPattern.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 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 // Original code is licensed as follows: 6 // Original code is licensed as follows:
7 /* 7 /*
8 * Copyright 2007 ZXing authors 8 * Copyright 2007 ZXing authors
9 * 9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * Licensed under the Apache License, Version 2.0 (the "License");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 CBC_QRDataMask* CBC_QRDataMask::ForReference(int32_t reference, int32_t& e) { 60 CBC_QRDataMask* CBC_QRDataMask::ForReference(int32_t reference, int32_t& e) {
61 if (reference < 0 || reference > 7) { 61 if (reference < 0 || reference > 7) {
62 e = BCExceptionReferenceMustBeBetween0And7; 62 e = BCExceptionReferenceMustBeBetween0And7;
63 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); 63 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
64 } 64 }
65 return (*DATA_MASKS)[reference]; 65 return (*DATA_MASKS)[reference];
66 } 66 }
67 67
68 class DataMask000 : public CBC_QRDataMask { 68 class DataMask000 : public CBC_QRDataMask {
69 public: 69 public:
70 FX_BOOL IsMasked(int32_t x, int32_t y) { return ((x + y) % 2) == 0; } 70 // CBC_QRDataMask
71 FX_BOOL IsMasked(int32_t x, int32_t y) override;
71 }; 72 };
73
72 class DataMask001 : public CBC_QRDataMask { 74 class DataMask001 : public CBC_QRDataMask {
73 public: 75 public:
74 FX_BOOL IsMasked(int32_t x, int32_t y) { return (x % 2) == 0; } 76 // CBC_QRDataMask
77 FX_BOOL IsMasked(int32_t x, int32_t y) override;
75 }; 78 };
79
76 class DataMask010 : public CBC_QRDataMask { 80 class DataMask010 : public CBC_QRDataMask {
77 public: 81 public:
78 FX_BOOL IsMasked(int32_t x, int32_t y) { return y % 3 == 0; } 82 // CBC_QRDataMask
83 FX_BOOL IsMasked(int32_t x, int32_t y) override;
79 }; 84 };
85
80 class DataMask011 : public CBC_QRDataMask { 86 class DataMask011 : public CBC_QRDataMask {
81 public: 87 public:
82 FX_BOOL IsMasked(int32_t x, int32_t y) { return (x + y) % 3 == 0; } 88 // CBC_QRDataMask
89 FX_BOOL IsMasked(int32_t x, int32_t y) override;
83 }; 90 };
91
84 class DataMask100 : public CBC_QRDataMask { 92 class DataMask100 : public CBC_QRDataMask {
85 public: 93 public:
86 FX_BOOL IsMasked(int32_t x, int32_t y) { 94 // CBC_QRDataMask
87 return (((x >> 1) + (y / 3)) % 2) == 0; 95 FX_BOOL IsMasked(int32_t x, int32_t y) override;
88 }
89 }; 96 };
97
90 class DataMask101 : public CBC_QRDataMask { 98 class DataMask101 : public CBC_QRDataMask {
91 public: 99 public:
92 FX_BOOL IsMasked(int32_t x, int32_t y) { 100 // CBC_QRDataMask
93 size_t temp = x * y; 101 FX_BOOL IsMasked(int32_t x, int32_t y) override;
94 return (temp % 2) + (temp % 3) == 0;
95 }
96 }; 102 };
103
97 class DataMask110 : public CBC_QRDataMask { 104 class DataMask110 : public CBC_QRDataMask {
98 public: 105 public:
99 FX_BOOL IsMasked(int32_t x, int32_t y) { 106 // CBC_QRDataMask
100 size_t temp = x * y; 107 FX_BOOL IsMasked(int32_t x, int32_t y) override;
101 return (((temp % 2) + (temp % 3)) % 2) == 0;
102 }
103 }; 108 };
109
104 class DataMask111 : public CBC_QRDataMask { 110 class DataMask111 : public CBC_QRDataMask {
105 public: 111 public:
106 FX_BOOL IsMasked(int32_t x, int32_t y) { 112 // CBC_QRDataMask
107 return ((((x + y) % 2) + ((x * y) % 3)) % 2) == 0; 113 FX_BOOL IsMasked(int32_t x, int32_t y) override;
108 }
109 }; 114 };
115
110 int32_t CBC_QRDataMask::BuildDataMasks() { 116 int32_t CBC_QRDataMask::BuildDataMasks() {
111 DATA_MASKS->Add(new DataMask000); 117 DATA_MASKS->Add(new DataMask000);
112 DATA_MASKS->Add(new DataMask001); 118 DATA_MASKS->Add(new DataMask001);
113 DATA_MASKS->Add(new DataMask010); 119 DATA_MASKS->Add(new DataMask010);
114 DATA_MASKS->Add(new DataMask011); 120 DATA_MASKS->Add(new DataMask011);
115 DATA_MASKS->Add(new DataMask100); 121 DATA_MASKS->Add(new DataMask100);
116 DATA_MASKS->Add(new DataMask101); 122 DATA_MASKS->Add(new DataMask101);
117 DATA_MASKS->Add(new DataMask110); 123 DATA_MASKS->Add(new DataMask110);
118 DATA_MASKS->Add(new DataMask111); 124 DATA_MASKS->Add(new DataMask111);
119 return DATA_MASKS->GetSize(); 125 return DATA_MASKS->GetSize();
120 } 126 }
127
121 CBC_QRDataMask::CBC_QRDataMask() {} 128 CBC_QRDataMask::CBC_QRDataMask() {}
129
122 CBC_QRDataMask::~CBC_QRDataMask() {} 130 CBC_QRDataMask::~CBC_QRDataMask() {}
131
132 FX_BOOL DataMask000::IsMasked(int32_t x, int32_t y) {
133 return ((x + y) % 2) == 0;
134 }
135
136 FX_BOOL DataMask001::IsMasked(int32_t x, int32_t y) {
137 return (x % 2) == 0;
138 }
139
140 FX_BOOL DataMask010::IsMasked(int32_t x, int32_t y) {
141 return y % 3 == 0;
142 }
143
144 FX_BOOL DataMask011::IsMasked(int32_t x, int32_t y) {
145 return (x + y) % 3 == 0;
146 }
147
148 FX_BOOL DataMask100::IsMasked(int32_t x, int32_t y) {
149 return (((x >> 1) + (y / 3)) % 2) == 0;
150 }
151
152 FX_BOOL DataMask101::IsMasked(int32_t x, int32_t y) {
153 size_t temp = x * y;
154 return (temp % 2) + (temp % 3) == 0;
155 }
156
157 FX_BOOL DataMask110::IsMasked(int32_t x, int32_t y) {
158 size_t temp = x * y;
159 return (((temp % 2) + (temp % 3)) % 2) == 0;
160 }
161
162 FX_BOOL DataMask111::IsMasked(int32_t x, int32_t y) {
163 return ((((x + y) % 2) + ((x * y) % 3)) % 2) == 0;
164 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/qrcode/BC_QRCodeWriter.h ('k') | xfa/fxbarcode/qrcode/BC_QRFinderPattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698