mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-22 01:34:21 +00:00
Minor additions to ValueTree, Time. OpenGL work. Update to introjucer MSVC .sln file generation.
This commit is contained in:
parent
0e478bf131
commit
9eb2e337d3
15 changed files with 72 additions and 240 deletions
|
|
@ -58,7 +58,7 @@ public:
|
|||
getSDKPath() = "${user.home}/SDKs/android-sdk-mac_x86";
|
||||
|
||||
if (getNDKPath().toString().isEmpty())
|
||||
getNDKPath() = "${user.home}/SDKs/android-ndk-r5";
|
||||
getNDKPath() = "${user.home}/SDKs/android-ndk-r6b";
|
||||
|
||||
if (getInternetNeeded().toString().isEmpty())
|
||||
getInternetNeeded() = true;
|
||||
|
|
|
|||
|
|
@ -156,9 +156,13 @@ protected:
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
void writeSolutionFile (OutputStream& out, const String& versionString, const File& vcProject)
|
||||
void writeSolutionFile (OutputStream& out, const String& versionString, String commentString, const File& vcProject)
|
||||
{
|
||||
if (commentString.isNotEmpty())
|
||||
commentString += newLine;
|
||||
|
||||
out << "Microsoft Visual Studio Solution File, Format Version " << versionString << newLine
|
||||
<< commentString
|
||||
<< "Project(\"" << createGUID (projectName + "sln_guid") << "\") = \"" << projectName << "\", \""
|
||||
<< vcProject.getFileName() << "\", \"" << projectGUID << '"' << newLine
|
||||
<< "EndProject" << newLine
|
||||
|
|
@ -395,7 +399,7 @@ public:
|
|||
|
||||
{
|
||||
MemoryOutputStream mo;
|
||||
writeSolutionFile (mo, getSolutionVersionString(), getVCProjFile());
|
||||
writeSolutionFile (mo, getSolutionVersionString(), String::empty, getVCProjFile());
|
||||
|
||||
overwriteFileIfDifferentOrThrow (getSLNFile(), mo);
|
||||
}
|
||||
|
|
@ -1037,7 +1041,7 @@ public:
|
|||
|
||||
{
|
||||
MemoryOutputStream mo;
|
||||
writeSolutionFile (mo, "11.00", getVCProjFile());
|
||||
writeSolutionFile (mo, "11.00", "# Visual Studio 2010", getVCProjFile());
|
||||
|
||||
overwriteFileIfDifferentOrThrow (getSLNFile(), mo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{B49533A3-E69B-E288-783B-47C939C7FB33}") = "Juce Demo", "Juce Demo.vcxproj", "{E9F746BA-9271-B101-E5E2-1615849AF13D}"
|
||||
EndProject
|
||||
Global
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{BA4B9728-10E7-5D2D-B621-D98C8C6069F5}") = "juce", "juce.vcxproj", "{6C6FE871-80B5-5611-1C8D-17A6CCA9ADFA}"
|
||||
EndProject
|
||||
Global
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{564A18DF-F8DA-8D8F-D473-CFFE700460BA}") = "Jucer", "Jucer.vcxproj", "{47850045-7AC4-D12B-6F23-A2E7E3B3617A}"
|
||||
EndProject
|
||||
Global
|
||||
|
|
|
|||
|
|
@ -375,6 +375,7 @@ String Time::formatted (const String& format) const
|
|||
//==============================================================================
|
||||
int Time::getYear() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_year + 1900; }
|
||||
int Time::getMonth() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_mon; }
|
||||
int Time::getDayOfYear() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_yday; }
|
||||
int Time::getDayOfMonth() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_mday; }
|
||||
int Time::getDayOfWeek() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_wday; }
|
||||
int Time::getHours() const noexcept { return TimeHelpers::millisToLocal (millisSinceEpoch).tm_hour; }
|
||||
|
|
|
|||
|
|
@ -132,17 +132,20 @@ public:
|
|||
String getMonthName (bool threeLetterVersion) const;
|
||||
|
||||
/** Returns the day of the month.
|
||||
|
||||
The value returned is in the range 1 to 31.
|
||||
*/
|
||||
int getDayOfMonth() const noexcept;
|
||||
|
||||
/** Returns the number of the day of the week.
|
||||
|
||||
The value returned is in the range 0 to 6 (0 = sunday, 1 = monday, etc).
|
||||
*/
|
||||
int getDayOfWeek() const noexcept;
|
||||
|
||||
/** Returns the number of the day of the year.
|
||||
The value returned is in the range 0 to 365.
|
||||
*/
|
||||
int getDayOfYear() const noexcept;
|
||||
|
||||
/** Returns the name of the weekday.
|
||||
|
||||
@param threeLetterVersion if true, it'll return a 3-letter abbreviation, e.g. "Tue"; if
|
||||
|
|
|
|||
|
|
@ -684,12 +684,14 @@ var ValueTree::getProperty (const Identifier& name, const var& defaultReturnValu
|
|||
return object == nullptr ? defaultReturnValue : object->getProperty (name, defaultReturnValue);
|
||||
}
|
||||
|
||||
void ValueTree::setProperty (const Identifier& name, const var& newValue, UndoManager* const undoManager)
|
||||
ValueTree& ValueTree::setProperty (const Identifier& name, const var& newValue, UndoManager* const undoManager)
|
||||
{
|
||||
jassert (name.toString().isNotEmpty());
|
||||
|
||||
if (object != nullptr && name.toString().isNotEmpty())
|
||||
object->setProperty (name, newValue, undoManager);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool ValueTree::hasProperty (const Identifier& name) const
|
||||
|
|
|
|||
|
|
@ -167,8 +167,9 @@ public:
|
|||
If the undoManager parameter is non-null, its UndoManager::perform() method will be used,
|
||||
so that this change can be undone.
|
||||
@see var, getProperty, removeProperty
|
||||
@returns a reference to the value tree, so that you can daisy-chain calls to this method.
|
||||
*/
|
||||
void setProperty (const Identifier& name, const var& newValue, UndoManager* undoManager);
|
||||
ValueTree& setProperty (const Identifier& name, const var& newValue, UndoManager* undoManager);
|
||||
|
||||
/** Returns true if the node contains a named property. */
|
||||
bool hasProperty (const Identifier& name) const;
|
||||
|
|
|
|||
|
|
@ -144,5 +144,11 @@ bool FillType::isInvisible() const noexcept
|
|||
return colour.isTransparent() || (gradient != nullptr && gradient->isInvisible());
|
||||
}
|
||||
|
||||
FillType FillType::transformed (const AffineTransform& t) const
|
||||
{
|
||||
FillType f (*this);
|
||||
f.transform = f.transform.followedBy (t);
|
||||
return f;
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -112,6 +112,11 @@ public:
|
|||
/** Returns true if this fill type is completely transparent. */
|
||||
bool isInvisible() const noexcept;
|
||||
|
||||
/** Returns a copy of this fill, adding the specified transform applied to the
|
||||
existing transform.
|
||||
*/
|
||||
FillType transformed (const AffineTransform& transform) const;
|
||||
|
||||
//==============================================================================
|
||||
/** The solid colour being used.
|
||||
|
||||
|
|
|
|||
|
|
@ -49,19 +49,15 @@ public:
|
|||
~LowLevelGraphicsSoftwareRenderer();
|
||||
|
||||
bool isVectorDevice() const;
|
||||
|
||||
//==============================================================================
|
||||
void setOrigin (int x, int y);
|
||||
void addTransform (const AffineTransform& transform);
|
||||
void addTransform (const AffineTransform&);
|
||||
float getScaleFactor();
|
||||
|
||||
bool clipToRectangle (const Rectangle<int>& r);
|
||||
bool clipToRectangleList (const RectangleList& clipRegion);
|
||||
void excludeClipRectangle (const Rectangle<int>& r);
|
||||
void clipToPath (const Path& path, const AffineTransform& transform);
|
||||
void clipToImageAlpha (const Image& sourceImage, const AffineTransform& transform);
|
||||
|
||||
bool clipRegionIntersects (const Rectangle<int>& r);
|
||||
bool clipToRectangle (const Rectangle<int>&);
|
||||
bool clipToRectangleList (const RectangleList&);
|
||||
void excludeClipRectangle (const Rectangle<int>&);
|
||||
void clipToPath (const Path&, const AffineTransform&);
|
||||
void clipToImageAlpha (const Image&, const AffineTransform&);
|
||||
bool clipRegionIntersects (const Rectangle<int>&);
|
||||
Rectangle<int> getClipBounds() const;
|
||||
bool isClipEmpty() const;
|
||||
|
||||
|
|
@ -71,29 +67,25 @@ public:
|
|||
void beginTransparencyLayer (float opacity);
|
||||
void endTransparencyLayer();
|
||||
|
||||
//==============================================================================
|
||||
void setFill (const FillType& fillType);
|
||||
void setFill (const FillType&);
|
||||
void setOpacity (float opacity);
|
||||
void setInterpolationQuality (Graphics::ResamplingQuality quality);
|
||||
void setInterpolationQuality (Graphics::ResamplingQuality);
|
||||
|
||||
//==============================================================================
|
||||
void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
|
||||
void fillPath (const Path& path, const AffineTransform& transform);
|
||||
void fillRect (const Rectangle<int>&, bool replaceExistingContents);
|
||||
void fillPath (const Path&, const AffineTransform&);
|
||||
|
||||
void drawImage (const Image& sourceImage, const AffineTransform& transform);
|
||||
void drawImage (const Image&, const AffineTransform&);
|
||||
|
||||
void drawLine (const Line <float>& line);
|
||||
|
||||
void drawVerticalLine (int x, float top, float bottom);
|
||||
void drawHorizontalLine (int x, float top, float bottom);
|
||||
|
||||
//==============================================================================
|
||||
void setFont (const Font& newFont);
|
||||
void setFont (const Font&);
|
||||
Font getFont();
|
||||
void drawGlyph (int glyphNumber, float x, float y);
|
||||
void drawGlyph (int glyphNumber, const AffineTransform& transform);
|
||||
void drawGlyph (int glyphNumber, const AffineTransform&);
|
||||
|
||||
//==============================================================================
|
||||
#ifndef DOXYGEN
|
||||
class SavedState;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -139,8 +139,6 @@ public:
|
|||
return;
|
||||
#endif
|
||||
|
||||
OpenGLHelpers::resetErrorState();
|
||||
|
||||
glGenFramebuffersEXT (1, &frameBufferHandle);
|
||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, frameBufferHandle);
|
||||
|
||||
|
|
@ -302,6 +300,8 @@ bool OpenGLFrameBuffer::initialise (const OpenGLFrameBuffer& other)
|
|||
glColor4f (1.0f, 1.0f, 1.0f, 1.0f);
|
||||
other.drawAt (0, 0);
|
||||
pimpl->unbind();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -384,9 +384,8 @@ bool OpenGLFrameBuffer::readPixels (PixelARGB* target, const Rectangle<int>& are
|
|||
return false;
|
||||
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 4);
|
||||
glReadPixels (area.getX(), area.getY(), area.getWidth(), area.getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, target);
|
||||
glReadPixels (area.getX(), area.getY(), area.getWidth(), area.getHeight(), GL_BGRA_EXT, GL_UNSIGNED_BYTE, target);
|
||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -395,8 +394,6 @@ bool OpenGLFrameBuffer::writePixels (const PixelARGB* data, const Rectangle<int>
|
|||
if (! makeCurrentRenderingTarget())
|
||||
return false;
|
||||
|
||||
const int invertedY = pimpl->height - area.getBottom();
|
||||
|
||||
OpenGLHelpers::prepareFor2D (pimpl->width, pimpl->height);
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glDisable (GL_BLEND);
|
||||
|
|
@ -414,11 +411,11 @@ bool OpenGLFrameBuffer::writePixels (const PixelARGB* data, const Rectangle<int>
|
|||
const GLint cropRect[4] = { 0, 0, area.getWidth(), area.getHeight() };
|
||||
glTexParameteriv (GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);
|
||||
|
||||
glDrawTexiOES (area.getX(), invertedY, 1, area.getWidth(), area.getHeight());
|
||||
glDrawTexiOES (area.getX(), area.getY(), 1, area.getWidth(), area.getHeight());
|
||||
glBindTexture (GL_TEXTURE_2D, 0);
|
||||
}
|
||||
#else
|
||||
glRasterPos2i (area.getX(), invertedY);
|
||||
glRasterPos2i (area.getX(), area.getY());
|
||||
glBindTexture (GL_TEXTURE_2D, 0);
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
|
||||
glDrawPixels (area.getWidth(), area.getHeight(), GL_BGRA_EXT, GL_UNSIGNED_BYTE, data);
|
||||
|
|
|
|||
|
|
@ -163,6 +163,12 @@ void OpenGLHelpers::applyTransform (const AffineTransform& t)
|
|||
glMultMatrixf (m);
|
||||
}
|
||||
|
||||
void OpenGLHelpers::enableScissorTest (const Rectangle<int>& clip)
|
||||
{
|
||||
glEnable (GL_SCISSOR_TEST);
|
||||
glScissor (clip.getX(), clip.getY(), clip.getWidth(), clip.getHeight());
|
||||
}
|
||||
|
||||
void OpenGLHelpers::drawQuad2D (float x1, float y1,
|
||||
float x2, float y2,
|
||||
float x3, float y3,
|
||||
|
|
@ -210,140 +216,6 @@ void OpenGLHelpers::drawQuad3D (float x1, float y1, float z1,
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
namespace OpenGLGradientHelpers
|
||||
{
|
||||
void drawTriangles (GLenum mode, const GLfloat* vertices, const GLfloat* textureCoords, const int numElements)
|
||||
{
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
glEnableClientState (GL_VERTEX_ARRAY);
|
||||
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState (GL_COLOR_ARRAY);
|
||||
glDisableClientState (GL_NORMAL_ARRAY);
|
||||
|
||||
glVertexPointer (2, GL_FLOAT, 0, vertices);
|
||||
glTexCoordPointer (2, GL_FLOAT, 0, textureCoords);
|
||||
|
||||
glColor4f (1.0f, 1.0f, 1.0f, 1.0f);
|
||||
glDrawArrays (mode, 0, numElements);
|
||||
}
|
||||
|
||||
void fillWithLinearGradient (const Rectangle<int>& rect,
|
||||
const ColourGradient& grad,
|
||||
const AffineTransform& transform,
|
||||
const int textureSize)
|
||||
{
|
||||
const Point<float> p1 (grad.point1.transformedBy (transform));
|
||||
const Point<float> p2 (grad.point2.transformedBy (transform));
|
||||
const Point<float> p3 (Point<float> (grad.point1.getX() - (grad.point2.getY() - grad.point1.getY()) / textureSize,
|
||||
grad.point1.getY() + (grad.point2.getX() - grad.point1.getX()) / textureSize).transformedBy (transform));
|
||||
|
||||
const AffineTransform textureTransform (AffineTransform::fromTargetPoints (p1.getX(), p1.getY(), 0.0f, 0.0f,
|
||||
p2.getX(), p2.getY(), 1.0f, 0.0f,
|
||||
p3.getX(), p3.getY(), 0.0f, 1.0f));
|
||||
|
||||
const GLfloat l = (GLfloat) rect.getX();
|
||||
const GLfloat r = (GLfloat) rect.getRight();
|
||||
const GLfloat t = (GLfloat) rect.getY();
|
||||
const GLfloat b = (GLfloat) rect.getBottom();
|
||||
|
||||
const GLfloat vertices[] = { l, t, r, t, l, b, r, b };
|
||||
GLfloat textureCoords[] = { l, t, r, t, l, b, r, b };
|
||||
|
||||
textureTransform.transformPoints (textureCoords[0], textureCoords[1], textureCoords[2], textureCoords[3]);
|
||||
textureTransform.transformPoints (textureCoords[4], textureCoords[5], textureCoords[6], textureCoords[7]);
|
||||
|
||||
drawTriangles (GL_TRIANGLE_STRIP, vertices, textureCoords, 4);
|
||||
}
|
||||
|
||||
void fillWithRadialGradient (const Rectangle<int>& rect,
|
||||
const ColourGradient& grad,
|
||||
const AffineTransform& transform)
|
||||
{
|
||||
const Point<float> centre (grad.point1.transformedBy (transform));
|
||||
|
||||
const float screenRadius = centre.getDistanceFrom (rect.getCentre().toFloat())
|
||||
+ Point<int> (rect.getWidth() / 2,
|
||||
rect.getHeight() / 2).getDistanceFromOrigin()
|
||||
+ 8.0f;
|
||||
|
||||
const AffineTransform inverse (transform.inverted());
|
||||
const float sourceRadius = jmax (Point<float> (screenRadius, 0.0f).transformedBy (inverse).getDistanceFromOrigin(),
|
||||
Point<float> (0.0f, screenRadius).transformedBy (inverse).getDistanceFromOrigin());
|
||||
|
||||
const int numDivisions = 90;
|
||||
GLfloat vertices [4 + numDivisions * 2];
|
||||
GLfloat textureCoords [4 + numDivisions * 2];
|
||||
|
||||
{
|
||||
GLfloat* t = textureCoords;
|
||||
*t++ = 0.0f;
|
||||
*t++ = 0.0f;
|
||||
|
||||
const GLfloat texturePos = sourceRadius / grad.point1.getDistanceFrom (grad.point2);
|
||||
|
||||
for (int i = numDivisions + 1; --i >= 0;)
|
||||
{
|
||||
*t++ = texturePos;
|
||||
*t++ = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
GLfloat* v = vertices;
|
||||
*v++ = centre.getX();
|
||||
*v++ = centre.getY();
|
||||
|
||||
const Point<float> first (grad.point1.translated (0, -sourceRadius)
|
||||
.transformedBy (transform));
|
||||
*v++ = first.getX();
|
||||
*v++ = first.getY();
|
||||
|
||||
for (int i = 1; i < numDivisions; ++i)
|
||||
{
|
||||
const float angle = i * (float_Pi * 2.0f / numDivisions);
|
||||
const Point<float> p (grad.point1.translated (std::sin (angle) * sourceRadius,
|
||||
std::cos (angle) * -sourceRadius)
|
||||
.transformedBy (transform));
|
||||
*v++ = p.getX();
|
||||
*v++ = p.getY();
|
||||
}
|
||||
|
||||
*v++ = first.getX();
|
||||
*v++ = first.getY();
|
||||
}
|
||||
|
||||
glEnable (GL_SCISSOR_TEST);
|
||||
glScissor (rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
|
||||
drawTriangles (GL_TRIANGLE_FAN, vertices, textureCoords, numDivisions + 2);
|
||||
glDisable (GL_SCISSOR_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLHelpers::fillRectWithColourGradient (const Rectangle<int>& rect,
|
||||
const ColourGradient& gradient,
|
||||
const AffineTransform& transform)
|
||||
{
|
||||
const int textureSize = 256;
|
||||
OpenGLTexture texture;
|
||||
|
||||
HeapBlock<PixelARGB> lookup (textureSize);
|
||||
gradient.createLookupTable (lookup, textureSize);
|
||||
texture.load (lookup, textureSize, 1);
|
||||
texture.bind();
|
||||
|
||||
if (gradient.point1 == gradient.point2)
|
||||
{
|
||||
fillRectWithColour (rect, gradient.getColourAtPosition (1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gradient.isRadial)
|
||||
OpenGLGradientHelpers::fillWithRadialGradient (rect, gradient, transform);
|
||||
else
|
||||
OpenGLGradientHelpers::fillWithLinearGradient (rect, gradient, transform, textureSize);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGLHelpers::fillRectWithColour (const Rectangle<int>& rect, const Colour& colour)
|
||||
{
|
||||
glEnableClientState (GL_VERTEX_ARRAY);
|
||||
|
|
@ -365,48 +237,11 @@ void OpenGLHelpers::fillRect (const Rectangle<int>& rect)
|
|||
glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
void OpenGLHelpers::fillRectWithTiledTexture (int textureWidth, int textureHeight,
|
||||
const Rectangle<int>& clip,
|
||||
const AffineTransform& transform,
|
||||
float alpha)
|
||||
{
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glEnableClientState (GL_VERTEX_ARRAY);
|
||||
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState (GL_COLOR_ARRAY);
|
||||
glDisableClientState (GL_NORMAL_ARRAY);
|
||||
glColor4f (1.0f, 1.0f, 1.0f, alpha);
|
||||
|
||||
const GLfloat clipX = (GLfloat) clip.getX();
|
||||
const GLfloat clipY = (GLfloat) clip.getY();
|
||||
const GLfloat clipR = (GLfloat) clip.getRight();
|
||||
const GLfloat clipB = (GLfloat) clip.getBottom();
|
||||
|
||||
const GLfloat vertices[] = { clipX, clipY, clipR, clipY, clipX, clipB, clipR, clipB };
|
||||
GLfloat textureCoords[] = { clipX, clipY, clipR, clipY, clipX, clipB, clipR, clipB };
|
||||
|
||||
{
|
||||
const AffineTransform t (transform.inverted().scaled (1.0f / textureWidth,
|
||||
1.0f / textureHeight));
|
||||
t.transformPoints (textureCoords[0], textureCoords[1], textureCoords[2], textureCoords[3]);
|
||||
t.transformPoints (textureCoords[4], textureCoords[5], textureCoords[6], textureCoords[7]);
|
||||
}
|
||||
|
||||
glVertexPointer (2, GL_FLOAT, 0, vertices);
|
||||
glTexCoordPointer (2, GL_FLOAT, 0, textureCoords);
|
||||
|
||||
glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
struct OpenGLEdgeTableRenderer
|
||||
{
|
||||
OpenGLEdgeTableRenderer (float r_, float g_, float b_, const Point<int>& origin_) noexcept
|
||||
: origin (origin_), r (r_), g (g_), b (b_), lastAlpha (-1)
|
||||
OpenGLEdgeTableRenderer (float r_, float g_, float b_) noexcept
|
||||
: r (r_), g (g_), b (b_), lastAlpha (-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -421,12 +256,8 @@ struct OpenGLEdgeTableRenderer
|
|||
|
||||
void setEdgeTableYPos (const int y) noexcept
|
||||
{
|
||||
const int lineY = y + origin.getY();
|
||||
|
||||
vertices[1] = (GLfloat) lineY;
|
||||
vertices[3] = (GLfloat) (lineY + 1);
|
||||
vertices[5] = (GLfloat) lineY;
|
||||
vertices[7] = (GLfloat) (lineY + 1);
|
||||
vertices[1] = vertices[5] = (GLfloat) y;
|
||||
vertices[3] = vertices[7] = (GLfloat) (y + 1);
|
||||
}
|
||||
|
||||
void handleEdgeTablePixel (const int x, const int alphaLevel) noexcept
|
||||
|
|
@ -451,18 +282,13 @@ struct OpenGLEdgeTableRenderer
|
|||
|
||||
private:
|
||||
GLfloat vertices[8];
|
||||
const Point<int> origin;
|
||||
const float r, g, b;
|
||||
int lastAlpha;
|
||||
|
||||
void drawHorizontal (int x, const int w, const int alphaLevel) noexcept
|
||||
{
|
||||
x += origin.getX();
|
||||
|
||||
vertices[0] = (GLfloat) x;
|
||||
vertices[2] = (GLfloat) x;
|
||||
vertices[4] = (GLfloat) (x + w);
|
||||
vertices[6] = (GLfloat) (x + w);
|
||||
vertices[0] = vertices[2] = (GLfloat) x;
|
||||
vertices[4] = vertices[6] = (GLfloat) (x + w);
|
||||
|
||||
if (lastAlpha != alphaLevel)
|
||||
{
|
||||
|
|
@ -477,10 +303,9 @@ private:
|
|||
};
|
||||
|
||||
void OpenGLHelpers::fillEdgeTable (const EdgeTable& edgeTable,
|
||||
float red, float green, float blue,
|
||||
const Point<int>& offset)
|
||||
float red, float green, float blue)
|
||||
{
|
||||
OpenGLEdgeTableRenderer etr (red, green, blue, offset);
|
||||
OpenGLEdgeTableRenderer etr (red, green, blue);
|
||||
etr.draw (edgeTable);
|
||||
}
|
||||
|
||||
|
|
@ -776,6 +601,7 @@ void TriangulatedPath::draw (const int oversamplingLevel) const
|
|||
{
|
||||
glColor4f (1.0f, 1.0f, 1.0f, 1.0f / (oversamplingLevel * oversamplingLevel));
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef (-0.5f, -0.5f, 0.0f);
|
||||
const float inc = 1.0f / oversamplingLevel;
|
||||
|
||||
|
|
@ -791,6 +617,8 @@ void TriangulatedPath::draw (const int oversamplingLevel) const
|
|||
|
||||
glTranslatef (-1.0f, inc, 0.0f);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void TriangulatedPath::optimiseStorage()
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ public:
|
|||
|
||||
static void applyTransform (const AffineTransform& t);
|
||||
|
||||
static void enableScissorTest (const Rectangle<int>& clip);
|
||||
|
||||
/** Draws a 2D quad with the specified corner points. */
|
||||
static void drawQuad2D (float x1, float y1,
|
||||
float x2, float y2,
|
||||
|
|
@ -76,21 +78,9 @@ public:
|
|||
/** Fills a rectangle with the specified colour. */
|
||||
static void fillRectWithColour (const Rectangle<int>& rect,
|
||||
const Colour& colour);
|
||||
|
||||
/** Fills a rectangle with the specified gradient. */
|
||||
static void fillRectWithColourGradient (const Rectangle<int>& rect,
|
||||
const ColourGradient& gradient,
|
||||
const AffineTransform& transform);
|
||||
|
||||
static void fillRectWithTiledTexture (int textureWidth, int textureHeight,
|
||||
const Rectangle<int>& targetArea,
|
||||
const AffineTransform& transform,
|
||||
float alpha);
|
||||
|
||||
/** Renders an edge-table into the current context. */
|
||||
static void fillEdgeTable (const EdgeTable& edgeTable,
|
||||
float red, float green, float blue,
|
||||
const Point<int>& offset);
|
||||
float red, float green, float blue);
|
||||
|
||||
/** Checks whether the current context supports the specified extension. */
|
||||
static bool isExtensionSupported (const char* extensionName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue