Skip to content

Commit

Permalink
gl: normalize check for invalid roi
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed May 9, 2015
1 parent 84700f2 commit a03251e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/QtAV/VideoShader.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 143,8 @@ class Q_AV_EXPORT VideoMaterial
QRectF normalizedROI(const QRectF& roi) const;
/*!
* \brief mapToFrame
* map a point p or a rect r to video texture (of 1st plane) and scaled to valid width.
* p or r is in video frame's rect, no matter which plane is
* map a point p or a rect r to video texture in a given plane and scaled to valid width.
* p or r is in video frame's rect coordinates, no matter which plane is
* \param normalize -1: auto(do not normalize for rectangle texture). 0: no. 1: yes
* \return
* point or rect in current texture valid coordinates. \sa validTextureWidth()
Expand Down
4 changes: 2 additions & 2 deletions src/VideoShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 733,8 @@ QRectF VideoMaterial::mapToTexture(int plane, const QRectF &roi, int normalize)
const qreal s = tex0W/qreal(d.width); // only apply to unnormalized input roi
const qreal pw = d.video_format.normalizedWidth(plane);
const qreal ph = d.video_format.normalizedHeight(plane);
if (normalize < 0)
normalize = d.target != GL_TEXTURE_RECTANGLE;
if (!roi.isValid()) {
if (normalize)
return QRectF(0, 0, d.effective_tex_width_ratio, 1); //NOTE: not (0, 0, 1, 1)
Expand All @@ -742,8 744,6 @@ QRectF VideoMaterial::mapToTexture(int plane, const QRectF &roi, int normalize)
float w = roi.width(); //TODO: texturewidth
float y = roi.y();
float h = roi.height();
if (normalize < 0)
normalize = d.target != GL_TEXTURE_RECTANGLE;
if (normalize) {
if (qAbs(x) > 1) {
x /= tex0W;
Expand Down

0 comments on commit a03251e

Please sign in to comment.