mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Windows: faster rendering on 32-bit video cards. Audio fix for iOS.
This commit is contained in:
parent
aab3a6a6eb
commit
96976db624
3 changed files with 17 additions and 29 deletions
|
|
@ -217,7 +217,7 @@ private:
|
|||
{
|
||||
OSStatus err = noErr;
|
||||
|
||||
if (audioInputIsAvailable)
|
||||
if (audioInputIsAvailable && numInputChannels > 0)
|
||||
err = AudioUnitRender (audioUnit, flags, time, 1, numFrames, data);
|
||||
|
||||
const ScopedLock sl (callbackLock);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace PrimesHelpers
|
|||
|
||||
i = (i - 1) >> 1;
|
||||
|
||||
while (i < numBits)
|
||||
while (i < (unsigned int) numBits)
|
||||
{
|
||||
result.setBit ((int) i);
|
||||
i += prime;
|
||||
|
|
|
|||
|
|
@ -281,8 +281,6 @@ public:
|
|||
const RectangleList& maskedRegion,
|
||||
const uint8 updateLayeredWindowAlpha) noexcept
|
||||
{
|
||||
static HDRAWDIB hdd = createDrawDIB();
|
||||
|
||||
SetMapMode (dc, MM_TEXT);
|
||||
|
||||
if (transparent)
|
||||
|
|
@ -327,20 +325,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (hdd == 0)
|
||||
{
|
||||
StretchDIBits (dc,
|
||||
x, y, width, height,
|
||||
0, 0, width, height,
|
||||
bitmapData, (const BITMAPINFO*) &bitmapInfo,
|
||||
DIB_RGB_COLORS, SRCCOPY);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawDibDraw (hdd, dc, x, y, -1, -1,
|
||||
(BITMAPINFOHEADER*) &bitmapInfo, bitmapData,
|
||||
0, 0, width, height, 0);
|
||||
}
|
||||
StretchDIBits (dc,
|
||||
x, y, width, height,
|
||||
0, 0, width, height,
|
||||
bitmapData, (const BITMAPINFO*) &bitmapInfo,
|
||||
DIB_RGB_COLORS, SRCCOPY);
|
||||
|
||||
if (! maskedRegion.isEmpty())
|
||||
RestoreDC (dc, savedDC);
|
||||
|
|
@ -357,16 +346,6 @@ public:
|
|||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WindowsBitmapImage);
|
||||
|
||||
static HDRAWDIB createDrawDIB() noexcept
|
||||
{
|
||||
HDC dc = GetDC (0);
|
||||
const int n = GetDeviceCaps (dc, BITSPIXEL);
|
||||
ReleaseDC (0, dc);
|
||||
|
||||
// only open if we're not palettised
|
||||
return n > 8 ? DrawDibOpen() : 0;
|
||||
}
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -1052,7 +1031,8 @@ private:
|
|||
|
||||
Image& getImage (const bool transparent, const int w, const int h)
|
||||
{
|
||||
const Image::PixelFormat format = transparent ? Image::ARGB : Image::RGB;
|
||||
static bool alwaysUseARGB = isGraphicsCard32Bit(); // NB: for 32-bit cards, it's faster to use a 32-bit image.
|
||||
const Image::PixelFormat format = (transparent || alwaysUseARGB) ? Image::ARGB : Image::RGB;
|
||||
|
||||
if ((! image.isValid()) || image.getWidth() < w || image.getHeight() < h || image.getFormat() != format)
|
||||
image = Image (new WindowsBitmapImage (format, (w + 31) & ~31, (h + 31) & ~31, false));
|
||||
|
|
@ -1070,6 +1050,14 @@ private:
|
|||
private:
|
||||
Image image;
|
||||
|
||||
static bool isGraphicsCard32Bit()
|
||||
{
|
||||
HDC dc = GetDC (0);
|
||||
const int bitsPerPixel = GetDeviceCaps (dc, BITSPIXEL);
|
||||
ReleaseDC (0, dc);
|
||||
return bitsPerPixel > 24;
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TemporaryImage);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue