From: Simon Hausmann Date: Thu, 13 Jun 2013 11:10:15 +0000 (+0200) Subject: Stop using v4classgen in the context2d bindings X-Git-Tag: upstream/5.2.1~669^2~239 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e064c247437539d94a1c49ebb2e934b21f91f34e;p=platform%2Fupstream%2Fqtdeclarative.git Stop using v4classgen in the context2d bindings Change-Id: Ib117468f2755495eab13f39d72682780a68305c0 Reviewed-by: Lars Knoll --- diff --git a/src/quick/items/context2d/context2d.pri b/src/quick/items/context2d/context2d.pri index c41de77..c73d58b 100644 --- a/src/quick/items/context2d/context2d.pri +++ b/src/quick/items/context2d/context2d.pri @@ -14,5 +14,3 @@ HEADERS += \ $$PWD/qquickcontext2dtexture_p.h \ $$PWD/qquickcontext2dcommandbuffer_p.h \ -JS_CLASS_SOURCES += \ - $$PWD/qquickcontext2d.cpp diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index d2935ab..689646f 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -236,10 +236,9 @@ public: V8_DEFINE_EXTENSION(QQuickContext2DEngineData, engineData) -class QV4_JS_CLASS(QQuickJSContext2D) : public QV4::Object +class QQuickJSContext2D : public QV4::Object { Q_MANAGED - QV4_ANNOTATE(staticInitClass true) public: QQuickJSContext2D(QV4::ExecutionEngine *engine) : QV4::Object(engine) @@ -248,8 +247,6 @@ public: } QQuickContext2D* context; - static void initClass(QV4::ExecutionEngine *engine, const QV4::Value &obj); - static QV4::Value method_get_globalAlpha(QV4::SimpleCallContext *ctx); static QV4::Value method_set_globalAlpha(QV4::SimpleCallContext *ctx); static QV4::Value method_get_globalCompositeOperation(QV4::SimpleCallContext *ctx); @@ -300,7 +297,7 @@ protected: DEFINE_MANAGED_VTABLE(QQuickJSContext2D); -struct QV4_JS_CLASS(QQuickJSContext2DPrototype) : public QV4::Object +struct QQuickJSContext2DPrototype : public QV4::Object { Q_MANAGED public: @@ -308,11 +305,52 @@ public: : QV4::Object(engine) { prototype = engine->objectPrototype; - initClass(engine); + defineDefaultProperty(engine, QStringLiteral("quadraticCurveTo"), method_quadraticCurveTo, 0); + defineDefaultProperty(engine, QStringLiteral("restore"), method_restore, 0); + defineDefaultProperty(engine, QStringLiteral("moveTo"), method_moveTo, 0); + defineDefaultProperty(engine, QStringLiteral("lineTo"), method_lineTo, 0); + defineDefaultProperty(engine, QStringLiteral("caretBlinkRate"), method_caretBlinkRate, 0); + defineDefaultProperty(engine, QStringLiteral("clip"), method_clip, 0); + defineDefaultProperty(engine, QStringLiteral("setTransform"), method_setTransform, 0); + defineDefaultProperty(engine, QStringLiteral("text"), method_text, 0); + defineDefaultProperty(engine, QStringLiteral("roundedRect"), method_roundedRect, 0); + defineDefaultProperty(engine, QStringLiteral("createPattern"), method_createPattern, 0); + defineDefaultProperty(engine, QStringLiteral("stroke"), method_stroke, 0); + defineDefaultProperty(engine, QStringLiteral("arc"), method_arc, 0); + defineDefaultProperty(engine, QStringLiteral("createImageData"), method_createImageData, 0); + defineDefaultProperty(engine, QStringLiteral("measureText"), method_measureText, 0); + defineDefaultProperty(engine, QStringLiteral("ellipse"), method_ellipse, 0); + defineDefaultProperty(engine, QStringLiteral("fill"), method_fill, 0); + defineDefaultProperty(engine, QStringLiteral("save"), method_save, 0); + defineDefaultProperty(engine, QStringLiteral("scale"), method_scale, 0); + defineDefaultProperty(engine, QStringLiteral("drawImage"), method_drawImage, 0); + defineDefaultProperty(engine, QStringLiteral("transform"), method_transform, 0); + defineDefaultProperty(engine, QStringLiteral("fillText"), method_fillText, 0); + defineDefaultProperty(engine, QStringLiteral("strokeText"), method_strokeText, 0); + defineDefaultProperty(engine, QStringLiteral("translate"), method_translate, 0); + defineDefaultProperty(engine, QStringLiteral("createRadialGradient"), method_createRadialGradient, 0); + defineDefaultProperty(engine, QStringLiteral("shear"), method_shear, 0); + defineDefaultProperty(engine, QStringLiteral("isPointInPath"), method_isPointInPath, 0); + defineDefaultProperty(engine, QStringLiteral("bezierCurveTo"), method_bezierCurveTo, 0); + defineDefaultProperty(engine, QStringLiteral("resetTransform"), method_resetTransform, 0); + defineDefaultProperty(engine, QStringLiteral("arcTo"), method_arcTo, 0); + defineDefaultProperty(engine, QStringLiteral("fillRect"), method_fillRect, 0); + defineDefaultProperty(engine, QStringLiteral("createConicalGradient"), method_createConicalGradient, 0); + defineDefaultProperty(engine, QStringLiteral("drawFocusRing"), method_drawFocusRing, 0); + defineDefaultProperty(engine, QStringLiteral("beginPath"), method_beginPath, 0); + defineDefaultProperty(engine, QStringLiteral("clearRect"), method_clearRect, 0); + defineDefaultProperty(engine, QStringLiteral("rect"), method_rect, 0); + defineDefaultProperty(engine, QStringLiteral("reset"), method_reset, 0); + defineDefaultProperty(engine, QStringLiteral("rotate"), method_rotate, 0); + defineDefaultProperty(engine, QStringLiteral("setCaretSelectionRect"), method_setCaretSelectionRect, 0); + defineDefaultProperty(engine, QStringLiteral("putImageData"), method_putImageData, 0); + defineDefaultProperty(engine, QStringLiteral("getImageData"), method_getImageData, 0); + defineDefaultProperty(engine, QStringLiteral("createLinearGradient"), method_createLinearGradient, 0); + defineDefaultProperty(engine, QStringLiteral("strokeRect"), method_strokeRect, 0); + defineDefaultProperty(engine, QStringLiteral("closePath"), method_closePath, 0); + defineAccessorProperty(engine, QStringLiteral("canvas"), QQuickJSContext2DPrototype::method_get_canvas, 0); } - void initClass(QV4::ExecutionEngine *engine); - static QV4::Value method_get_canvas(QV4::SimpleCallContext *ctx); static QV4::Value method_restore(QV4::SimpleCallContext *ctx); static QV4::Value method_reset(QV4::SimpleCallContext *ctx); @@ -3643,10 +3681,27 @@ QQuickContext2DEngineData::QQuickContext2DEngineData(QV8Engine *engine) { QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine); - contextPrototype = QV4::Value::fromObject(new (v4->memoryManager) QQuickJSContext2DPrototype(v4)); - QQuickJSContext2D::initClass(v4, contextPrototype.value()); + QV4::Object *proto = new (v4->memoryManager) QQuickJSContext2DPrototype(v4); + proto->defineAccessorProperty(v4, QStringLiteral("strokeStyle"), QQuickJSContext2D::method_get_strokeStyle, QQuickJSContext2D::method_set_strokeStyle); + proto->defineAccessorProperty(v4, QStringLiteral("font"), QQuickJSContext2D::method_get_font, QQuickJSContext2D::method_set_font); + proto->defineAccessorProperty(v4, QStringLiteral("fillRule"), QQuickJSContext2D::method_get_fillRule, QQuickJSContext2D::method_set_fillRule); + proto->defineAccessorProperty(v4, QStringLiteral("globalAlpha"), QQuickJSContext2D::method_get_globalAlpha, QQuickJSContext2D::method_set_globalAlpha); + proto->defineAccessorProperty(v4, QStringLiteral("lineCap"), QQuickJSContext2D::method_get_lineCap, QQuickJSContext2D::method_set_lineCap); + proto->defineAccessorProperty(v4, QStringLiteral("shadowOffsetX"), QQuickJSContext2D::method_get_shadowOffsetX, QQuickJSContext2D::method_set_shadowOffsetX); + proto->defineAccessorProperty(v4, QStringLiteral("shadowOffsetY"), QQuickJSContext2D::method_get_shadowOffsetY, QQuickJSContext2D::method_set_shadowOffsetY); + proto->defineAccessorProperty(v4, QStringLiteral("globalCompositeOperation"), QQuickJSContext2D::method_get_globalCompositeOperation, QQuickJSContext2D::method_set_globalCompositeOperation); + proto->defineAccessorProperty(v4, QStringLiteral("miterLimit"), QQuickJSContext2D::method_get_miterLimit, QQuickJSContext2D::method_set_miterLimit); + proto->defineAccessorProperty(v4, QStringLiteral("fillStyle"), QQuickJSContext2D::method_get_fillStyle, QQuickJSContext2D::method_set_fillStyle); + proto->defineAccessorProperty(v4, QStringLiteral("shadowColor"), QQuickJSContext2D::method_get_shadowColor, QQuickJSContext2D::method_set_shadowColor); + proto->defineAccessorProperty(v4, QStringLiteral("textBaseline"), QQuickJSContext2D::method_get_textBaseline, QQuickJSContext2D::method_set_textBaseline); + proto->defineAccessorProperty(v4, QStringLiteral("path"), QQuickJSContext2D::method_get_path, QQuickJSContext2D::method_set_path); + proto->defineAccessorProperty(v4, QStringLiteral("lineJoin"), QQuickJSContext2D::method_get_lineJoin, QQuickJSContext2D::method_set_lineJoin); + proto->defineAccessorProperty(v4, QStringLiteral("lineWidth"), QQuickJSContext2D::method_get_lineWidth, QQuickJSContext2D::method_set_lineWidth); + proto->defineAccessorProperty(v4, QStringLiteral("textAlign"), QQuickJSContext2D::method_get_textAlign, QQuickJSContext2D::method_set_textAlign); + proto->defineAccessorProperty(v4, QStringLiteral("shadowBlur"), QQuickJSContext2D::method_get_shadowBlur, QQuickJSContext2D::method_set_shadowBlur); + contextPrototype = QV4::Value::fromObject(proto); - QV4::Object *proto = v4->newObject(); + proto = v4->newObject(); proto->defineDefaultProperty(v4, QStringLiteral("addColorStop"), QQuickContext2DStyle::gradient_proto_addColorStop, 0); gradientProto = QV4::Value::fromObject(proto); @@ -3783,6 +3838,4 @@ QQuickContext2DCommandBuffer* QQuickContext2D::nextBuffer() return m_bufferQueue.isEmpty() ? 0 : m_bufferQueue.dequeue(); } -#include "qquickcontext2d_jsclass.cpp" - QT_END_NAMESPACE diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index d1a8eff..5aaf7d3 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -137,16 +137,6 @@ HEADERS += \ $$PWD/qquickshadereffectnode_p.h \ $$PWD/qquickshadereffectsource_p.h \ -V4DIR = $$PWD/../../qml/qml/v4 -js_class_bindings.output = ${QMAKE_FILE_BASE}_jsclass.cpp -js_class_bindings.input = JS_CLASS_SOURCES -js_class_bindings.script = $$V4DIR/v4classgen -js_class_bindings.commands = python $$js_class_bindings.script ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} -js_class_bindings.depends += $$js_class_bindings.script $$V4DIR/qv4managed_p.h -js_class_bindings.CONFIG += no_link -QMAKE_EXTRA_COMPILERS += js_class_bindings - - include(context2d/context2d.pri)