psd_native 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/psd_native/mask.c +4 -0
- data/lib/psd_native/version.rb +1 -1
- data/psd_native.gemspec +1 -1
- data/spec/psd_spec.rb +10 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ca7170880c6cfc11f56e1299059a9926bdac2e0
|
4
|
+
data.tar.gz: 6ed9335c31bf6f9513cfd2bbf5a35dfec8c526a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f7e6354f464fe99c4183c4b13d248cb07c82b541e7fdedf44da2632ebb53b63fa89dff365933a5a0b2c5beb62c7969611232ea8e926ce36f41d134a25b44c5e
|
7
|
+
data.tar.gz: e59760913c83add6f05131651c5adb41f0e1ed1da7a112d7a4cbe1757c6de071a1f9dcd73b3c7b1914babe7534ae853e8962da48ed4687b7fcb9a5e84e0ef0b8
|
data/ext/psd_native/mask.c
CHANGED
@@ -16,6 +16,8 @@ VALUE psd_native_mask_apply_bang(VALUE self) {
|
|
16
16
|
int mask_left = FIX2INT(rb_funcall(mask, rb_intern("left"), 0));
|
17
17
|
int mask_top = FIX2INT(rb_funcall(mask, rb_intern("top"), 0));
|
18
18
|
|
19
|
+
int layer_height = FIX2INT(rb_funcall(layer, rb_intern("height"), 0));
|
20
|
+
int layer_width = FIX2INT(rb_funcall(layer, rb_intern("width"), 0));
|
19
21
|
int layer_left = FIX2INT(rb_funcall(layer, rb_intern("left"), 0));
|
20
22
|
int layer_top = FIX2INT(rb_funcall(layer, rb_intern("top"), 0));
|
21
23
|
|
@@ -29,6 +31,8 @@ VALUE psd_native_mask_apply_bang(VALUE self) {
|
|
29
31
|
layer_x = doc_x - layer_left;
|
30
32
|
layer_y = doc_y - layer_top;
|
31
33
|
|
34
|
+
if (layer_x < 0 || layer_x > layer_width || layer_y < 0 || layer_y > layer_height) continue;
|
35
|
+
|
32
36
|
color = FIX2UINT(rb_funcall(canvas, rb_intern("[]"), 2, INT2FIX(layer_x), INT2FIX(layer_y)));
|
33
37
|
|
34
38
|
if (doc_x < 0 || doc_x >= doc_width || doc_y < 0 || doc_y > doc_height) {
|
data/lib/psd_native/version.rb
CHANGED
data/psd_native.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.extensions = ["ext/psd_native/extconf.rb"]
|
22
22
|
spec.require_paths = ["lib", "ext"]
|
23
23
|
|
24
|
-
spec.add_runtime_dependency "psd", "
|
24
|
+
spec.add_runtime_dependency "psd", ">= 2.1.1"
|
25
25
|
spec.add_runtime_dependency "oily_png", "~> 1.1"
|
26
26
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.3"
|
data/spec/psd_spec.rb
CHANGED
@@ -3,11 +3,17 @@ require 'spec_helper'
|
|
3
3
|
describe 'PSD' do
|
4
4
|
let(:filename) { 'spec/files/example.psd' }
|
5
5
|
|
6
|
-
|
7
|
-
psd = PSD.
|
8
|
-
expect(psd).
|
6
|
+
it 'should open a file without a block' do
|
7
|
+
psd = PSD.new(filename)
|
8
|
+
expect(psd).to_not be_parsed
|
9
9
|
expect(psd).to be_an_instance_of(PSD)
|
10
|
-
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should raise an exception if using open without a block' do
|
13
|
+
expect {
|
14
|
+
PSD.open(filename)
|
15
|
+
}.to raise_error
|
16
|
+
end
|
11
17
|
|
12
18
|
it 'should refuse to open a bad filename' do
|
13
19
|
expect { PSD.open('') }.to raise_error
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: psd_native
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan LeFevre
|
@@ -14,14 +14,14 @@ dependencies:
|
|
14
14
|
name: psd
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|