Browse Source

Fixed a couple of tiny inaccuracies in the graphics code.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
9a39433405
6 changed files with 9 additions and 5 deletions
  1. +3
    -1
      juce_amalgamated.cpp
  2. +1
    -1
      src/gui/graphics/contexts/juce_EdgeTable.cpp
  3. +1
    -1
      src/gui/graphics/contexts/juce_Graphics.h
  4. +2
    -0
      src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp
  5. +1
    -1
      src/threads/juce_ThreadPool.cpp
  6. +1
    -1
      src/threads/juce_ThreadPool.h

+ 3
- 1
juce_amalgamated.cpp View File

@@ -78650,7 +78650,7 @@ EdgeTable::EdgeTable (const Rectangle& bounds_,
do do
{ {
const int step = jmin (stepSize, y2 - y1, 256 - (y1 & 255)); const int step = jmin (stepSize, y2 - y1, 256 - (y1 & 255));
int x = roundDoubleToInt (startX + multiplier * (y1 - startY));
int x = roundDoubleToInt (startX + multiplier * ((y1 + (step >> 1)) - startY));


if (x < leftLimit) if (x < leftLimit)
x = leftLimit; x = leftLimit;
@@ -81509,6 +81509,8 @@ public:


ColourGradient g2 (*(fillType.gradient)); ColourGradient g2 (*(fillType.gradient));
g2.multiplyOpacity (fillType.getOpacity()); g2.multiplyOpacity (fillType.getOpacity());
g2.x1 -= 0.5f; g2.y1 -= 0.5f;
g2.x2 -= 0.5f; g2.y2 -= 0.5f;
AffineTransform transform (fillType.transform.translated ((float) xOffset, (float) yOffset)); AffineTransform transform (fillType.transform.translated ((float) xOffset, (float) yOffset));
const bool isIdentity = transform.isOnlyTranslation(); const bool isIdentity = transform.isOnlyTranslation();




+ 1
- 1
src/gui/graphics/contexts/juce_EdgeTable.cpp View File

@@ -101,7 +101,7 @@ EdgeTable::EdgeTable (const Rectangle& bounds_,
do do
{ {
const int step = jmin (stepSize, y2 - y1, 256 - (y1 & 255)); const int step = jmin (stepSize, y2 - y1, 256 - (y1 & 255));
int x = roundDoubleToInt (startX + multiplier * (y1 - startY));
int x = roundDoubleToInt (startX + multiplier * ((y1 + (step >> 1)) - startY));
if (x < leftLimit) if (x < leftLimit)
x = leftLimit; x = leftLimit;


+ 1
- 1
src/gui/graphics/contexts/juce_Graphics.h View File

@@ -563,7 +563,7 @@ public:
will be treated as relative to the origin of this sub-region. So, for example if will be treated as relative to the origin of this sub-region. So, for example if
your subregion is (50, 50, 100, 100), and your transform is a translation of (20, 20), your subregion is (50, 50, 100, 100), and your transform is a translation of (20, 20),
the resulting pixel drawn at (20, 20) in the destination context is from (50, 50) in the resulting pixel drawn at (20, 20) in the destination context is from (50, 50) in
your image. If you want to use the whole image, then Image::getBounds() returns a
your image. If you want to use the whole image, then Image::getBounds() returns a
suitable rectangle to use as the imageSubRegion parameter. suitable rectangle to use as the imageSubRegion parameter.
Images are composited using the context's current opacity, so if you Images are composited using the context's current opacity, so if you


+ 2
- 0
src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp View File

@@ -950,6 +950,8 @@ public:
ColourGradient g2 (*(fillType.gradient)); ColourGradient g2 (*(fillType.gradient));
g2.multiplyOpacity (fillType.getOpacity()); g2.multiplyOpacity (fillType.getOpacity());
g2.x1 -= 0.5f; g2.y1 -= 0.5f;
g2.x2 -= 0.5f; g2.y2 -= 0.5f;
AffineTransform transform (fillType.transform.translated ((float) xOffset, (float) yOffset)); AffineTransform transform (fillType.transform.translated ((float) xOffset, (float) yOffset));
const bool isIdentity = transform.isOnlyTranslation(); const bool isIdentity = transform.isOnlyTranslation();


+ 1
- 1
src/threads/juce_ThreadPool.cpp View File

@@ -268,7 +268,7 @@ bool ThreadPool::removeAllJobs (const bool interruptRunningJobs,
for (int i = jobs.size(); --i >= 0;) for (int i = jobs.size(); --i >= 0;)
{ {
ThreadPoolJob* const job = (ThreadPoolJob*) jobs.getUnchecked(i); ThreadPoolJob* const job = (ThreadPoolJob*) jobs.getUnchecked(i);
if (selectedJobsToRemove == 0 || selectedJobsToRemove->isJobSuitable (job)) if (selectedJobsToRemove == 0 || selectedJobsToRemove->isJobSuitable (job))
{ {
if (job->isActive) if (job->isActive)


+ 1
- 1
src/threads/juce_ThreadPool.h View File

@@ -190,7 +190,7 @@ public:
/** Should return true if the specified thread matches your criteria for whatever /** Should return true if the specified thread matches your criteria for whatever
operation that this object is being used for. operation that this object is being used for.
Any implementation of this method must be extremely fast and thread-safe! Any implementation of this method must be extremely fast and thread-safe!
*/ */
virtual bool isJobSuitable (ThreadPoolJob* job) = 0; virtual bool isJobSuitable (ThreadPoolJob* job) = 0;


Loading…
Cancel
Save