mirror of
https://github.com/openharmony/third_party_qrcodegen.git
synced 2026-07-19 20:23:35 -04:00
Changed QrCode.getModule() in {Java, JavaScript, Python, C++} language versions to return Boolean instead of 0/1 - to match {C, Rust} language versions - and updated comments and usages.
This commit is contained in:
+3
-6
@@ -159,11 +159,8 @@ int QrCode::getMask() const {
|
||||
}
|
||||
|
||||
|
||||
int QrCode::getModule(int x, int y) const {
|
||||
if (0 <= x && x < size && 0 <= y && y < size)
|
||||
return module(x, y) ? 1 : 0;
|
||||
else
|
||||
return 0; // Infinite white border
|
||||
bool QrCode::getModule(int x, int y) const {
|
||||
return 0 <= x && x < size && 0 <= y && y < size && module(x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +177,7 @@ std::string QrCode::toSvgString(int border) const {
|
||||
bool head = true;
|
||||
for (int y = -border; y < size + border; y++) {
|
||||
for (int x = -border; x < size + border; x++) {
|
||||
if (getModule(x, y) == 1) {
|
||||
if (getModule(x, y)) {
|
||||
if (head)
|
||||
head = false;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user