Browse Source

Windows: faster rendering on 32-bit video cards. Audio fix for iOS.

tags/2021-05-28
jules 13 years ago
parent
commit
96976db624
3 changed files with 17 additions and 29 deletions
  1. +1
    -1
      modules/juce_audio_devices/native/juce_ios_Audio.cpp
  2. +1
    -1
      modules/juce_cryptography/encryption/juce_Primes.cpp
  3. +15
    -27
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp

+ 1
- 1
modules/juce_audio_devices/native/juce_ios_Audio.cpp View File

@@ -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);


+ 1
- 1
modules/juce_cryptography/encryption/juce_Primes.cpp View File

@@ -71,7 +71,7 @@ namespace PrimesHelpers
i = (i - 1) >> 1;
while (i < numBits)
while (i < (unsigned int) numBits)
{
result.setBit ((int) i);
i += prime;


+ 15
- 27
modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -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…
Cancel
Save