|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21573/task/21573/root/proc/21572/root/usr/include/xulrunner-17.0.10/ |
Upload File : |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef CustomQS_Canvas_h
#define CustomQS_Canvas_h
#include "jsapi.h"
#include "mozilla/dom/ImageData.h"
#include "XPCQuickStubs.h"
static bool
GetImageData(JSContext* cx, JS::Value& imageData,
uint32_t* width, uint32_t* height, JS::Anchor<JSObject*>* array)
{
if (!imageData.isObject()) {
return xpc_qsThrow(cx, NS_ERROR_DOM_TYPE_MISMATCH_ERR);
}
nsIDOMImageData* domImageData;
xpc_qsSelfRef imageDataRef;
nsresult rv = xpc_qsUnwrapArg<nsIDOMImageData>(cx, imageData, &domImageData,
&imageDataRef.ptr, &imageData);
if (NS_FAILED(rv)) {
return xpc_qsThrow(cx, rv);
}
mozilla::dom::ImageData* concreteImageData =
static_cast<mozilla::dom::ImageData*>(domImageData);
*width = concreteImageData->GetWidth();
*height = concreteImageData->GetHeight();
array->set(concreteImageData->GetDataObject());
return true;
}
#endif // CustomQS_Canvas_h