Browse Source

OpenGL: Take a Component's transform into account when painting

tags/2021-05-28
ed 7 years ago
parent
commit
515f4846a5
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      modules/juce_opengl/opengl/juce_OpenGLContext.cpp

+ 6
- 2
modules/juce_opengl/opengl/juce_OpenGLContext.cpp View File

@@ -289,10 +289,13 @@ public:
.withZeroOrigin() .withZeroOrigin()
* newScale; * newScale;
if (scale != newScale || viewportArea != newArea)
auto newTransform = component.getTransform();
if (scale != newScale || viewportArea != newArea || transform != newTransform)
{ {
scale = newScale; scale = newScale;
viewportArea = newArea; viewportArea = newArea;
transform = newTransform;
if (canTriggerUpdate) if (canTriggerUpdate)
invalidateAll(); invalidateAll();
@@ -335,7 +338,7 @@ public:
{ {
ScopedPointer<LowLevelGraphicsContext> g (createOpenGLGraphicsContext (context, cachedImageFrameBuffer)); ScopedPointer<LowLevelGraphicsContext> g (createOpenGLGraphicsContext (context, cachedImageFrameBuffer));
g->clipToRectangleList (invalid); g->clipToRectangleList (invalid);
g->addTransform (AffineTransform::scale ((float) scale));
g->addTransform (transform.followedBy (AffineTransform::scale ((float) scale)));
paintOwner (*g); paintOwner (*g);
JUCE_CHECK_OPENGL_ERROR JUCE_CHECK_OPENGL_ERROR
@@ -619,6 +622,7 @@ public:
RectangleList<int> validArea; RectangleList<int> validArea;
Rectangle<int> viewportArea, lastScreenBounds; Rectangle<int> viewportArea, lastScreenBounds;
double scale = 1.0; double scale = 1.0;
AffineTransform transform;
#if JUCE_OPENGL3 #if JUCE_OPENGL3
GLuint vertexArrayObject = 0; GLuint vertexArrayObject = 0;
#endif #endif


Loading…
Cancel
Save