| @@ -497,10 +497,6 @@ | |||||
| #if JUCE_MSVC | #if JUCE_MSVC | ||||
| #pragma warning (push) | #pragma warning (push) | ||||
| #pragma warning (disable : 4100 4201 4514 4312 4995) | #pragma warning (disable : 4100 4201 4514 4312 4995) | ||||
| #ifdef __INTEL_COMPILER | |||||
| #pragma warning (disable: 1125) | |||||
| #endif | |||||
| #endif | #endif | ||||
| #define _WIN32_WINNT 0x0500 | #define _WIN32_WINNT 0x0500 | ||||
| @@ -529,6 +525,7 @@ | |||||
| #include <Exdisp.h> | #include <Exdisp.h> | ||||
| #include <exdispid.h> | #include <exdispid.h> | ||||
| #include <shlobj.h> | #include <shlobj.h> | ||||
| #include <shlwapi.h> | |||||
| #if ! JUCE_MINGW | #if ! JUCE_MINGW | ||||
| #include <crtdbg.h> | #include <crtdbg.h> | ||||
| @@ -4413,6 +4410,11 @@ bool var::equals (const var& other) const throw() | |||||
| return type->equals (value, other.value, *other.type); | return type->equals (value, other.value, *other.type); | ||||
| } | } | ||||
| bool var::equalsWithSameType (const var& other) const throw() | |||||
| { | |||||
| return type == other.type && equals (other); | |||||
| } | |||||
| bool operator== (const var& v1, const var& v2) throw() { return v1.equals (v2); } | bool operator== (const var& v1, const var& v2) throw() { return v1.equals (v2); } | ||||
| bool operator!= (const var& v1, const var& v2) throw() { return ! v1.equals (v2); } | bool operator!= (const var& v1, const var& v2) throw() { return ! v1.equals (v2); } | ||||
| bool operator== (const var& v1, const String& v2) throw() { return v1.toString() == v2; } | bool operator== (const var& v1, const String& v2) throw() { return v1.toString() == v2; } | ||||
| @@ -13770,21 +13772,20 @@ int64 String::getHexValue64() const throw() | |||||
| const String String::createStringFromData (const void* const data_, const int size) | const String String::createStringFromData (const void* const data_, const int size) | ||||
| { | { | ||||
| const char* const data = static_cast <const char*> (data_); | |||||
| const uint8* const data = static_cast <const uint8*> (data_); | |||||
| if (size <= 0 || data == 0) | if (size <= 0 || data == 0) | ||||
| { | { | ||||
| return empty; | return empty; | ||||
| } | } | ||||
| else if (size < 2) | |||||
| else if (size == 1) | |||||
| { | { | ||||
| return charToString (data[0]); | |||||
| return charToString ((char) data[0]); | |||||
| } | } | ||||
| else if ((data[0] == (char)-2 && data[1] == (char)-1) | |||||
| || (data[0] == (char)-1 && data[1] == (char)-2)) | |||||
| else if ((data[0] == (uint8) 0xfe && data[1] == (uint8) 0xff) // UTF-16 BOM | |||||
| || (data[0] == (uint8) 0xff && data[1] == (uint8) 0xfe)) | |||||
| { | { | ||||
| // assume it's 16-bit unicode | |||||
| const bool bigEndian = (data[0] == (char)-2); | |||||
| const bool bigEndian = (data[0] == (uint8) 0xfe); | |||||
| const int numChars = size / 2 - 1; | const int numChars = size / 2 - 1; | ||||
| String result; | String result; | ||||
| @@ -13809,7 +13810,10 @@ const String String::createStringFromData (const void* const data_, const int si | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| return String::fromUTF8 (data, size); | |||||
| if (size >= 3 && data[0] == (uint8) 0xef && data[1] == (uint8) 0xbb && data[2] == (uint8) 0xbf) // UTF-8 BOM | |||||
| return String::fromUTF8 ((const char*) data + 3, size - 3); | |||||
| return String::fromUTF8 ((const char*) data, size); | |||||
| } | } | ||||
| } | } | ||||
| @@ -13857,17 +13861,7 @@ int String::copyToUTF8 (char* const buffer, const int maxBufferSizeBytes) const | |||||
| ++numExtraBytes; | ++numExtraBytes; | ||||
| if (c >= 0x10000) | if (c >= 0x10000) | ||||
| { | |||||
| ++numExtraBytes; | ++numExtraBytes; | ||||
| if (c >= 0x200000) | |||||
| { | |||||
| ++numExtraBytes; | |||||
| if (c >= 0x4000000) | |||||
| ++numExtraBytes; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| if (buffer != 0) | if (buffer != 0) | ||||
| @@ -13929,15 +13923,7 @@ int String::getNumBytesAsUTF8() const throw() | |||||
| { | { | ||||
| ++num; | ++num; | ||||
| if (c >= 0x10000) | if (c >= 0x10000) | ||||
| { | |||||
| ++num; | ++num; | ||||
| if (c >= 0x200000) | |||||
| { | |||||
| ++num; | |||||
| if (c >= 0x4000000) | |||||
| ++num; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| else if (c == 0) | else if (c == 0) | ||||
| @@ -13991,7 +13977,10 @@ const String String::fromUTF8 (const char* const buffer, int bufferSizeBytes) | |||||
| const char nextByte = buffer[i]; | const char nextByte = buffer[i]; | ||||
| if ((nextByte & 0xc0) != 0x80) | if ((nextByte & 0xc0) != 0x80) | ||||
| { | |||||
| n = c; // reset to original value if the input is invalid. | |||||
| break; | break; | ||||
| } | |||||
| n <<= 6; | n <<= 6; | ||||
| n |= (nextByte & 0x3f); | n |= (nextByte & 0x3f); | ||||
| @@ -14331,7 +14320,7 @@ public: | |||||
| zerostruct (wideBuffer); | zerostruct (wideBuffer); | ||||
| for (int i = 0; i < numElementsInArray (wideBuffer) - 1; ++i) | for (int i = 0; i < numElementsInArray (wideBuffer) - 1; ++i) | ||||
| wideBuffer[i] = (juce_wchar) (1 + Random::getSystemRandom().nextInt (std::numeric_limits<juce_wchar>::max() - 1)); | |||||
| wideBuffer[i] = (juce_wchar) (1 + Random::getSystemRandom().nextInt (0x10ffff - 1)); | |||||
| String wide (wideBuffer); | String wide (wideBuffer); | ||||
| expect (wide == (const juce_wchar*) wideBuffer); | expect (wide == (const juce_wchar*) wideBuffer); | ||||
| @@ -18817,10 +18806,6 @@ public: | |||||
| { | { | ||||
| } | } | ||||
| ~SimpleValueSource() | |||||
| { | |||||
| } | |||||
| const var getValue() const | const var getValue() const | ||||
| { | { | ||||
| return value; | return value; | ||||
| @@ -18828,7 +18813,7 @@ public: | |||||
| void setValue (const var& newValue) | void setValue (const var& newValue) | ||||
| { | { | ||||
| if (newValue != value) | |||||
| if (! newValue.equalsWithSameType (value)) | |||||
| { | { | ||||
| value = newValue; | value = newValue; | ||||
| sendChangeMessage (false); | sendChangeMessage (false); | ||||
| @@ -24289,7 +24274,8 @@ AudioTransportSource::~AudioTransportSource() | |||||
| void AudioTransportSource::setSource (PositionableAudioSource* const newSource, | void AudioTransportSource::setSource (PositionableAudioSource* const newSource, | ||||
| int readAheadBufferSize_, | int readAheadBufferSize_, | ||||
| double sourceSampleRateToCorrectFor) | |||||
| double sourceSampleRateToCorrectFor, | |||||
| int maxNumChannels) | |||||
| { | { | ||||
| if (source == newSource) | if (source == newSource) | ||||
| { | { | ||||
| @@ -24323,7 +24309,7 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource, | |||||
| if (sourceSampleRateToCorrectFor != 0) | if (sourceSampleRateToCorrectFor != 0) | ||||
| newMasterSource = newResamplerSource | newMasterSource = newResamplerSource | ||||
| = new ResamplingAudioSource (newPositionableSource, false); | |||||
| = new ResamplingAudioSource (newPositionableSource, false, maxNumChannels); | |||||
| else | else | ||||
| newMasterSource = newPositionableSource; | newMasterSource = newPositionableSource; | ||||
| @@ -47834,6 +47820,12 @@ void ComboBox::setItemEnabled (const int itemId, const bool shouldBeEnabled) | |||||
| item->isEnabled = shouldBeEnabled; | item->isEnabled = shouldBeEnabled; | ||||
| } | } | ||||
| bool ComboBox::isItemEnabled (int itemId) const throw() | |||||
| { | |||||
| const ItemInfo* const item = getItemForId (itemId); | |||||
| return item != 0 && item->isEnabled; | |||||
| } | |||||
| void ComboBox::changeItemText (const int itemId, const String& newText) | void ComboBox::changeItemText (const int itemId, const String& newText) | ||||
| { | { | ||||
| ItemInfo* const item = getItemForId (itemId); | ItemInfo* const item = getItemForId (itemId); | ||||
| @@ -238605,8 +238597,12 @@ namespace WindowsFileHelpers | |||||
| const String getDriveFromPath (const String& path) | const String getDriveFromPath (const String& path) | ||||
| { | { | ||||
| if (path.isNotEmpty() && path[1] == ':') | |||||
| return path.substring (0, 2) + '\\'; | |||||
| const int length = path.length(); | |||||
| HeapBlock <WCHAR> stringCopy (length + 1); | |||||
| path.copyToUnicode (stringCopy, length); | |||||
| if (PathStripToRoot (stringCopy)) | |||||
| return String (stringCopy); | |||||
| return path; | return path; | ||||
| } | } | ||||
| @@ -240725,11 +240721,13 @@ class SharedD2DFactory : public DeletedAtShutdown | |||||
| public: | public: | ||||
| SharedD2DFactory() | SharedD2DFactory() | ||||
| { | { | ||||
| D2D1CreateFactory (D2D1_FACTORY_TYPE_SINGLE_THREADED, &d2dFactory); | |||||
| DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory), (IUnknown**) &directWriteFactory); | |||||
| jassertfalse; //xxx Direct2D support isn't ready for use yet! | |||||
| D2D1CreateFactory (D2D1_FACTORY_TYPE_SINGLE_THREADED, d2dFactory.resetAndGetPointerAddress()); | |||||
| DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory), (IUnknown**) directWriteFactory.resetAndGetPointerAddress()); | |||||
| if (directWriteFactory != 0) | if (directWriteFactory != 0) | ||||
| directWriteFactory->GetSystemFontCollection (&systemFonts); | |||||
| directWriteFactory->GetSystemFontCollection (systemFonts.resetAndGetPointerAddress()); | |||||
| } | } | ||||
| ~SharedD2DFactory() | ~SharedD2DFactory() | ||||
| @@ -240761,10 +240759,10 @@ public: | |||||
| D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties(); | D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties(); | ||||
| D2D1_HWND_RENDER_TARGET_PROPERTIES propsHwnd = D2D1::HwndRenderTargetProperties (hwnd, size); | D2D1_HWND_RENDER_TARGET_PROPERTIES propsHwnd = D2D1::HwndRenderTargetProperties (hwnd, size); | ||||
| HRESULT hr = SharedD2DFactory::getInstance()->d2dFactory->CreateHwndRenderTarget (props, propsHwnd, &renderingTarget); | |||||
| HRESULT hr = SharedD2DFactory::getInstance()->d2dFactory->CreateHwndRenderTarget (props, propsHwnd, renderingTarget.resetAndGetPointerAddress()); | |||||
| // xxx check for error | // xxx check for error | ||||
| hr = renderingTarget->CreateSolidColorBrush (D2D1::ColorF::ColorF (0.0f, 0.0f, 0.0f, 1.0f), &colourBrush); | |||||
| hr = renderingTarget->CreateSolidColorBrush (D2D1::ColorF::ColorF (0.0f, 0.0f, 0.0f, 1.0f), colourBrush.resetAndGetPointerAddress()); | |||||
| } | } | ||||
| ~Direct2DLowLevelGraphicsContext() | ~Direct2DLowLevelGraphicsContext() | ||||
| @@ -240921,7 +240919,7 @@ public: | |||||
| const int x = currentState->origin.getX(); | const int x = currentState->origin.getX(); | ||||
| const int y = currentState->origin.getY(); | const int y = currentState->origin.getY(); | ||||
| renderingTarget->SetTransform (transfromToMatrix (transform) * D2D1::Matrix3x2F::Translation (x, y)); | |||||
| renderingTarget->SetTransform (transformToMatrix (transform) * D2D1::Matrix3x2F::Translation (x, y)); | |||||
| D2D1_SIZE_U size; | D2D1_SIZE_U size; | ||||
| size.width = image.getWidth(); | size.width = image.getWidth(); | ||||
| @@ -240936,7 +240934,7 @@ public: | |||||
| { | { | ||||
| ComSmartPtr <ID2D1Bitmap> tempBitmap; | ComSmartPtr <ID2D1Bitmap> tempBitmap; | ||||
| renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, &tempBitmap); | |||||
| renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, tempBitmap.resetAndGetPointerAddress()); | |||||
| if (tempBitmap != 0) | if (tempBitmap != 0) | ||||
| renderingTarget->DrawBitmap (tempBitmap); | renderingTarget->DrawBitmap (tempBitmap); | ||||
| } | } | ||||
| @@ -241004,7 +241002,7 @@ public: | |||||
| float kerning = currentState->font.getExtraKerningFactor(); // xxx why does removing this line mess up the kerning?? | float kerning = currentState->font.getExtraKerningFactor(); // xxx why does removing this line mess up the kerning?? | ||||
| float hScale = currentState->font.getHorizontalScale(); | float hScale = currentState->font.getHorizontalScale(); | ||||
| renderingTarget->SetTransform (D2D1::Matrix3x2F::Scale (hScale, 1) * transfromToMatrix (transform) * D2D1::Matrix3x2F::Translation (x, y)); | |||||
| renderingTarget->SetTransform (D2D1::Matrix3x2F::Scale (hScale, 1) * transformToMatrix (transform) * D2D1::Matrix3x2F::Translation (x, y)); | |||||
| float dpiX = 0, dpiY = 0; | float dpiX = 0, dpiY = 0; | ||||
| SharedD2DFactory::getInstance()->d2dFactory->GetDesktopDpi (&dpiX, &dpiY); | SharedD2DFactory::getInstance()->d2dFactory->GetDesktopDpi (&dpiX, &dpiY); | ||||
| @@ -241103,7 +241101,7 @@ public: | |||||
| clearPathClip(); | clearPathClip(); | ||||
| if (complexClipLayer == 0) | if (complexClipLayer == 0) | ||||
| owner.renderingTarget->CreateLayer (&complexClipLayer); | |||||
| owner.renderingTarget->CreateLayer (complexClipLayer.resetAndGetPointerAddress()); | |||||
| complexClipGeometry = geometry; | complexClipGeometry = geometry; | ||||
| shouldClipComplex = true; | shouldClipComplex = true; | ||||
| @@ -241126,7 +241124,7 @@ public: | |||||
| clearRectListClip(); | clearRectListClip(); | ||||
| if (rectListLayer == 0) | if (rectListLayer == 0) | ||||
| owner.renderingTarget->CreateLayer (&rectListLayer); | |||||
| owner.renderingTarget->CreateLayer (rectListLayer.resetAndGetPointerAddress()); | |||||
| rectListGeometry = geometry; | rectListGeometry = geometry; | ||||
| shouldClipRectList = true; | shouldClipRectList = true; | ||||
| @@ -241150,11 +241148,11 @@ public: | |||||
| clearImageClip(); | clearImageClip(); | ||||
| if (bitmapMaskLayer == 0) | if (bitmapMaskLayer == 0) | ||||
| owner.renderingTarget->CreateLayer (&bitmapMaskLayer); | |||||
| owner.renderingTarget->CreateLayer (bitmapMaskLayer.resetAndGetPointerAddress()); | |||||
| D2D1_BRUSH_PROPERTIES brushProps; | D2D1_BRUSH_PROPERTIES brushProps; | ||||
| brushProps.opacity = 1; | brushProps.opacity = 1; | ||||
| brushProps.transform = transfromToMatrix (transform); | |||||
| brushProps.transform = transformToMatrix (transform); | |||||
| D2D1_BITMAP_BRUSH_PROPERTIES bmProps = D2D1::BitmapBrushProperties (D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_WRAP); | D2D1_BITMAP_BRUSH_PROPERTIES bmProps = D2D1::BitmapBrushProperties (D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_WRAP); | ||||
| @@ -241169,8 +241167,8 @@ public: | |||||
| bp.pixelFormat = owner.renderingTarget->GetPixelFormat(); | bp.pixelFormat = owner.renderingTarget->GetPixelFormat(); | ||||
| bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; | bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; | ||||
| HRESULT hr = owner.renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, &maskBitmap); | |||||
| hr = owner.renderingTarget->CreateBitmapBrush (maskBitmap, bmProps, brushProps, &bitmapMaskBrush); | |||||
| HRESULT hr = owner.renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, maskBitmap.resetAndGetPointerAddress()); | |||||
| hr = owner.renderingTarget->CreateBitmapBrush (maskBitmap, bmProps, brushProps, bitmapMaskBrush.resetAndGetPointerAddress()); | |||||
| imageMaskLayerParams = D2D1::LayerParameters(); | imageMaskLayerParams = D2D1::LayerParameters(); | ||||
| imageMaskLayerParams.opacityBrush = bitmapMaskBrush; | imageMaskLayerParams.opacityBrush = bitmapMaskBrush; | ||||
| @@ -241284,14 +241282,14 @@ public: | |||||
| fontIndex = 0; | fontIndex = 0; | ||||
| ComSmartPtr <IDWriteFontFamily> fontFam; | ComSmartPtr <IDWriteFontFamily> fontFam; | ||||
| fonts->GetFontFamily (fontIndex, &fontFam); | |||||
| fonts->GetFontFamily (fontIndex, fontFam.resetAndGetPointerAddress()); | |||||
| ComSmartPtr <IDWriteFont> font; | ComSmartPtr <IDWriteFont> font; | ||||
| DWRITE_FONT_WEIGHT weight = this->font.isBold() ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL; | DWRITE_FONT_WEIGHT weight = this->font.isBold() ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL; | ||||
| DWRITE_FONT_STYLE style = this->font.isItalic() ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; | DWRITE_FONT_STYLE style = this->font.isItalic() ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; | ||||
| fontFam->GetFirstMatchingFont (weight, DWRITE_FONT_STRETCH_NORMAL, style, &font); | |||||
| fontFam->GetFirstMatchingFont (weight, DWRITE_FONT_STRETCH_NORMAL, style, font.resetAndGetPointerAddress()); | |||||
| font->CreateFontFace (&localFontFace); | |||||
| font->CreateFontFace (localFontFace.resetAndGetPointerAddress()); | |||||
| currentFontFace = localFontFace; | currentFontFace = localFontFace; | ||||
| } | } | ||||
| } | } | ||||
| @@ -241331,7 +241329,7 @@ public: | |||||
| { | { | ||||
| D2D1_BRUSH_PROPERTIES brushProps; | D2D1_BRUSH_PROPERTIES brushProps; | ||||
| brushProps.opacity = fillType.getOpacity(); | brushProps.opacity = fillType.getOpacity(); | ||||
| brushProps.transform = transfromToMatrix (fillType.transform); | |||||
| brushProps.transform = transformToMatrix (fillType.transform); | |||||
| D2D1_BITMAP_BRUSH_PROPERTIES bmProps = D2D1::BitmapBrushProperties (D2D1_EXTEND_MODE_WRAP,D2D1_EXTEND_MODE_WRAP); | D2D1_BITMAP_BRUSH_PROPERTIES bmProps = D2D1::BitmapBrushProperties (D2D1_EXTEND_MODE_WRAP,D2D1_EXTEND_MODE_WRAP); | ||||
| @@ -241348,8 +241346,8 @@ public: | |||||
| bp.pixelFormat = owner.renderingTarget->GetPixelFormat(); | bp.pixelFormat = owner.renderingTarget->GetPixelFormat(); | ||||
| bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; | bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; | ||||
| HRESULT hr = owner.renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, &bitmap); | |||||
| hr = owner.renderingTarget->CreateBitmapBrush (bitmap, bmProps, brushProps, &bitmapBrush); | |||||
| HRESULT hr = owner.renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, bitmap.resetAndGetPointerAddress()); | |||||
| hr = owner.renderingTarget->CreateBitmapBrush (bitmap, bmProps, brushProps, bitmapBrush.resetAndGetPointerAddress()); | |||||
| currentBrush = bitmapBrush; | currentBrush = bitmapBrush; | ||||
| } | } | ||||
| @@ -241359,7 +241357,7 @@ public: | |||||
| D2D1_BRUSH_PROPERTIES brushProps; | D2D1_BRUSH_PROPERTIES brushProps; | ||||
| brushProps.opacity = fillType.getOpacity(); | brushProps.opacity = fillType.getOpacity(); | ||||
| brushProps.transform = transfromToMatrix (fillType.transform); | |||||
| brushProps.transform = transformToMatrix (fillType.transform); | |||||
| const int numColors = fillType.gradient->getNumColours(); | const int numColors = fillType.gradient->getNumColours(); | ||||
| @@ -241371,7 +241369,7 @@ public: | |||||
| stops[i].position = fillType.gradient->getColourPosition(i); | stops[i].position = fillType.gradient->getColourPosition(i); | ||||
| } | } | ||||
| owner.renderingTarget->CreateGradientStopCollection (stops.getData(), numColors, &gradientStops); | |||||
| owner.renderingTarget->CreateGradientStopCollection (stops.getData(), numColors, gradientStops.resetAndGetPointerAddress()); | |||||
| if (fillType.gradient->isRadial) | if (fillType.gradient->isRadial) | ||||
| { | { | ||||
| @@ -241386,7 +241384,7 @@ public: | |||||
| D2D1::Point2F (0, 0), | D2D1::Point2F (0, 0), | ||||
| r, r); | r, r); | ||||
| owner.renderingTarget->CreateRadialGradientBrush (props, brushProps, gradientStops, &radialGradient); | |||||
| owner.renderingTarget->CreateRadialGradientBrush (props, brushProps, gradientStops, radialGradient.resetAndGetPointerAddress()); | |||||
| currentBrush = radialGradient; | currentBrush = radialGradient; | ||||
| } | } | ||||
| else | else | ||||
| @@ -241400,7 +241398,7 @@ public: | |||||
| D2D1::LinearGradientBrushProperties (D2D1::Point2F (p1.getX() + x, p1.getY() + y), | D2D1::LinearGradientBrushProperties (D2D1::Point2F (p1.getX() + x, p1.getY() + y), | ||||
| D2D1::Point2F (p2.getX() + x, p2.getY() + y)); | D2D1::Point2F (p2.getX() + x, p2.getY() + y)); | ||||
| owner.renderingTarget->CreateLinearGradientBrush (props, brushProps, gradientStops, &linearGradient); | |||||
| owner.renderingTarget->CreateLinearGradientBrush (props, brushProps, gradientStops, linearGradient.resetAndGetPointerAddress()); | |||||
| currentBrush = linearGradient; | currentBrush = linearGradient; | ||||
| } | } | ||||
| @@ -241494,7 +241492,7 @@ private: | |||||
| SharedD2DFactory::getInstance()->d2dFactory->CreatePathGeometry (&p); | SharedD2DFactory::getInstance()->d2dFactory->CreatePathGeometry (&p); | ||||
| ComSmartPtr <ID2D1GeometrySink> sink; | ComSmartPtr <ID2D1GeometrySink> sink; | ||||
| HRESULT hr = p->Open (&sink); // xxx handle error | |||||
| HRESULT hr = p->Open (sink.resetAndGetPointerAddress()); // xxx handle error | |||||
| sink->SetFillMode (D2D1_FILL_MODE_WINDING); | sink->SetFillMode (D2D1_FILL_MODE_WINDING); | ||||
| for (int i = clipRegion.getNumRectangles(); --i >= 0;) | for (int i = clipRegion.getNumRectangles(); --i >= 0;) | ||||
| @@ -241572,7 +241570,7 @@ private: | |||||
| SharedD2DFactory::getInstance()->d2dFactory->CreatePathGeometry (&p); | SharedD2DFactory::getInstance()->d2dFactory->CreatePathGeometry (&p); | ||||
| ComSmartPtr <ID2D1GeometrySink> sink; | ComSmartPtr <ID2D1GeometrySink> sink; | ||||
| HRESULT hr = p->Open (&sink); | |||||
| HRESULT hr = p->Open (sink.resetAndGetPointerAddress()); | |||||
| sink->SetFillMode (D2D1_FILL_MODE_WINDING); // xxx need to check Path::isUsingNonZeroWinding() | sink->SetFillMode (D2D1_FILL_MODE_WINDING); // xxx need to check Path::isUsingNonZeroWinding() | ||||
| pathToGeometrySink (path, sink, transform, point.getX(), point.getY()); | pathToGeometrySink (path, sink, transform, point.getX(), point.getY()); | ||||
| @@ -241581,7 +241579,7 @@ private: | |||||
| return p; | return p; | ||||
| } | } | ||||
| static const D2D1::Matrix3x2F transfromToMatrix (const AffineTransform& transform) | |||||
| static const D2D1::Matrix3x2F transformToMatrix (const AffineTransform& transform) | |||||
| { | { | ||||
| D2D1::Matrix3x2F matrix; | D2D1::Matrix3x2F matrix; | ||||
| matrix._11 = transform.mat00; | matrix._11 = transform.mat00; | ||||
| @@ -253743,6 +253741,7 @@ CameraDevice* CameraDevice::openDevice (int index, | |||||
| #pragma comment(lib, "advapi32.lib") | #pragma comment(lib, "advapi32.lib") | ||||
| #pragma comment(lib, "ws2_32.lib") | #pragma comment(lib, "ws2_32.lib") | ||||
| #pragma comment(lib, "version.lib") | #pragma comment(lib, "version.lib") | ||||
| #pragma comment(lib, "shlwapi.lib") | |||||
| #ifdef _NATIVE_WCHAR_T_DEFINED | #ifdef _NATIVE_WCHAR_T_DEFINED | ||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||
| @@ -845,6 +845,9 @@ namespace JuceDummyNamespace {} | |||||
| #define JUCE_API __declspec (dllimport) | #define JUCE_API __declspec (dllimport) | ||||
| #pragma warning (disable: 4251) | #pragma warning (disable: 4251) | ||||
| #endif | #endif | ||||
| #ifdef __INTEL_COMPILER | |||||
| #pragma warning (disable: 1125) // (virtual override warning) | |||||
| #endif | |||||
| #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | ||||
| #ifdef JUCE_DLL_BUILD | #ifdef JUCE_DLL_BUILD | ||||
| #define JUCE_API __attribute__ ((visibility("default"))) | #define JUCE_API __attribute__ ((visibility("default"))) | ||||
| @@ -6164,6 +6167,11 @@ public: | |||||
| /** Returns true if this var has the same value as the one supplied. */ | /** Returns true if this var has the same value as the one supplied. */ | ||||
| bool equals (const var& other) const throw(); | bool equals (const var& other) const throw(); | ||||
| /** Returns true if this var has the same value and type as the one supplied. | |||||
| This differs from equals() because e.g. "0" and 0 will be considered different. | |||||
| */ | |||||
| bool equalsWithSameType (const var& other) const throw(); | |||||
| private: | private: | ||||
| class VariantType; | class VariantType; | ||||
| friend class VariantType; | friend class VariantType; | ||||
| @@ -34867,10 +34875,12 @@ public: | |||||
| rate of the source, and playback will be sample-rate | rate of the source, and playback will be sample-rate | ||||
| adjusted to maintain playback at the correct pitch. If | adjusted to maintain playback at the correct pitch. If | ||||
| this is 0, no sample-rate adjustment will be performed | this is 0, no sample-rate adjustment will be performed | ||||
| @param maxNumChannels the maximum number of channels that may need to be played | |||||
| */ | */ | ||||
| void setSource (PositionableAudioSource* newSource, | void setSource (PositionableAudioSource* newSource, | ||||
| int readAheadBufferSize = 0, | int readAheadBufferSize = 0, | ||||
| double sourceSampleRateToCorrectFor = 0.0); | |||||
| double sourceSampleRateToCorrectFor = 0.0, | |||||
| int maxNumChannels = 2); | |||||
| /** Changes the current playback position in the source stream. | /** Changes the current playback position in the source stream. | ||||
| @@ -39586,6 +39596,9 @@ public: | |||||
| */ | */ | ||||
| void setItemEnabled (int itemId, bool shouldBeEnabled); | void setItemEnabled (int itemId, bool shouldBeEnabled); | ||||
| /** Returns true if the given item is enabled. */ | |||||
| bool isItemEnabled (int itemId) const throw(); | |||||
| /** Changes the text for an existing item. | /** Changes the text for an existing item. | ||||
| */ | */ | ||||
| void changeItemText (int itemId, const String& newText); | void changeItemText (int itemId, const String& newText); | ||||
| @@ -64022,6 +64035,7 @@ END_JUCE_NAMESPACE | |||||
| #pragma comment(lib, "advapi32.lib") | #pragma comment(lib, "advapi32.lib") | ||||
| #pragma comment(lib, "ws2_32.lib") | #pragma comment(lib, "ws2_32.lib") | ||||
| #pragma comment(lib, "version.lib") | #pragma comment(lib, "version.lib") | ||||
| #pragma comment(lib, "shlwapi.lib") | |||||
| #ifdef _NATIVE_WCHAR_T_DEFINED | #ifdef _NATIVE_WCHAR_T_DEFINED | ||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||
| @@ -61,7 +61,8 @@ AudioTransportSource::~AudioTransportSource() | |||||
| void AudioTransportSource::setSource (PositionableAudioSource* const newSource, | void AudioTransportSource::setSource (PositionableAudioSource* const newSource, | ||||
| int readAheadBufferSize_, | int readAheadBufferSize_, | ||||
| double sourceSampleRateToCorrectFor) | |||||
| double sourceSampleRateToCorrectFor, | |||||
| int maxNumChannels) | |||||
| { | { | ||||
| if (source == newSource) | if (source == newSource) | ||||
| { | { | ||||
| @@ -95,7 +96,7 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource, | |||||
| if (sourceSampleRateToCorrectFor != 0) | if (sourceSampleRateToCorrectFor != 0) | ||||
| newMasterSource = newResamplerSource | newMasterSource = newResamplerSource | ||||
| = new ResamplingAudioSource (newPositionableSource, false); | |||||
| = new ResamplingAudioSource (newPositionableSource, false, maxNumChannels); | |||||
| else | else | ||||
| newMasterSource = newPositionableSource; | newMasterSource = newPositionableSource; | ||||
| @@ -75,10 +75,12 @@ public: | |||||
| rate of the source, and playback will be sample-rate | rate of the source, and playback will be sample-rate | ||||
| adjusted to maintain playback at the correct pitch. If | adjusted to maintain playback at the correct pitch. If | ||||
| this is 0, no sample-rate adjustment will be performed | this is 0, no sample-rate adjustment will be performed | ||||
| @param maxNumChannels the maximum number of channels that may need to be played | |||||
| */ | */ | ||||
| void setSource (PositionableAudioSource* newSource, | void setSource (PositionableAudioSource* newSource, | ||||
| int readAheadBufferSize = 0, | int readAheadBufferSize = 0, | ||||
| double sourceSampleRateToCorrectFor = 0.0); | |||||
| double sourceSampleRateToCorrectFor = 0.0, | |||||
| int maxNumChannels = 2); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Changes the current playback position in the source stream. | /** Changes the current playback position in the source stream. | ||||
| @@ -74,10 +74,6 @@ public: | |||||
| { | { | ||||
| } | } | ||||
| ~SimpleValueSource() | |||||
| { | |||||
| } | |||||
| const var getValue() const | const var getValue() const | ||||
| { | { | ||||
| return value; | return value; | ||||
| @@ -85,7 +81,7 @@ public: | |||||
| void setValue (const var& newValue) | void setValue (const var& newValue) | ||||
| { | { | ||||
| if (newValue != value) | |||||
| if (! newValue.equalsWithSameType (value)) | |||||
| { | { | ||||
| value = newValue; | value = newValue; | ||||
| sendChangeMessage (false); | sendChangeMessage (false); | ||||
| @@ -343,6 +343,11 @@ bool var::equals (const var& other) const throw() | |||||
| return type->equals (value, other.value, *other.type); | return type->equals (value, other.value, *other.type); | ||||
| } | } | ||||
| bool var::equalsWithSameType (const var& other) const throw() | |||||
| { | |||||
| return type == other.type && equals (other); | |||||
| } | |||||
| bool operator== (const var& v1, const var& v2) throw() { return v1.equals (v2); } | bool operator== (const var& v1, const var& v2) throw() { return v1.equals (v2); } | ||||
| bool operator!= (const var& v1, const var& v2) throw() { return ! v1.equals (v2); } | bool operator!= (const var& v1, const var& v2) throw() { return ! v1.equals (v2); } | ||||
| bool operator== (const var& v1, const String& v2) throw() { return v1.toString() == v2; } | bool operator== (const var& v1, const String& v2) throw() { return v1.toString() == v2; } | ||||
| @@ -140,6 +140,11 @@ public: | |||||
| /** Returns true if this var has the same value as the one supplied. */ | /** Returns true if this var has the same value as the one supplied. */ | ||||
| bool equals (const var& other) const throw(); | bool equals (const var& other) const throw(); | ||||
| /** Returns true if this var has the same value and type as the one supplied. | |||||
| This differs from equals() because e.g. "0" and 0 will be considered different. | |||||
| */ | |||||
| bool equalsWithSameType (const var& other) const throw(); | |||||
| private: | private: | ||||
| class VariantType; | class VariantType; | ||||
| friend class VariantType; | friend class VariantType; | ||||
| @@ -140,6 +140,9 @@ | |||||
| #define JUCE_API __declspec (dllimport) | #define JUCE_API __declspec (dllimport) | ||||
| #pragma warning (disable: 4251) | #pragma warning (disable: 4251) | ||||
| #endif | #endif | ||||
| #ifdef __INTEL_COMPILER | |||||
| #pragma warning (disable: 1125) // (virtual override warning) | |||||
| #endif | |||||
| #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | #elif defined (__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | ||||
| #ifdef JUCE_DLL_BUILD | #ifdef JUCE_DLL_BUILD | ||||
| #define JUCE_API __attribute__ ((visibility("default"))) | #define JUCE_API __attribute__ ((visibility("default"))) | ||||
| @@ -159,6 +159,12 @@ void ComboBox::setItemEnabled (const int itemId, const bool shouldBeEnabled) | |||||
| item->isEnabled = shouldBeEnabled; | item->isEnabled = shouldBeEnabled; | ||||
| } | } | ||||
| bool ComboBox::isItemEnabled (int itemId) const throw() | |||||
| { | |||||
| const ItemInfo* const item = getItemForId (itemId); | |||||
| return item != 0 && item->isEnabled; | |||||
| } | |||||
| void ComboBox::changeItemText (const int itemId, const String& newText) | void ComboBox::changeItemText (const int itemId, const String& newText) | ||||
| { | { | ||||
| ItemInfo* const item = getItemForId (itemId); | ItemInfo* const item = getItemForId (itemId); | ||||
| @@ -133,6 +133,9 @@ public: | |||||
| */ | */ | ||||
| void setItemEnabled (int itemId, bool shouldBeEnabled); | void setItemEnabled (int itemId, bool shouldBeEnabled); | ||||
| /** Returns true if the given item is enabled. */ | |||||
| bool isItemEnabled (int itemId) const throw(); | |||||
| /** Changes the text for an existing item. | /** Changes the text for an existing item. | ||||
| */ | */ | ||||
| void changeItemText (int itemId, const String& newText); | void changeItemText (int itemId, const String& newText); | ||||
| @@ -13,6 +13,7 @@ | |||||
| #pragma comment(lib, "advapi32.lib") | #pragma comment(lib, "advapi32.lib") | ||||
| #pragma comment(lib, "ws2_32.lib") | #pragma comment(lib, "ws2_32.lib") | ||||
| #pragma comment(lib, "version.lib") | #pragma comment(lib, "version.lib") | ||||
| #pragma comment(lib, "shlwapi.lib") | |||||
| #ifdef _NATIVE_WCHAR_T_DEFINED | #ifdef _NATIVE_WCHAR_T_DEFINED | ||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||
| @@ -34,11 +34,13 @@ class SharedD2DFactory : public DeletedAtShutdown | |||||
| public: | public: | ||||
| SharedD2DFactory() | SharedD2DFactory() | ||||
| { | { | ||||
| D2D1CreateFactory (D2D1_FACTORY_TYPE_SINGLE_THREADED, &d2dFactory); | |||||
| DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory), (IUnknown**) &directWriteFactory); | |||||
| jassertfalse; //xxx Direct2D support isn't ready for use yet! | |||||
| D2D1CreateFactory (D2D1_FACTORY_TYPE_SINGLE_THREADED, d2dFactory.resetAndGetPointerAddress()); | |||||
| DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory), (IUnknown**) directWriteFactory.resetAndGetPointerAddress()); | |||||
| if (directWriteFactory != 0) | if (directWriteFactory != 0) | ||||
| directWriteFactory->GetSystemFontCollection (&systemFonts); | |||||
| directWriteFactory->GetSystemFontCollection (systemFonts.resetAndGetPointerAddress()); | |||||
| } | } | ||||
| ~SharedD2DFactory() | ~SharedD2DFactory() | ||||
| @@ -72,10 +74,10 @@ public: | |||||
| D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties(); | D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties(); | ||||
| D2D1_HWND_RENDER_TARGET_PROPERTIES propsHwnd = D2D1::HwndRenderTargetProperties (hwnd, size); | D2D1_HWND_RENDER_TARGET_PROPERTIES propsHwnd = D2D1::HwndRenderTargetProperties (hwnd, size); | ||||
| HRESULT hr = SharedD2DFactory::getInstance()->d2dFactory->CreateHwndRenderTarget (props, propsHwnd, &renderingTarget); | |||||
| HRESULT hr = SharedD2DFactory::getInstance()->d2dFactory->CreateHwndRenderTarget (props, propsHwnd, renderingTarget.resetAndGetPointerAddress()); | |||||
| // xxx check for error | // xxx check for error | ||||
| hr = renderingTarget->CreateSolidColorBrush (D2D1::ColorF::ColorF (0.0f, 0.0f, 0.0f, 1.0f), &colourBrush); | |||||
| hr = renderingTarget->CreateSolidColorBrush (D2D1::ColorF::ColorF (0.0f, 0.0f, 0.0f, 1.0f), colourBrush.resetAndGetPointerAddress()); | |||||
| } | } | ||||
| ~Direct2DLowLevelGraphicsContext() | ~Direct2DLowLevelGraphicsContext() | ||||
| @@ -232,7 +234,7 @@ public: | |||||
| const int x = currentState->origin.getX(); | const int x = currentState->origin.getX(); | ||||
| const int y = currentState->origin.getY(); | const int y = currentState->origin.getY(); | ||||
| renderingTarget->SetTransform (transfromToMatrix (transform) * D2D1::Matrix3x2F::Translation (x, y)); | |||||
| renderingTarget->SetTransform (transformToMatrix (transform) * D2D1::Matrix3x2F::Translation (x, y)); | |||||
| D2D1_SIZE_U size; | D2D1_SIZE_U size; | ||||
| size.width = image.getWidth(); | size.width = image.getWidth(); | ||||
| @@ -247,7 +249,7 @@ public: | |||||
| { | { | ||||
| ComSmartPtr <ID2D1Bitmap> tempBitmap; | ComSmartPtr <ID2D1Bitmap> tempBitmap; | ||||
| renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, &tempBitmap); | |||||
| renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, tempBitmap.resetAndGetPointerAddress()); | |||||
| if (tempBitmap != 0) | if (tempBitmap != 0) | ||||
| renderingTarget->DrawBitmap (tempBitmap); | renderingTarget->DrawBitmap (tempBitmap); | ||||
| } | } | ||||
| @@ -315,7 +317,7 @@ public: | |||||
| float kerning = currentState->font.getExtraKerningFactor(); // xxx why does removing this line mess up the kerning?? | float kerning = currentState->font.getExtraKerningFactor(); // xxx why does removing this line mess up the kerning?? | ||||
| float hScale = currentState->font.getHorizontalScale(); | float hScale = currentState->font.getHorizontalScale(); | ||||
| renderingTarget->SetTransform (D2D1::Matrix3x2F::Scale (hScale, 1) * transfromToMatrix (transform) * D2D1::Matrix3x2F::Translation (x, y)); | |||||
| renderingTarget->SetTransform (D2D1::Matrix3x2F::Scale (hScale, 1) * transformToMatrix (transform) * D2D1::Matrix3x2F::Translation (x, y)); | |||||
| float dpiX = 0, dpiY = 0; | float dpiX = 0, dpiY = 0; | ||||
| SharedD2DFactory::getInstance()->d2dFactory->GetDesktopDpi (&dpiX, &dpiY); | SharedD2DFactory::getInstance()->d2dFactory->GetDesktopDpi (&dpiX, &dpiY); | ||||
| @@ -415,7 +417,7 @@ public: | |||||
| clearPathClip(); | clearPathClip(); | ||||
| if (complexClipLayer == 0) | if (complexClipLayer == 0) | ||||
| owner.renderingTarget->CreateLayer (&complexClipLayer); | |||||
| owner.renderingTarget->CreateLayer (complexClipLayer.resetAndGetPointerAddress()); | |||||
| complexClipGeometry = geometry; | complexClipGeometry = geometry; | ||||
| shouldClipComplex = true; | shouldClipComplex = true; | ||||
| @@ -438,7 +440,7 @@ public: | |||||
| clearRectListClip(); | clearRectListClip(); | ||||
| if (rectListLayer == 0) | if (rectListLayer == 0) | ||||
| owner.renderingTarget->CreateLayer (&rectListLayer); | |||||
| owner.renderingTarget->CreateLayer (rectListLayer.resetAndGetPointerAddress()); | |||||
| rectListGeometry = geometry; | rectListGeometry = geometry; | ||||
| shouldClipRectList = true; | shouldClipRectList = true; | ||||
| @@ -462,11 +464,11 @@ public: | |||||
| clearImageClip(); | clearImageClip(); | ||||
| if (bitmapMaskLayer == 0) | if (bitmapMaskLayer == 0) | ||||
| owner.renderingTarget->CreateLayer (&bitmapMaskLayer); | |||||
| owner.renderingTarget->CreateLayer (bitmapMaskLayer.resetAndGetPointerAddress()); | |||||
| D2D1_BRUSH_PROPERTIES brushProps; | D2D1_BRUSH_PROPERTIES brushProps; | ||||
| brushProps.opacity = 1; | brushProps.opacity = 1; | ||||
| brushProps.transform = transfromToMatrix (transform); | |||||
| brushProps.transform = transformToMatrix (transform); | |||||
| D2D1_BITMAP_BRUSH_PROPERTIES bmProps = D2D1::BitmapBrushProperties (D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_WRAP); | D2D1_BITMAP_BRUSH_PROPERTIES bmProps = D2D1::BitmapBrushProperties (D2D1_EXTEND_MODE_WRAP, D2D1_EXTEND_MODE_WRAP); | ||||
| @@ -481,8 +483,8 @@ public: | |||||
| bp.pixelFormat = owner.renderingTarget->GetPixelFormat(); | bp.pixelFormat = owner.renderingTarget->GetPixelFormat(); | ||||
| bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; | bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; | ||||
| HRESULT hr = owner.renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, &maskBitmap); | |||||
| hr = owner.renderingTarget->CreateBitmapBrush (maskBitmap, bmProps, brushProps, &bitmapMaskBrush); | |||||
| HRESULT hr = owner.renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, maskBitmap.resetAndGetPointerAddress()); | |||||
| hr = owner.renderingTarget->CreateBitmapBrush (maskBitmap, bmProps, brushProps, bitmapMaskBrush.resetAndGetPointerAddress()); | |||||
| imageMaskLayerParams = D2D1::LayerParameters(); | imageMaskLayerParams = D2D1::LayerParameters(); | ||||
| imageMaskLayerParams.opacityBrush = bitmapMaskBrush; | imageMaskLayerParams.opacityBrush = bitmapMaskBrush; | ||||
| @@ -596,14 +598,14 @@ public: | |||||
| fontIndex = 0; | fontIndex = 0; | ||||
| ComSmartPtr <IDWriteFontFamily> fontFam; | ComSmartPtr <IDWriteFontFamily> fontFam; | ||||
| fonts->GetFontFamily (fontIndex, &fontFam); | |||||
| fonts->GetFontFamily (fontIndex, fontFam.resetAndGetPointerAddress()); | |||||
| ComSmartPtr <IDWriteFont> font; | ComSmartPtr <IDWriteFont> font; | ||||
| DWRITE_FONT_WEIGHT weight = this->font.isBold() ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL; | DWRITE_FONT_WEIGHT weight = this->font.isBold() ? DWRITE_FONT_WEIGHT_BOLD : DWRITE_FONT_WEIGHT_NORMAL; | ||||
| DWRITE_FONT_STYLE style = this->font.isItalic() ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; | DWRITE_FONT_STYLE style = this->font.isItalic() ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; | ||||
| fontFam->GetFirstMatchingFont (weight, DWRITE_FONT_STRETCH_NORMAL, style, &font); | |||||
| fontFam->GetFirstMatchingFont (weight, DWRITE_FONT_STRETCH_NORMAL, style, font.resetAndGetPointerAddress()); | |||||
| font->CreateFontFace (&localFontFace); | |||||
| font->CreateFontFace (localFontFace.resetAndGetPointerAddress()); | |||||
| currentFontFace = localFontFace; | currentFontFace = localFontFace; | ||||
| } | } | ||||
| } | } | ||||
| @@ -643,7 +645,7 @@ public: | |||||
| { | { | ||||
| D2D1_BRUSH_PROPERTIES brushProps; | D2D1_BRUSH_PROPERTIES brushProps; | ||||
| brushProps.opacity = fillType.getOpacity(); | brushProps.opacity = fillType.getOpacity(); | ||||
| brushProps.transform = transfromToMatrix (fillType.transform); | |||||
| brushProps.transform = transformToMatrix (fillType.transform); | |||||
| D2D1_BITMAP_BRUSH_PROPERTIES bmProps = D2D1::BitmapBrushProperties (D2D1_EXTEND_MODE_WRAP,D2D1_EXTEND_MODE_WRAP); | D2D1_BITMAP_BRUSH_PROPERTIES bmProps = D2D1::BitmapBrushProperties (D2D1_EXTEND_MODE_WRAP,D2D1_EXTEND_MODE_WRAP); | ||||
| @@ -660,8 +662,8 @@ public: | |||||
| bp.pixelFormat = owner.renderingTarget->GetPixelFormat(); | bp.pixelFormat = owner.renderingTarget->GetPixelFormat(); | ||||
| bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; | bp.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; | ||||
| HRESULT hr = owner.renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, &bitmap); | |||||
| hr = owner.renderingTarget->CreateBitmapBrush (bitmap, bmProps, brushProps, &bitmapBrush); | |||||
| HRESULT hr = owner.renderingTarget->CreateBitmap (size, bd.data, bd.lineStride, bp, bitmap.resetAndGetPointerAddress()); | |||||
| hr = owner.renderingTarget->CreateBitmapBrush (bitmap, bmProps, brushProps, bitmapBrush.resetAndGetPointerAddress()); | |||||
| currentBrush = bitmapBrush; | currentBrush = bitmapBrush; | ||||
| } | } | ||||
| @@ -671,7 +673,7 @@ public: | |||||
| D2D1_BRUSH_PROPERTIES brushProps; | D2D1_BRUSH_PROPERTIES brushProps; | ||||
| brushProps.opacity = fillType.getOpacity(); | brushProps.opacity = fillType.getOpacity(); | ||||
| brushProps.transform = transfromToMatrix (fillType.transform); | |||||
| brushProps.transform = transformToMatrix (fillType.transform); | |||||
| const int numColors = fillType.gradient->getNumColours(); | const int numColors = fillType.gradient->getNumColours(); | ||||
| @@ -683,7 +685,7 @@ public: | |||||
| stops[i].position = fillType.gradient->getColourPosition(i); | stops[i].position = fillType.gradient->getColourPosition(i); | ||||
| } | } | ||||
| owner.renderingTarget->CreateGradientStopCollection (stops.getData(), numColors, &gradientStops); | |||||
| owner.renderingTarget->CreateGradientStopCollection (stops.getData(), numColors, gradientStops.resetAndGetPointerAddress()); | |||||
| if (fillType.gradient->isRadial) | if (fillType.gradient->isRadial) | ||||
| { | { | ||||
| @@ -698,7 +700,7 @@ public: | |||||
| D2D1::Point2F (0, 0), | D2D1::Point2F (0, 0), | ||||
| r, r); | r, r); | ||||
| owner.renderingTarget->CreateRadialGradientBrush (props, brushProps, gradientStops, &radialGradient); | |||||
| owner.renderingTarget->CreateRadialGradientBrush (props, brushProps, gradientStops, radialGradient.resetAndGetPointerAddress()); | |||||
| currentBrush = radialGradient; | currentBrush = radialGradient; | ||||
| } | } | ||||
| else | else | ||||
| @@ -712,7 +714,7 @@ public: | |||||
| D2D1::LinearGradientBrushProperties (D2D1::Point2F (p1.getX() + x, p1.getY() + y), | D2D1::LinearGradientBrushProperties (D2D1::Point2F (p1.getX() + x, p1.getY() + y), | ||||
| D2D1::Point2F (p2.getX() + x, p2.getY() + y)); | D2D1::Point2F (p2.getX() + x, p2.getY() + y)); | ||||
| owner.renderingTarget->CreateLinearGradientBrush (props, brushProps, gradientStops, &linearGradient); | |||||
| owner.renderingTarget->CreateLinearGradientBrush (props, brushProps, gradientStops, linearGradient.resetAndGetPointerAddress()); | |||||
| currentBrush = linearGradient; | currentBrush = linearGradient; | ||||
| } | } | ||||
| @@ -809,7 +811,7 @@ private: | |||||
| SharedD2DFactory::getInstance()->d2dFactory->CreatePathGeometry (&p); | SharedD2DFactory::getInstance()->d2dFactory->CreatePathGeometry (&p); | ||||
| ComSmartPtr <ID2D1GeometrySink> sink; | ComSmartPtr <ID2D1GeometrySink> sink; | ||||
| HRESULT hr = p->Open (&sink); // xxx handle error | |||||
| HRESULT hr = p->Open (sink.resetAndGetPointerAddress()); // xxx handle error | |||||
| sink->SetFillMode (D2D1_FILL_MODE_WINDING); | sink->SetFillMode (D2D1_FILL_MODE_WINDING); | ||||
| for (int i = clipRegion.getNumRectangles(); --i >= 0;) | for (int i = clipRegion.getNumRectangles(); --i >= 0;) | ||||
| @@ -887,7 +889,7 @@ private: | |||||
| SharedD2DFactory::getInstance()->d2dFactory->CreatePathGeometry (&p); | SharedD2DFactory::getInstance()->d2dFactory->CreatePathGeometry (&p); | ||||
| ComSmartPtr <ID2D1GeometrySink> sink; | ComSmartPtr <ID2D1GeometrySink> sink; | ||||
| HRESULT hr = p->Open (&sink); | |||||
| HRESULT hr = p->Open (sink.resetAndGetPointerAddress()); | |||||
| sink->SetFillMode (D2D1_FILL_MODE_WINDING); // xxx need to check Path::isUsingNonZeroWinding() | sink->SetFillMode (D2D1_FILL_MODE_WINDING); // xxx need to check Path::isUsingNonZeroWinding() | ||||
| pathToGeometrySink (path, sink, transform, point.getX(), point.getY()); | pathToGeometrySink (path, sink, transform, point.getX(), point.getY()); | ||||
| @@ -896,7 +898,7 @@ private: | |||||
| return p; | return p; | ||||
| } | } | ||||
| static const D2D1::Matrix3x2F transfromToMatrix (const AffineTransform& transform) | |||||
| static const D2D1::Matrix3x2F transformToMatrix (const AffineTransform& transform) | |||||
| { | { | ||||
| D2D1::Matrix3x2F matrix; | D2D1::Matrix3x2F matrix; | ||||
| matrix._11 = transform.mat00; | matrix._11 = transform.mat00; | ||||
| @@ -58,8 +58,12 @@ namespace WindowsFileHelpers | |||||
| const String getDriveFromPath (const String& path) | const String getDriveFromPath (const String& path) | ||||
| { | { | ||||
| if (path.isNotEmpty() && path[1] == ':') | |||||
| return path.substring (0, 2) + '\\'; | |||||
| const int length = path.length(); | |||||
| HeapBlock <WCHAR> stringCopy (length + 1); | |||||
| path.copyToUnicode (stringCopy, length); | |||||
| if (PathStripToRoot (stringCopy)) | |||||
| return String (stringCopy); | |||||
| return path; | return path; | ||||
| } | } | ||||
| @@ -41,10 +41,6 @@ | |||||
| #if JUCE_MSVC | #if JUCE_MSVC | ||||
| #pragma warning (push) | #pragma warning (push) | ||||
| #pragma warning (disable : 4100 4201 4514 4312 4995) | #pragma warning (disable : 4100 4201 4514 4312 4995) | ||||
| #ifdef __INTEL_COMPILER | |||||
| #pragma warning (disable: 1125) | |||||
| #endif | |||||
| #endif | #endif | ||||
| #define _WIN32_WINNT 0x0500 | #define _WIN32_WINNT 0x0500 | ||||
| @@ -73,6 +69,7 @@ | |||||
| #include <Exdisp.h> | #include <Exdisp.h> | ||||
| #include <exdispid.h> | #include <exdispid.h> | ||||
| #include <shlobj.h> | #include <shlobj.h> | ||||
| #include <shlwapi.h> | |||||
| #if ! JUCE_MINGW | #if ! JUCE_MINGW | ||||
| #include <crtdbg.h> | #include <crtdbg.h> | ||||
| @@ -1880,21 +1880,20 @@ int64 String::getHexValue64() const throw() | |||||
| //============================================================================== | //============================================================================== | ||||
| const String String::createStringFromData (const void* const data_, const int size) | const String String::createStringFromData (const void* const data_, const int size) | ||||
| { | { | ||||
| const char* const data = static_cast <const char*> (data_); | |||||
| const uint8* const data = static_cast <const uint8*> (data_); | |||||
| if (size <= 0 || data == 0) | if (size <= 0 || data == 0) | ||||
| { | { | ||||
| return empty; | return empty; | ||||
| } | } | ||||
| else if (size < 2) | |||||
| else if (size == 1) | |||||
| { | { | ||||
| return charToString (data[0]); | |||||
| return charToString ((char) data[0]); | |||||
| } | } | ||||
| else if ((data[0] == (char)-2 && data[1] == (char)-1) | |||||
| || (data[0] == (char)-1 && data[1] == (char)-2)) | |||||
| else if ((data[0] == (uint8) 0xfe && data[1] == (uint8) 0xff) // UTF-16 BOM | |||||
| || (data[0] == (uint8) 0xff && data[1] == (uint8) 0xfe)) | |||||
| { | { | ||||
| // assume it's 16-bit unicode | |||||
| const bool bigEndian = (data[0] == (char)-2); | |||||
| const bool bigEndian = (data[0] == (uint8) 0xfe); | |||||
| const int numChars = size / 2 - 1; | const int numChars = size / 2 - 1; | ||||
| String result; | String result; | ||||
| @@ -1919,7 +1918,10 @@ const String String::createStringFromData (const void* const data_, const int si | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| return String::fromUTF8 (data, size); | |||||
| if (size >= 3 && data[0] == (uint8) 0xef && data[1] == (uint8) 0xbb && data[2] == (uint8) 0xbf) // UTF-8 BOM | |||||
| return String::fromUTF8 ((const char*) data + 3, size - 3); | |||||
| return String::fromUTF8 ((const char*) data, size); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1968,17 +1970,7 @@ int String::copyToUTF8 (char* const buffer, const int maxBufferSizeBytes) const | |||||
| ++numExtraBytes; | ++numExtraBytes; | ||||
| if (c >= 0x10000) | if (c >= 0x10000) | ||||
| { | |||||
| ++numExtraBytes; | ++numExtraBytes; | ||||
| if (c >= 0x200000) | |||||
| { | |||||
| ++numExtraBytes; | |||||
| if (c >= 0x4000000) | |||||
| ++numExtraBytes; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| if (buffer != 0) | if (buffer != 0) | ||||
| @@ -2040,15 +2032,7 @@ int String::getNumBytesAsUTF8() const throw() | |||||
| { | { | ||||
| ++num; | ++num; | ||||
| if (c >= 0x10000) | if (c >= 0x10000) | ||||
| { | |||||
| ++num; | ++num; | ||||
| if (c >= 0x200000) | |||||
| { | |||||
| ++num; | |||||
| if (c >= 0x4000000) | |||||
| ++num; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| else if (c == 0) | else if (c == 0) | ||||
| @@ -2102,7 +2086,10 @@ const String String::fromUTF8 (const char* const buffer, int bufferSizeBytes) | |||||
| const char nextByte = buffer[i]; | const char nextByte = buffer[i]; | ||||
| if ((nextByte & 0xc0) != 0x80) | if ((nextByte & 0xc0) != 0x80) | ||||
| { | |||||
| n = c; // reset to original value if the input is invalid. | |||||
| break; | break; | ||||
| } | |||||
| n <<= 6; | n <<= 6; | ||||
| n |= (nextByte & 0x3f); | n |= (nextByte & 0x3f); | ||||
| @@ -2451,7 +2438,7 @@ public: | |||||
| zerostruct (wideBuffer); | zerostruct (wideBuffer); | ||||
| for (int i = 0; i < numElementsInArray (wideBuffer) - 1; ++i) | for (int i = 0; i < numElementsInArray (wideBuffer) - 1; ++i) | ||||
| wideBuffer[i] = (juce_wchar) (1 + Random::getSystemRandom().nextInt (std::numeric_limits<juce_wchar>::max() - 1)); | |||||
| wideBuffer[i] = (juce_wchar) (1 + Random::getSystemRandom().nextInt (0x10ffff - 1)); | |||||
| String wide (wideBuffer); | String wide (wideBuffer); | ||||
| expect (wide == (const juce_wchar*) wideBuffer); | expect (wide == (const juce_wchar*) wideBuffer); | ||||