cheetah_qrcode 1.0.1 → 1.0.2
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 +18 -3
- 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: b29d21d21eec28473d59567fa25267c61c18ad20192833cd31f9bbe415b5ff99
|
4
|
+
data.tar.gz: 49baa7dcb9bae3524c6a179d6857e8d004a3056695bbd2586928396222b1e643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 177e1343d936bf964a5bc3d83cade60e618b1d6e2d16fa980950977095c83a964c85edd13ab0bc1357da71e427cc18014882bd5f813c5dd0771e9c90be940dfc
|
7
|
+
data.tar.gz: 770a535c33374561f6a3d4133bd68871bcb0224c7796aba15cfc6464a1e159ae71ffd20ebd1c4aed6118cf5eb72cfc312604ebb2955e84a2d3e7405653732b3a
|
@@ -129,12 +129,27 @@ static VALUE encode_text(int argc, VALUE* argv, VALUE self) {
|
|
129
129
|
iy_end = image_size;
|
130
130
|
}
|
131
131
|
|
132
|
-
// Fill white pixels into image
|
132
|
+
// Fill white pixels into image at unit of bytes
|
133
133
|
for (size_t iy = iy_begin; iy < iy_end; iy++) {
|
134
|
-
|
134
|
+
size_t ix = ix_begin;
|
135
|
+
size_t ix_diff = ix_end - ix_begin;
|
136
|
+
|
137
|
+
while (ix_diff > 0) {
|
135
138
|
size_t i = (iy * image_scanline_width) + (ix / 8);
|
136
139
|
|
137
|
-
|
140
|
+
uint8_t byte_value = 0xFF;
|
141
|
+
uint8_t bits_needed = 8 - (ix % 8);
|
142
|
+
|
143
|
+
if (bits_needed > ix_diff) {
|
144
|
+
byte_value <<= (bits_needed - ix_diff);
|
145
|
+
bits_needed = ix_diff;
|
146
|
+
}
|
147
|
+
|
148
|
+
byte_value >>= (ix % 8);
|
149
|
+
image[i] |= byte_value;
|
150
|
+
|
151
|
+
ix += bits_needed;
|
152
|
+
ix_diff -= bits_needed;
|
138
153
|
}
|
139
154
|
}
|
140
155
|
}
|
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.2
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|