mirror of
https://gitee.com/openharmony/third_party_qrcodegen
synced 2024-11-27 17:30:56 +00:00
Refactored private C function fillRectangle() to remove unused size parameter.
This commit is contained in:
parent
e19c42014b
commit
2b4bd9ee24
@ -60,7 +60,7 @@ static void initializeFunctionModules(int version, uint8_t qrcode[]);
|
||||
static void drawWhiteFunctionModules(uint8_t qrcode[], int version);
|
||||
static void drawFormatBits(enum qrcodegen_Ecc ecl, enum qrcodegen_Mask mask, uint8_t qrcode[], int qrsize);
|
||||
testable int getAlignmentPatternPositions(int version, uint8_t result[7]);
|
||||
static void fillRectangle(int left, int top, int width, int height, uint8_t qrcode[], int qrsize);
|
||||
static void fillRectangle(int left, int top, int width, int height, uint8_t qrcode[]);
|
||||
|
||||
static void drawCodewords(const uint8_t data[], int dataLen, uint8_t qrcode[], int qrsize);
|
||||
static void applyMask(const uint8_t functionModules[], uint8_t qrcode[], int qrsize, enum qrcodegen_Mask mask);
|
||||
@ -464,13 +464,13 @@ static void initializeFunctionModules(int version, uint8_t qrcode[]) {
|
||||
qrcode[0] = (uint8_t)qrsize;
|
||||
|
||||
// Fill horizontal and vertical timing patterns
|
||||
fillRectangle(6, 0, 1, qrsize, qrcode, qrsize);
|
||||
fillRectangle(0, 6, qrsize, 1, qrcode, qrsize);
|
||||
fillRectangle(6, 0, 1, qrsize, qrcode);
|
||||
fillRectangle(0, 6, qrsize, 1, qrcode);
|
||||
|
||||
// Fill 3 finder patterns (all corners except bottom right) and format bits
|
||||
fillRectangle(0, 0, 9, 9, qrcode, qrsize);
|
||||
fillRectangle(qrsize - 8, 0, 8, 9, qrcode, qrsize);
|
||||
fillRectangle(0, qrsize - 8, 9, 8, qrcode, qrsize);
|
||||
fillRectangle(0, 0, 9, 9, qrcode);
|
||||
fillRectangle(qrsize - 8, 0, 8, 9, qrcode);
|
||||
fillRectangle(0, qrsize - 8, 9, 8, qrcode);
|
||||
|
||||
// Fill numerous alignment patterns
|
||||
uint8_t alignPatPos[7] = {0};
|
||||
@ -480,14 +480,14 @@ static void initializeFunctionModules(int version, uint8_t qrcode[]) {
|
||||
if ((i == 0 && j == 0) || (i == 0 && j == numAlign - 1) || (i == numAlign - 1 && j == 0))
|
||||
continue; // Skip the three finder corners
|
||||
else
|
||||
fillRectangle(alignPatPos[i] - 2, alignPatPos[j] - 2, 5, 5, qrcode, qrsize);
|
||||
fillRectangle(alignPatPos[i] - 2, alignPatPos[j] - 2, 5, 5, qrcode);
|
||||
}
|
||||
}
|
||||
|
||||
// Fill version blocks
|
||||
if (version >= 7) {
|
||||
fillRectangle(qrsize - 11, 0, 3, 6, qrcode, qrsize);
|
||||
fillRectangle(0, qrsize - 11, 6, 3, qrcode, qrsize);
|
||||
fillRectangle(qrsize - 11, 0, 3, 6, qrcode);
|
||||
fillRectangle(0, qrsize - 11, 6, 3, qrcode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -615,7 +615,7 @@ testable int getAlignmentPatternPositions(int version, uint8_t result[7]) {
|
||||
|
||||
|
||||
// Sets every pixel in the range [left : left + width] * [top : top + height] to black.
|
||||
static void fillRectangle(int left, int top, int width, int height, uint8_t qrcode[], int qrsize) {
|
||||
static void fillRectangle(int left, int top, int width, int height, uint8_t qrcode[]) {
|
||||
for (int dy = 0; dy < height; dy++) {
|
||||
for (int dx = 0; dx < width; dx++)
|
||||
setModule(qrcode, left + dx, top + dy, true);
|
||||
|
Loading…
Reference in New Issue
Block a user