cheetah_qrcode 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/cheetah_qrcode/cheetah_qrcode.c +7 -7
- data/lib/cheetah_qrcode/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a68495ab66ea6215e93529c0b209671296ac3f440be78c383e5ea65c8344c971
|
4
|
+
data.tar.gz: 3e6878b91abd7c059ee8d49477a694083f79b99770da9b5fd11dd5aebdabdea5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9224f5cb85e7644bd90caee0bab897298362e095638b7556d36a91c948322e46a5ed609fa4e9591a8a52f32e49ae43dbfcd34a4da9fce21eb0bc5204285fe2d1
|
7
|
+
data.tar.gz: cbebc39cd356cdc55538299936f39bf5ce28f5e92c6981c501de8cad723c3fb1aa25bd079eb3cda3d140a4162da308d5dab509c9ffa807be9593b10a59767d39
|
@@ -120,7 +120,7 @@ static VALUE encode_text(int argc, VALUE* argv, VALUE self) {
|
|
120
120
|
|
121
121
|
// Precompute image scale pixels
|
122
122
|
for (size_t i = 1; i < qrcode_size; i++) {
|
123
|
-
image_scale_map[i] = (size_t)(i * image_scale)
|
123
|
+
image_scale_map[i] = (size_t)(i * image_scale);
|
124
124
|
}
|
125
125
|
|
126
126
|
// Loop through qrcode to find white modules to write into image
|
@@ -140,24 +140,24 @@ static VALUE encode_text(int argc, VALUE* argv, VALUE self) {
|
|
140
140
|
// Fill white pixels into image at unit of bytes
|
141
141
|
for (size_t iy = iy_begin; iy < iy_end; iy++) {
|
142
142
|
size_t ix = ix_begin;
|
143
|
-
size_t
|
143
|
+
size_t bits_remaining = ix_end - ix_begin;
|
144
144
|
|
145
|
-
while (
|
145
|
+
while (bits_remaining > 0) {
|
146
146
|
size_t i = (iy * image_scanline_width) + (ix / 8);
|
147
147
|
|
148
148
|
uint8_t byte_value = 0xFF;
|
149
149
|
uint8_t bits_needed = 8 - (ix % 8);
|
150
150
|
|
151
|
-
if (bits_needed >
|
152
|
-
|
153
|
-
|
151
|
+
if (bits_needed > bits_remaining) {
|
152
|
+
bits_needed = bits_remaining;
|
153
|
+
byte_value <<= (8 - bits_needed);
|
154
154
|
}
|
155
155
|
|
156
156
|
byte_value >>= (ix % 8);
|
157
157
|
image[i] |= byte_value;
|
158
158
|
|
159
159
|
ix += bits_needed;
|
160
|
-
|
160
|
+
bits_remaining -= bits_needed;
|
161
161
|
}
|
162
162
|
}
|
163
163
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cheetah_qrcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- atitan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|