@@ -715,33 +715,33 @@ Napi::Object _captureScreen(const Napi::CallbackInfo &info)
715
715
{
716
716
Napi::Env env = info.Env ();
717
717
718
- size_t x;
719
- size_t y;
720
- size_t w;
721
- size_t h;
718
+ int64_t x;
719
+ int64_t y;
720
+ int64_t w;
721
+ int64_t h;
722
722
723
723
MMSize displaySize = getMainDisplaySize ();
724
724
// If user has provided screen coords, use them!
725
725
if (info.Length () == 4 )
726
726
{
727
- x = info[0 ].As <Napi::Number>().Int32Value ();
728
- y = info[1 ].As <Napi::Number>().Int32Value ();
729
- w = info[2 ].As <Napi::Number>().Int32Value ();
730
- h = info[3 ].As <Napi::Number>().Int32Value ();
727
+ x = info[0 ].As <Napi::Number>().Int64Value ();
728
+ y = info[1 ].As <Napi::Number>().Int64Value ();
729
+ w = info[2 ].As <Napi::Number>().Int64Value ();
730
+ h = info[3 ].As <Napi::Number>().Int64Value ();
731
731
732
- if (!(x >= 0 && x < displaySize.width ))
732
+ if (!(x >= 0 && x <= displaySize.width ))
733
733
{
734
734
throw Napi::Error::New (env, " Error: x coordinate outside of display" );
735
735
}
736
- if (!(y >= 0 && y < displaySize.height ))
736
+ if (!(y >= 0 && y <= displaySize.height ))
737
737
{
738
738
throw Napi::Error::New (env, " Error: y coordinate outside of display" );
739
739
}
740
- if (!((x + w) >= 0 && (x + w) < displaySize.width ))
740
+ if (!((x + w) >= 0 && (x + w) <= displaySize.width ))
741
741
{
742
742
throw Napi::Error::New (env, " Error: Given width exceeds display dimensions" );
743
743
}
744
- if (!((y + h) >= 0 && (y + h) < displaySize.height ))
744
+ if (!((y + h) >= 0 && (y + h) <= displaySize.height ))
745
745
{
746
746
throw Napi::Error::New (env, " Error: Given height exceeds display dimensions" );
747
747
}
0 commit comments