Browse Source

Added some colour component accessor methods to PixelARGB, PixelRGB. Tidied up some packing macros.

tags/2021-05-28
jules 13 years ago
parent
commit
b3556f720e
6 changed files with 38 additions and 44 deletions
  1. +2
    -9
      modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp
  2. +8
    -15
      modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp
  3. +2
    -1
      modules/juce_core/memory/juce_LeakedObjectDetector.h
  4. +7
    -0
      modules/juce_core/system/juce_PlatformDefs.h
  5. +18
    -16
      modules/juce_graphics/colour/juce_PixelFormats.h
  6. +1
    -3
      modules/juce_gui_basics/layout/juce_ScrollBar.h

+ 2
- 9
modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp View File

@@ -34,11 +34,6 @@ namespace AiffFileHelpers
#if JUCE_MSVC
#pragma pack (push, 1)
#define PACKED
#elif JUCE_GCC
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
//==============================================================================
@@ -49,7 +44,7 @@ namespace AiffFileHelpers
uint16 type; // these are different in AIFF and WAV
uint16 startIdentifier;
uint16 endIdentifier;
} PACKED;
} JUCE_PACKED;
int8 baseNote;
int8 detune;
@@ -106,14 +101,12 @@ namespace AiffFileHelpers
}
}
} PACKED;
} JUCE_PACKED;
#if JUCE_MSVC
#pragma pack (pop)
#endif
#undef PACKED
//==============================================================================
namespace MarkChunk
{


+ 8
- 15
modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp View File

@@ -64,11 +64,6 @@ namespace WavFileHelpers
#if JUCE_MSVC
#pragma pack (push, 1)
#define PACKED
#elif JUCE_GCC
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
struct BWAVChunk
@@ -137,7 +132,7 @@ namespace WavFileHelpers
return MemoryBlock();
}
} PACKED;
} JUCE_PACKED;
//==============================================================================
@@ -151,7 +146,7 @@ namespace WavFileHelpers
uint32 end;
uint32 fraction;
uint32 playCount;
} PACKED;
} JUCE_PACKED;
uint32 manufacturer;
uint32 product;
@@ -227,7 +222,7 @@ namespace WavFileHelpers
return data;
}
} PACKED;
} JUCE_PACKED;
//==============================================================================
struct InstChunk
@@ -272,7 +267,7 @@ namespace WavFileHelpers
return data;
}
} PACKED;
} JUCE_PACKED;
//==============================================================================
struct CueChunk
@@ -285,7 +280,7 @@ namespace WavFileHelpers
uint32 chunkStart;
uint32 blockStart;
uint32 offset;
} PACKED;
} JUCE_PACKED;
uint32 numCues;
Cue cues[1];
@@ -354,7 +349,7 @@ namespace WavFileHelpers
}
}
} PACKED;
} JUCE_PACKED;
//==============================================================================
namespace ListChunk
@@ -427,7 +422,7 @@ namespace WavFileHelpers
uint16 data2;
uint16 data3;
uint8 data4[8];
} PACKED;
} JUCE_PACKED;
struct DataSize64Chunk // chunk ID = 'ds64' if data size > 0xffffffff, 'JUNK' otherwise
{
@@ -438,14 +433,12 @@ namespace WavFileHelpers
uint32 sampleCountLow; // low 4 byte sample count of fact chunk
uint32 sampleCountHigh; // high 4 byte sample count of fact chunk
uint32 tableLength; // number of valid entries in array 'table'
} PACKED;
} JUCE_PACKED;
#if JUCE_MSVC
#pragma pack (pop)
#endif
#undef PACKED
}
//==============================================================================


+ 2
- 1
modules/juce_core/memory/juce_LeakedObjectDetector.h View File

@@ -128,7 +128,8 @@ private:
private:
JUCE_LEAK_DETECTOR (MyClass);
};@endcode
};
@endcode
@see JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, LeakedObjectDetector
*/


+ 7
- 0
modules/juce_core/system/juce_PlatformDefs.h View File

@@ -278,6 +278,13 @@ namespace juce
#define JUCE_MODAL_LOOPS_PERMITTED 1
#endif
//==============================================================================
#if JUCE_GCC
#define JUCE_PACKED __attribute__((packed))
#elif ! DOXYGEN
#define JUCE_PACKED
#endif
//==============================================================================
// Here, we'll check for C++11 compiler support, and if it's not available, define
// a few workarounds, so that we can still use some of the newer language features.


+ 18
- 16
modules/juce_graphics/colour/juce_PixelFormats.h View File

@@ -28,15 +28,8 @@
//==============================================================================
#ifndef DOXYGEN
#if JUCE_MSVC
#pragma pack (push, 1)
#define PACKED
#elif JUCE_GCC
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
#if JUCE_MSVC
#pragma pack (push, 1)
#endif
class PixelRGB;
@@ -84,6 +77,11 @@ public:
forcedinline uint8 getGreen() const noexcept { return components.g; }
forcedinline uint8 getBlue() const noexcept { return components.b; }
forcedinline uint8& getAlpha() noexcept { return components.a; }
forcedinline uint8& getRed() noexcept { return components.r; }
forcedinline uint8& getGreen() noexcept { return components.g; }
forcedinline uint8& getBlue() noexcept { return components.b; }
/** Blends another pixel onto this one.
This takes into account the opacity of the pixel being overlaid, and blends
@@ -275,7 +273,7 @@ private:
#else
uint8 b, g, r, a;
#endif
} PACKED;
} JUCE_PACKED;
union
{
@@ -284,7 +282,7 @@ private:
};
}
#ifndef DOXYGEN
PACKED
JUCE_PACKED
#endif
;
@@ -326,6 +324,10 @@ public:
forcedinline uint8 getGreen() const noexcept { return g; }
forcedinline uint8 getBlue() const noexcept { return b; }
forcedinline uint8& getRed() noexcept { return r; }
forcedinline uint8& getGreen() noexcept { return g; }
forcedinline uint8& getBlue() noexcept { return b; }
/** Blends another pixel onto this one.
This takes into account the opacity of the pixel being overlaid, and blends
@@ -450,7 +452,7 @@ private:
}
#ifndef DOXYGEN
PACKED
JUCE_PACKED
#endif
;
@@ -490,6 +492,8 @@ public:
forcedinline uint32 getAG() const noexcept { return (((uint32) a) << 16) | a; }
forcedinline uint8 getAlpha() const noexcept { return a; }
forcedinline uint8& getAlpha() noexcept { return a; }
forcedinline uint8 getRed() const noexcept { return 0; }
forcedinline uint8 getGreen() const noexcept { return 0; }
forcedinline uint8 getBlue() const noexcept { return 0; }
@@ -576,10 +580,10 @@ public:
private:
//==============================================================================
uint8 a : 8;
uint8 a;
}
#ifndef DOXYGEN
PACKED
JUCE_PACKED
#endif
;
@@ -587,6 +591,4 @@ private:
#pragma pack (pop)
#endif
#undef PACKED
#endif // __JUCE_PIXELFORMATS_JUCEHEADER__

+ 1
- 3
modules/juce_gui_basics/layout/juce_ScrollBar.h View File

@@ -56,9 +56,7 @@ class JUCE_API ScrollBar : public Component,
public:
//==============================================================================
/** Creates a Scrollbar.
@param isVertical whether it should be a vertical or horizontal bar
@param buttonsAreVisible whether to show the up/down or left/right buttons
@param isVertical specifies whether the bar should be a vertical or horizontal
*/
ScrollBar (bool isVertical);


Loading…
Cancel
Save