1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

OpenGL context now supports high DPI displays. Added operator* to Rectangle class.

This commit is contained in:
jules 2012-11-15 17:55:57 +00:00
parent 667a18712f
commit f6ce67ed4a
13 changed files with 166 additions and 98 deletions

View file

@ -991,15 +991,15 @@ struct StateHelpers
void add (const RectangleList& list, const PixelARGB& colour) noexcept
{
for (RectangleList::Iterator i (list); i.next();)
add (*i.getRectangle(), colour);
for (const Rectangle<int>* i = list.begin(), * const e = list.end(); i != e; ++i)
add (*i, colour);
}
void add (const RectangleList& list, const Rectangle<int>& clip, const PixelARGB& colour) noexcept
{
for (RectangleList::Iterator i (list); i.next();)
for (const Rectangle<int>* i = list.begin(), * const e = list.end(); i != e; ++i)
{
const Rectangle<int> r (i.getRectangle()->getIntersection (clip));
const Rectangle<int> r (i->getIntersection (clip));
if (! r.isEmpty())
add (r, colour);
@ -1714,9 +1714,9 @@ public:
const PixelARGB colour (fill.colour.getPixelARGB());
ShaderFillOperation fillOp (*this, fill, false, false);
for (RectangleList::Iterator i (clip); i.next();)
for (const Rectangle<int>* i = clip.begin(), * const e = clip.end(); i != e; ++i)
{
const Rectangle<float> r (i.getRectangle()->toFloat().getIntersection (area));
const Rectangle<float> r (i->toFloat().getIntersection (area));
if (! r.isEmpty())
state.shaderQuadQueue.add (r, colour);
}
@ -1832,6 +1832,11 @@ public:
cloneClipIfMultiplyReferenced();
clip = clip->clipToRectangle (transform.translated (r));
}
else if (transform.isIntegerScaling)
{
cloneClipIfMultiplyReferenced();
clip = clip->clipToRectangle (transform.transformed (r));
}
else
{
Path p;
@ -1854,6 +1859,16 @@ public:
offsetList.offsetAll (transform.xOffset, transform.yOffset);
clip = clip->clipToRectangleList (offsetList);
}
else if (transform.isIntegerScaling)
{
cloneClipIfMultiplyReferenced();
RectangleList scaledList;
for (const Rectangle<int>* i = r.begin(), * const e = r.end(); i != e; ++i)
scaledList.add (transform.transformed (*i));
clip = clip->clipToRectangleList (scaledList);
}
else
{
clipToPath (r.toPath(), AffineTransform::identity);
@ -2234,20 +2249,18 @@ LowLevelGraphicsContext* createOpenGLContext (const Target& target)
}
//==============================================================================
LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context)
LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context, int width, int height)
{
return createOpenGLGraphicsContext (context, context.getFrameBufferID(),
context.getWidth(), context.getHeight());
return createOpenGLGraphicsContext (context, context.getFrameBufferID(), width, height);
}
LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context, OpenGLFrameBuffer& target)
{
using namespace OpenGLRendering;
return createOpenGLContext (Target (context, target, Point<int>()));
return OpenGLRendering::createOpenGLContext (OpenGLRendering::Target (context, target, Point<int>()));
}
LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context, unsigned int frameBufferID, int width, int height)
{
using namespace OpenGLRendering;
return createOpenGLContext (Target (context, frameBufferID, width, height));
return OpenGLRendering::createOpenGLContext (OpenGLRendering::Target (context, frameBufferID, width, height));
}