|
|
@@ -446,8 +446,9 @@ public: |
|
|
|
|
|
|
|
void setMatrix (const AffineTransform& trans,
|
|
|
|
const int imageWidth, const int imageHeight,
|
|
|
|
const float fullWidthProportion, const float fullHeightProportion,
|
|
|
|
const float targetX, const float targetY) const
|
|
|
|
float fullWidthProportion, float fullHeightProportion,
|
|
|
|
const float targetX, const float targetY,
|
|
|
|
const bool isForTiling) const
|
|
|
|
{
|
|
|
|
const AffineTransform t (trans.translated (-targetX, -targetY)
|
|
|
|
.inverted().scaled (fullWidthProportion / imageWidth,
|
|
|
@@ -456,16 +457,23 @@ public: |
|
|
|
const GLfloat m[] = { t.mat00, t.mat01, t.mat02, t.mat10, t.mat11, t.mat12 };
|
|
|
|
matrix.set (m, 6);
|
|
|
|
|
|
|
|
if (isForTiling)
|
|
|
|
{
|
|
|
|
fullWidthProportion -= 0.5f / imageWidth;
|
|
|
|
fullHeightProportion -= 0.5f / imageHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
imageLimits.set (fullWidthProportion, fullHeightProportion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void setMatrix (const AffineTransform& trans, const OpenGLTextureFromImage& im,
|
|
|
|
const float targetX, const float targetY) const
|
|
|
|
const float targetX, const float targetY,
|
|
|
|
bool isForTiling) const
|
|
|
|
{
|
|
|
|
setMatrix (trans,
|
|
|
|
im.imageWidth, im.imageHeight,
|
|
|
|
im.fullWidthProportion, im.fullHeightProportion,
|
|
|
|
targetX, targetY);
|
|
|
|
targetX, targetY, isForTiling);
|
|
|
|
}
|
|
|
|
|
|
|
|
OpenGLShaderProgram::Uniform imageTexture, matrix, imageLimits;
|
|
|
@@ -1248,7 +1256,7 @@ public: |
|
|
|
}
|
|
|
|
|
|
|
|
void setShaderForTiledImageFill (const OpenGLTextureFromImage& image, const AffineTransform& transform,
|
|
|
|
const int maskTextureID, const Rectangle<int>* const maskArea, const bool clampTiledImages)
|
|
|
|
const int maskTextureID, const Rectangle<int>* const maskArea, bool isTiledFill)
|
|
|
|
{
|
|
|
|
blendMode.setPremultipliedBlendingMode (shaderQuadQueue);
|
|
|
|
|
|
|
@@ -1261,37 +1269,37 @@ public: |
|
|
|
{
|
|
|
|
activeTextures.setTwoTextureMode (shaderQuadQueue, image.textureID, (GLuint) maskTextureID);
|
|
|
|
|
|
|
|
if (clampTiledImages)
|
|
|
|
{
|
|
|
|
setShader (programs->imageMasked);
|
|
|
|
imageParams = &programs->imageMasked.imageParams;
|
|
|
|
maskParams = &programs->imageMasked.maskParams;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (isTiledFill)
|
|
|
|
{
|
|
|
|
setShader (programs->tiledImageMasked);
|
|
|
|
imageParams = &programs->tiledImageMasked.imageParams;
|
|
|
|
maskParams = &programs->tiledImageMasked.maskParams;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setShader (programs->imageMasked);
|
|
|
|
imageParams = &programs->imageMasked.imageParams;
|
|
|
|
maskParams = &programs->imageMasked.maskParams;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
activeTextures.setSingleTextureMode (shaderQuadQueue);
|
|
|
|
activeTextures.bindTexture (image.textureID);
|
|
|
|
|
|
|
|
if (clampTiledImages)
|
|
|
|
if (isTiledFill)
|
|
|
|
{
|
|
|
|
setShader (programs->image);
|
|
|
|
imageParams = &programs->image.imageParams;
|
|
|
|
setShader (programs->tiledImage);
|
|
|
|
imageParams = &programs->tiledImage.imageParams;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setShader (programs->tiledImage);
|
|
|
|
imageParams = &programs->tiledImage.imageParams;
|
|
|
|
setShader (programs->image);
|
|
|
|
imageParams = &programs->image.imageParams;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
imageParams->setMatrix (transform, image, (float) target.bounds.getX(), (float) target.bounds.getY());
|
|
|
|
imageParams->setMatrix (transform, image, (float) target.bounds.getX(), (float) target.bounds.getY(), isTiledFill);
|
|
|
|
|
|
|
|
if (maskParams != nullptr)
|
|
|
|
maskParams->setBounds (*maskArea, target, 1);
|
|
|
@@ -1425,7 +1433,7 @@ public: |
|
|
|
{
|
|
|
|
state->shaderQuadQueue.flush();
|
|
|
|
OpenGLTextureFromImage image (src);
|
|
|
|
state->setShaderForTiledImageFill (image, trans, 0, nullptr, ! tiledFill);
|
|
|
|
state->setShaderForTiledImageFill (image, trans, 0, nullptr, tiledFill);
|
|
|
|
|
|
|
|
state->shaderQuadQueue.add (iter, PixelARGB ((uint8) alpha, (uint8) alpha, (uint8) alpha, (uint8) alpha));
|
|
|
|
state->shaderQuadQueue.flush();
|
|
|
|