| 140 | } |
| 141 | |
| 142 | static JSValue setPixelData(JSContext* ctx, JSValue thisVal, int argc, JSValue* argv) |
| 143 | { |
| 144 | JS_UNPACK_INT32(id, ctx, argv[0]); |
| 145 | JSValue pixelData = argv[1]; |
| 146 | |
| 147 | auto& scriptEngine = GetContext()->GetScriptEngine(); |
| 148 | auto plugin = scriptEngine.GetExecInfo().GetCurrentPlugin(); |
| 149 | if (!DoesPluginOwnImage(plugin, id)) |
| 150 | { |
| 151 | JS_ThrowPlainError(ctx, "This plugin did not allocate the specified image range."); |
| 152 | return JS_EXCEPTION; |
| 153 | } |
| 154 | |
| 155 | try |
| 156 | { |
| 157 | JSSetPixelData(ctx, id, pixelData); |
| 158 | } |
| 159 | catch (const std::runtime_error& e) |
| 160 | { |
| 161 | JS_ThrowInternalError(ctx, "%s", e.what()); |
| 162 | return JS_EXCEPTION; |
| 163 | } |
| 164 | return JS_UNDEFINED; |
| 165 | } |
| 166 | |
| 167 | static JSValue draw(JSContext* ctx, JSValue thisVal, int argc, JSValue* argv) |
| 168 | { |
nothing calls this directly
no test coverage detected