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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 105a2bf919646066ad19e7041d4b80017b23fdf389c65b02e84275f917dea5e0
4
- data.tar.gz: 3854c8cdda670d87bb2c61071866cadb7cb6f3d505f7c0ce264ec718632f3a16
3
+ metadata.gz: b29d21d21eec28473d59567fa25267c61c18ad20192833cd31f9bbe415b5ff99
4
+ data.tar.gz: 49baa7dcb9bae3524c6a179d6857e8d004a3056695bbd2586928396222b1e643
5
5
  SHA512:
6
- metadata.gz: 3227f3d6391afb7910d3c1c6840408d75fcdea6127b4a99f3c701b2b896ca14673047907a145c0464f2b27eb9ce5c8821cbf1e0ab527f54a86481c6cd770e549
7
- data.tar.gz: 326643675bad85067387e93ff4da7bba491e2fa5eba01c919de97c6c385bf0d3c57876af2c7f38ba3987fb373846e7e082256c40097783568b2c5954c1316272
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
- for (size_t ix = ix_begin; ix < ix_end; ix++) {
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
- image[i] |= 0b10000000 >> (ix % 8);
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
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CheetahQRCode
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
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.1
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-27 00:00:00.000000000 Z
11
+ date: 2025-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake