screencast: Simplify the region path
No need to render the intermediate texture into a second intermediate texture.
This commit is contained in:
parent
6394bccdcb
commit
577c031599
2 changed files with 10 additions and 6 deletions
|
@ -70,7 +70,7 @@ std::chrono::nanoseconds RegionScreenCastSource::clock() const
|
|||
return m_last;
|
||||
}
|
||||
|
||||
void RegionScreenCastSource::render(GLFramebuffer *target)
|
||||
void RegionScreenCastSource::ensureTexture()
|
||||
{
|
||||
if (!m_renderedTexture) {
|
||||
m_renderedTexture.reset(new GLTexture(hasAlphaChannel() ? GL_RGBA8 : GL_RGB8, textureSize()));
|
||||
|
@ -82,6 +82,11 @@ void RegionScreenCastSource::render(GLFramebuffer *target)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RegionScreenCastSource::render(GLFramebuffer *target)
|
||||
{
|
||||
ensureTexture();
|
||||
|
||||
GLFramebuffer::pushFramebuffer(target);
|
||||
QRect r(QPoint(), target->size());
|
||||
|
@ -102,11 +107,8 @@ void RegionScreenCastSource::render(GLFramebuffer *target)
|
|||
|
||||
void RegionScreenCastSource::render(QImage *image)
|
||||
{
|
||||
GLTexture offscreenTexture(hasAlphaChannel() ? GL_RGBA8 : GL_RGB8, textureSize());
|
||||
GLFramebuffer offscreenTarget(&offscreenTexture);
|
||||
|
||||
render(&offscreenTarget);
|
||||
grabTexture(&offscreenTexture, image);
|
||||
ensureTexture();
|
||||
grabTexture(m_renderedTexture.get(), image);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
void updateOutput(Output *output);
|
||||
|
||||
private:
|
||||
void ensureTexture();
|
||||
|
||||
const QRect m_region;
|
||||
const qreal m_scale;
|
||||
std::unique_ptr<GLFramebuffer> m_target;
|
||||
|
|
Loading…
Reference in a new issue