1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-04 03:40:07 +00:00

Fix for Graphics::drawImage and small change to the parameters of Graphics::drawImageTransformed - if you were using subregions of images, note that this method now treats them slightly differently. Previously, the transform was relative to the origin of the image, but now it's relative to the origin of the subregion.

This commit is contained in:
Julian Storer 2009-12-03 12:14:21 +00:00
parent a8a602f7a2
commit 4c31b704ed
8 changed files with 69 additions and 79 deletions

View file

@ -1005,24 +1005,25 @@ public:
if (transform.isOnlyTranslation())
{
// If our translation doesn't involve any distortion, just use a simple blit..
const int tx = (int) (transform.getTranslationX() * 256.0f);
const int ty = (int) (transform.getTranslationY() * 256.0f);
int tx = (int) (transform.getTranslationX() * 256.0f);
int ty = (int) (transform.getTranslationY() * 256.0f);
if ((! betterQuality) || ((tx | ty) & 224) == 0)
{
const Rectangle srcRect (srcClip.translated ((tx + 128) >> 8, (ty + 128) >> 8));
tx = ((tx + 128) >> 8);
ty = ((ty + 128) >> 8);
if (tiledFillClipRegion != 0)
{
blittedRenderImage3 <true> (sourceImage, destImage, *tiledFillClipRegion, destData, srcData, alpha, srcRect.getX(), srcRect.getY());
blittedRenderImage3 <true> (sourceImage, destImage, *tiledFillClipRegion, destData, srcData, alpha, tx, ty);
}
else
{
EdgeTable et (srcRect.getIntersection (destImage.getBounds()));
EdgeTable et (Rectangle (tx, ty, srcClip.getWidth(), srcClip.getHeight()).getIntersection (destImage.getBounds()));
et.clipToEdgeTable (edgeTable->edgeTable);
if (! et.isEmpty())
blittedRenderImage3 <false> (sourceImage, destImage, et, destData, srcData, alpha, srcRect.getX(), srcRect.getY());
blittedRenderImage3 <false> (sourceImage, destImage, et, destData, srcData, alpha, tx, ty);
}
return;
@ -1039,7 +1040,7 @@ public:
else
{
Path p;
p.addRectangle (srcClip);
p.addRectangle (0.0f, 0.0f, (float) srcClip.getWidth(), (float) srcClip.getHeight());
EdgeTable et (edgeTable->edgeTable.getMaximumBounds(), p, transform);
et.clipToEdgeTable (edgeTable->edgeTable);