@@ -29,7 +29,7 @@ static void unregisterImage(Image* obj) {
29
29
Persistent<FunctionTemplate> Image::constructor_template;
30
30
31
31
void Image::Initialize (Handle <Object> target) {
32
- HandleScope scope ;
32
+ NanScope () ;
33
33
34
34
Local<FunctionTemplate> t = FunctionTemplate::New (New);
35
35
constructor_template = Persistent<FunctionTemplate>::New (t);
@@ -44,7 +44,7 @@ void Image::Initialize (Handle<Object> target) {
44
44
constructor_template->PrototypeTemplate ()->SetAccessor (JS_STR (" src" ), SrcGetter, SrcSetter);
45
45
// constructor_template->PrototypeTemplate()->SetAccessor(JS_STR("onload"), NULL, OnloadSetter);
46
46
47
- target->Set (String::NewSymbol (" Image" ), constructor_template->GetFunction ());
47
+ target->Set (NanSymbol (" Image" ), constructor_template->GetFunction ());
48
48
49
49
FreeImage_Initialise (true );
50
50
}
@@ -88,7 +88,7 @@ void Image::Load (const char *filename) {
88
88
}
89
89
90
90
Handle <Value> Image::New (const Arguments& args) {
91
- HandleScope scope ;
91
+ NanScope () ;
92
92
93
93
Image *image = new Image ();
94
94
image->Wrap (args.This ());
@@ -98,39 +98,39 @@ Handle<Value> Image::New (const Arguments& args) {
98
98
}
99
99
100
100
Handle <Value> Image::WidthGetter (Local<String> property, const AccessorInfo& info) {
101
- HandleScope scope ;
101
+ NanScope () ;
102
102
103
103
Image *image = ObjectWrap::Unwrap<Image>(info.This ());
104
104
105
- return scope. Close (JS_INT (image->GetWidth ()));
105
+ NanReturnValue (JS_INT (image->GetWidth ()));
106
106
}
107
107
108
108
Handle <Value> Image::HeightGetter (Local<String> property, const AccessorInfo& info) {
109
- HandleScope scope ;
109
+ NanScope () ;
110
110
111
111
Image *image = ObjectWrap::Unwrap<Image>(info.This ());
112
112
113
- return scope. Close (JS_INT (image->GetHeight ()));
113
+ NanReturnValue (JS_INT (image->GetHeight ()));
114
114
}
115
115
116
116
Handle <Value> Image::PitchGetter (Local<String> property, const AccessorInfo& info) {
117
- HandleScope scope ;
117
+ NanScope () ;
118
118
119
119
Image *image = ObjectWrap::Unwrap<Image>(info.This ());
120
120
121
- return scope. Close (JS_INT (image->GetPitch ()));
121
+ NanReturnValue (JS_INT (image->GetPitch ()));
122
122
}
123
123
124
124
Handle <Value> Image::SrcGetter (Local<String> property, const AccessorInfo& info) {
125
- HandleScope scope ;
125
+ NanScope () ;
126
126
127
127
Image *image = ObjectWrap::Unwrap<Image>(info.This ());
128
128
129
- return scope. Close (JS_STR (image->filename ));
129
+ NanReturnValue (JS_STR (image->filename ));
130
130
}
131
131
132
132
void Image::SrcSetter (Local<String> property, Local<Value> value, const AccessorInfo& info) {
133
- HandleScope scope ;
133
+ NanScope () ;
134
134
135
135
Image *image = ObjectWrap::Unwrap<Image>(info.This ());
136
136
String::Utf8Value filename_s (value->ToString ());
@@ -155,7 +155,7 @@ void Image::SrcSetter (Local<String> property, Local<Value> value, const Accesso
155
155
(int ) num_bytes);
156
156
157
157
// emit event
158
- Local<Value> emit_v = info.This ()->Get (String::NewSymbol (" emit" ));
158
+ Local<Value> emit_v = info.This ()->Get (NanSymbol (" emit" ));
159
159
assert (emit_v->IsFunction ());
160
160
Local<Function> emit_f = emit_v.As <Function>();
161
161
@@ -172,8 +172,8 @@ void Image::SrcSetter (Local<String> property, Local<Value> value, const Accesso
172
172
FatalException (tc);
173
173
}
174
174
175
- JS_METHOD (Image::save) {
176
- HandleScope scope ;
175
+ NAN_METHOD (Image::save) {
176
+ NanScope () ;
177
177
String::Utf8Value filename (args[0 ]->ToString ());
178
178
179
179
FREE_IMAGE_FORMAT format = FreeImage_GetFIFFromFilename (*filename);
@@ -205,7 +205,7 @@ JS_METHOD(Image::save) {
205
205
}
206
206
bool ret=FreeImage_Save (format, image, *filename)==1 ;
207
207
FreeImage_Unload (image);
208
- return scope. Close (Boolean::New (ret));
208
+ NanReturnValue (Boolean::New (ret));
209
209
}
210
210
211
211
Image::~Image () {
0 commit comments