|
| 1 | +From cb611a80bd5a36d31bfc31212ebbf79aa86c6f08 Mon Sep 17 00:00:00 2001 |
| 2 | +From: jikstra <jikstra@disroot.org> |
| 3 | +Date: Tue, 20 Aug 2019 03:00:51 +0200 |
| 4 | +Subject: [PATCH] Backport |
| 5 | + https://github.com/WeAreROLI/JUCE/commit/4e0adb2af8b424c43d22bd431011c9a6c57d36b6 |
| 6 | + to the bundled JUCE framework to make helm compile on gcc 9.1 again |
| 7 | + |
| 8 | +--- |
| 9 | + .../juce_graphics/colour/juce_PixelFormats.h | 25 +--------- |
| 10 | + .../native/juce_RenderingHelpers.h | 48 +------------------ |
| 11 | + 2 files changed, 4 insertions(+), 69 deletions(-) |
| 12 | + |
| 13 | +diff --git a/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h b/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h |
| 14 | +index 9be9ba09c..3535eab80 100644 |
| 15 | +--- a/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h |
| 16 | ++++ b/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h |
| 17 | +@@ -105,23 +105,9 @@ class JUCE_API PixelARGB |
| 18 | + |
| 19 | + //============================================================================== |
| 20 | + forcedinline uint8 getAlpha() const noexcept { return components.a; } |
| 21 | +- forcedinline uint8 getRed() const noexcept { return components.r; } |
| 22 | ++ forcedinline uint8 getRed() const noexcept { return components.r; } |
| 23 | + forcedinline uint8 getGreen() const noexcept { return components.g; } |
| 24 | +- forcedinline uint8 getBlue() const noexcept { return components.b; } |
| 25 | +- |
| 26 | +- #if JUCE_GCC |
| 27 | +- // NB these are here as a workaround because GCC refuses to bind to packed values. |
| 28 | +- forcedinline uint8& getAlpha() noexcept { return comps [indexA]; } |
| 29 | +- forcedinline uint8& getRed() noexcept { return comps [indexR]; } |
| 30 | +- forcedinline uint8& getGreen() noexcept { return comps [indexG]; } |
| 31 | +- forcedinline uint8& getBlue() noexcept { return comps [indexB]; } |
| 32 | +- #else |
| 33 | +- forcedinline uint8& getAlpha() noexcept { return components.a; } |
| 34 | +- forcedinline uint8& getRed() noexcept { return components.r; } |
| 35 | +- forcedinline uint8& getGreen() noexcept { return components.g; } |
| 36 | +- forcedinline uint8& getBlue() noexcept { return components.b; } |
| 37 | +- #endif |
| 38 | +- |
| 39 | ++ forcedinline uint8 getBlue() const noexcept { return components.b; } |
| 40 | + //============================================================================== |
| 41 | + /** Copies another pixel colour over this one. |
| 42 | + |
| 43 | +@@ -340,9 +326,6 @@ class JUCE_API PixelARGB |
| 44 | + { |
| 45 | + uint32 internal; |
| 46 | + Components components; |
| 47 | +- #if JUCE_GCC |
| 48 | +- uint8 comps[4]; // helper struct needed because gcc does not allow references to packed union members |
| 49 | +- #endif |
| 50 | + }; |
| 51 | + } |
| 52 | + #ifndef DOXYGEN |
| 53 | +@@ -429,10 +412,6 @@ class JUCE_API PixelRGB |
| 54 | + forcedinline uint8 getGreen() const noexcept { return g; } |
| 55 | + forcedinline uint8 getBlue() const noexcept { return b; } |
| 56 | + |
| 57 | +- forcedinline uint8& getRed() noexcept { return r; } |
| 58 | +- forcedinline uint8& getGreen() noexcept { return g; } |
| 59 | +- forcedinline uint8& getBlue() noexcept { return b; } |
| 60 | +- |
| 61 | + //============================================================================== |
| 62 | + /** Copies another pixel colour over this one. |
| 63 | + |
| 64 | +diff --git a/JUCE/modules/juce_graphics/native/juce_RenderingHelpers.h b/JUCE/modules/juce_graphics/native/juce_RenderingHelpers.h |
| 65 | +index 1c4cd31ef..29519cb5a 100644 |
| 66 | +--- a/JUCE/modules/juce_graphics/native/juce_RenderingHelpers.h |
| 67 | ++++ b/JUCE/modules/juce_graphics/native/juce_RenderingHelpers.h |
| 68 | +@@ -581,18 +581,10 @@ namespace EdgeTableFillers |
| 69 | + : destData (image), sourceColour (colour) |
| 70 | + { |
| 71 | + if (sizeof (PixelType) == 3 && destData.pixelStride == sizeof (PixelType)) |
| 72 | +- { |
| 73 | + areRGBComponentsEqual = sourceColour.getRed() == sourceColour.getGreen() |
| 74 | + && sourceColour.getGreen() == sourceColour.getBlue(); |
| 75 | +- filler[0].set (sourceColour); |
| 76 | +- filler[1].set (sourceColour); |
| 77 | +- filler[2].set (sourceColour); |
| 78 | +- filler[3].set (sourceColour); |
| 79 | +- } |
| 80 | + else |
| 81 | +- { |
| 82 | + areRGBComponentsEqual = false; |
| 83 | +- } |
| 84 | + } |
| 85 | + |
| 86 | + forcedinline void setEdgeTableYPos (const int y) noexcept |
| 87 | +@@ -643,7 +635,6 @@ namespace EdgeTableFillers |
| 88 | + const Image::BitmapData& destData; |
| 89 | + PixelType* linePixels; |
| 90 | + PixelARGB sourceColour; |
| 91 | +- PixelRGB filler [4]; |
| 92 | + bool areRGBComponentsEqual; |
| 93 | + |
| 94 | + forcedinline PixelType* getPixel (const int x) const noexcept |
| 95 | +@@ -658,43 +649,8 @@ namespace EdgeTableFillers |
| 96 | + |
| 97 | + forcedinline void replaceLine (PixelRGB* dest, const PixelARGB colour, int width) const noexcept |
| 98 | + { |
| 99 | +- if (destData.pixelStride == sizeof (*dest)) |
| 100 | +- { |
| 101 | +- if (areRGBComponentsEqual) // if all the component values are the same, we can cheat.. |
| 102 | +- { |
| 103 | +- memset (dest, colour.getRed(), (size_t) width * 3); |
| 104 | +- } |
| 105 | +- else |
| 106 | +- { |
| 107 | +- if (width >> 5) |
| 108 | +- { |
| 109 | +- const int* const intFiller = reinterpret_cast<const int*> (filler); |
| 110 | +- |
| 111 | +- while (width > 8 && (((pointer_sized_int) dest) & 7) != 0) |
| 112 | +- { |
| 113 | +- dest->set (colour); |
| 114 | +- ++dest; |
| 115 | +- --width; |
| 116 | +- } |
| 117 | +- |
| 118 | +- while (width > 4) |
| 119 | +- { |
| 120 | +- int* d = reinterpret_cast<int*> (dest); |
| 121 | +- *d++ = intFiller[0]; |
| 122 | +- *d++ = intFiller[1]; |
| 123 | +- *d++ = intFiller[2]; |
| 124 | +- dest = reinterpret_cast<PixelRGB*> (d); |
| 125 | +- width -= 4; |
| 126 | +- } |
| 127 | +- } |
| 128 | +- |
| 129 | +- while (--width >= 0) |
| 130 | +- { |
| 131 | +- dest->set (colour); |
| 132 | +- ++dest; |
| 133 | +- } |
| 134 | +- } |
| 135 | +- } |
| 136 | ++ if ((size_t) destData.pixelStride == sizeof (*dest) && areRGBComponentsEqual) |
| 137 | ++ memset ((void*) dest, colour.getRed(), (size_t) width * 3); // if all the component values are the same, we can cheat.. |
| 138 | + else |
| 139 | + { |
| 140 | + JUCE_PERFORM_PIXEL_OP_LOOP (set (colour)) |
0 commit comments