summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-10-11 23:24:42 +0100
committerMichael Meeks <michael.meeks@collabora.com>2014-10-11 23:24:42 +0100
commit54cab7f193d5dc6b13350c78695fd3f4485476bd (patch)
tree74ccc1e30ee0f9b608d6d01a83afa5823a82c495
parent3b6414908f271be9ddde18889c3c28d9ee4c4bea (diff)
icontest: allow initial scaling to test direct bitmap rendering path.private/mmeeks/icontest
Change-Id: Id670bfd4af8bfabe01b5b006ce5c9ccf029dfb6c
-rw-r--r--vcl/workben/icontest.cxx36
1 files changed, 29 insertions, 7 deletions
diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx
index 7e2fd413d9f5..a8df1c9cb5e6 100644
--- a/vcl/workben/icontest.cxx
+++ b/vcl/workben/icontest.cxx
@@ -54,7 +54,6 @@ namespace {
return (double)aValue.Seconds +
(double)aValue.Nanosec / (1000*1000*1000);
}
-
}
class MyWorkWindow : public WorkWindow
@@ -97,12 +96,15 @@ void MyWorkWindow::Paint( const Rectangle& /* rRect */ )
OutputDevice &rDev = *this;
// yes indeed drawinglayer re-scales the image per render etc.
- BitmapEx aScaledBitamp( maGraphic.GetBitmapEx() );
- aScaledBitamp.Scale( maDestinationSize, BMP_SCALE_SUPER);
+ BitmapEx aScaledBitmap( maGraphic.GetBitmapEx() );
+ aScaledBitmap.Scale( maDestinationSize, BMP_SCALE_SUPER);
std::cerr << "==> Paint! " << nPaintCount++ << " (vcl) " << GetSizePixel() << " " << getTimeNow() - nStartTime << " image of size " << maGraphic.GetBitmapEx().GetSizePixel() << " scale to size " << maDestinationSize << std::endl;
- rDev.DrawBitmapEx( Point( 0, 0 ), aScaledBitamp );
+ rDev.DrawBitmapEx( Point( 0, 0 ), aScaledBitmap );
+
+ if (nPaintCount > 100)
+ Application::Quit();
Invalidate( INVALIDATE_CHILDREN ); // trigger re-render
}
@@ -112,12 +114,20 @@ void MyWorkWindow::Paint( const Rectangle& /* rRect */ )
void MyOpenGLWorkWindow::Paint( const Rectangle& )
{
std::cerr << "==> Paint! "<< nPaintCount++ << " (OpenGL) " << GetSizePixel() << " " << getTimeNow() - nStartTime << std::endl;
+
OpenGLContext& aCtx = mpOpenGLWindow->getContext();
aCtx.makeCurrent();
CHECK_GL_ERROR();
aCtx.requestLegacyContext();
CHECK_GL_ERROR();
+ if (aCtx.supportMultiSampling())
+ {
+ // doesn't work but worth a try ...
+ glEnable(GL_MULTISAMPLE);
+ CHECK_GL_ERROR();
+ }
+
if (!mbHaveTexture)
LoadTexture();
@@ -143,7 +153,7 @@ void MyOpenGLWorkWindow::Paint( const Rectangle& )
glPushMatrix();
CHECK_GL_ERROR();
- glTranslatef(-1, -1, 0);
+ glTranslatef(-1, -0.5, 0);
glScalef(2, 2, 2);
if (mnTextureAspect >= ((float) WIDTH) / HEIGHT)
@@ -170,6 +180,9 @@ void MyOpenGLWorkWindow::Paint( const Rectangle& )
aCtx.swapBuffers();
CHECK_GL_ERROR();
+ if (nPaintCount > 100)
+ Application::Quit();
+
Invalidate( INVALIDATE_CHILDREN ); // trigger re-render
}
@@ -225,9 +238,11 @@ void MyOpenGLWorkWindow::LoadTexture()
CHECK_GL_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ // Need to better simulate scale24bitRGB2 cf. bitmapscalesuper.cxx
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
CHECK_GL_ERROR();
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
CHECK_GL_ERROR();
BitmapEx aBitmap( maGraphic.GetBitmapEx( ) );
@@ -365,6 +380,13 @@ void MyWorkWindow::LoadGraphic( const OUString &sImageFile )
maDestinationSize = Size( WIDTH, HEIGHT/aspect );
else
maDestinationSize = Size( WIDTH * aspect, HEIGHT );
+
+ if (getenv("PRESCALE")) // test non-scaling rendering
+ {
+ BitmapEx aScaledBitmap( maGraphic.GetBitmapEx() );
+ aScaledBitmap.Scale( maDestinationSize, BMP_SCALE_SUPER);
+ maGraphic = Graphic( aScaledBitmap );
+ }
}
catch (const uno::Exception &e)
{