diff --git a/effects/effects.h b/effects/effects.h index 73a0b7a56..15d77aecb 100644 --- a/effects/effects.h +++ b/effects/effects.h @@ -41,6 +41,9 @@ public: QSpinBox* opacity; public slots: void toggle_uniform_scale(bool enabled); +private: + int default_anchor_x; + int default_anchor_y; }; // audio effects diff --git a/effects/transformeffect.cpp b/effects/transformeffect.cpp index 0ce6e5bee..b24fff230 100644 --- a/effects/transformeffect.cpp +++ b/effects/transformeffect.cpp @@ -78,8 +78,10 @@ TransformEffect::TransformEffect(Clip* c) : Effect(c) { scale_y->setValue(100); scale_y->setEnabled(false); uniform_scale_box->setChecked(true); - anchor_x_box->setValue(c->media_stream->video_width/2); - anchor_y_box->setValue(c->media_stream->video_height/2); + default_anchor_x = c->media_stream->video_width/2; + default_anchor_y = c->media_stream->video_height/2; + anchor_x_box->setValue(default_anchor_x); + anchor_y_box->setValue(default_anchor_y); opacity->setValue(100); connect(position_x, SIGNAL(valueChanged(int)), this, SLOT(field_changed())); @@ -117,8 +119,8 @@ void TransformEffect::process_gl(int* anchor_x, int* anchor_y) { glTranslatef(position_x->value()-(parent_clip->sequence->width/2), position_y->value()-(parent_clip->sequence->height/2), 0); // anchor point - *anchor_x += anchor_x_box->value(); - *anchor_y += anchor_y_box->value(); + *anchor_x += (anchor_x_box->value()-default_anchor_x); + *anchor_y += (anchor_y_box->value()-default_anchor_y); // rotation glRotatef(rotation->value(), 0, 0, 1); diff --git a/ui/viewerwidget.cpp b/ui/viewerwidget.cpp index b7dcb0cd0..2f60990e7 100644 --- a/ui/viewerwidget.cpp +++ b/ui/viewerwidget.cpp @@ -86,8 +86,8 @@ void ViewerWidget::paintGL() int half_width = c->sequence->width/2; int half_height = c->sequence->height/2; glOrtho(-half_width, half_width, half_height,- half_height, -1, 1); - int anchor_x = 0; - int anchor_y = 0; + int anchor_x = c->media_stream->video_width/2; + int anchor_y = c->media_stream->video_height/2; // perform all transform effects for (int j=0;jeffects.size();j++) {