Skip to content

Commit

Permalink
begin fixing breaks from unicode updates. still many more to go.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardeakin committed Jul 18, 2014
1 parent dc590f1 commit 247d5f7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
14 changes: 11 additions & 3 deletions src/cinder/ImageIo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <ppltasks.h>
#include "cinder/WinRTUtils.h"
#include "cinder/Utilities.h"
#include "cinder/msw/CinderMsw.h"
using namespace Windows::Storage;
using namespace Concurrency;
#endif
Expand Down Expand Up @@ -390,7 +391,7 @@ void loadImageAsync(const fs::path path, std::function<void (ImageSourceRef)> ca
auto copyTask = winrt::copyFileToTempDirAsync(path);
copyTask.then([options, extension, callback](StorageFile^ file)
{
fs::path temp = fs::path(toUtf8(file->Path->Data()));
fs::path temp = fs::path( msw::toUtf8String( file->Path->Data() ) );
// Image was loaded. This callback is on the main UI thread
callback(loadImage(temp, options, extension));
winrt::deleteFileAsync(temp);
Expand All @@ -413,8 +414,11 @@ ImageSourceRef loadImage( DataSourceRef dataSource, ImageSource::Options options
#endif

if( extension.empty() )
#if ! defined( CINDER_WINRT )
extension = dataSource->getFilePathHint().extension().string();

#else
extension = dataSource->getFilePathHint().extension();
#endif
return ImageIoRegistrar::createSource( dataSource, options, extension );
}

Expand All @@ -430,8 +434,12 @@ void writeImage( DataTargetRef dataTarget, const ImageSourceRef &imageSource, Im
#endif

if( extension.empty() )
#if ! defined( CINDER_WINRT )
extension = getPathExtension( dataTarget->getFilePathHint().extension().string() );

#else
extension = getPathExtension( dataTarget->getFilePathHint().extension() );
#endif

ImageTargetRef imageTarget = ImageIoRegistrar::createTarget( dataTarget, imageSource, options, extension );
if( imageTarget ) {
writeImage( imageTarget, imageSource );
Expand Down
3 changes: 2 additions & 1 deletion src/cinder/Surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <ppltasks.h>
#include "cinder/WinRTUtils.h"
#include "cinder/Utilities.h"
#include "cinder/msw/CinderMsw.h"
using namespace Windows::Storage;
using namespace Concurrency;
#undef max
Expand Down Expand Up @@ -291,7 +292,7 @@ void SurfaceT<T>::loadImageAsync(const fs::path path, SurfaceT &surface, const S
auto copyTask = winrt::copyFileToTempDirAsync(path);
copyTask.then([path, &surface,constraints,alpha](StorageFile^ file)
{
fs::path temp = fs::path(toUtf8(file->Path->Data()));
fs::path temp = fs::path( msw::toUtf8String( file->Path->Data() ) );
surface = SurfaceT(loadImage(fs::path(temp)),constraints, alpha);
winrt::deleteFileAsync(temp);
});
Expand Down
5 changes: 3 additions & 2 deletions src/cinder/Url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
typedef cinder::IStreamUrlImplCocoa IStreamUrlPlatformImpl;
#elif defined( CINDER_WINRT )
#include "cinder/WinRTUtils.h"
#include "cinder/msw/CinderMsw.h"
#include <wrl/client.h>
#include <agile.h>
using namespace Windows::Storage;
Expand Down Expand Up @@ -70,9 +71,9 @@ std::string Url::encode( const std::string &unescaped )
UrlEscape( (wchar_t*)wideUnescaped.c_str(), (wchar_t*)buffer, &bufferSize, 0 );
return toUtf8( buffer );
#elif defined( CINDER_WINRT )
std::wstring urlStr = toUtf16( unescaped );
std::wstring urlStr = msw::toWideString( unescaped );
auto uri = ref new Windows::Foundation::Uri(ref new Platform::String(urlStr.c_str()));
return toUtf8( std::wstring( uri->AbsoluteCanonicalUri->Data()));
return msw::toUtf8String( std::wstring( uri->AbsoluteCanonicalUri->Data()));
#endif
}

Expand Down
5 changes: 3 additions & 2 deletions src/cinder/app/AppImplWinRT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "cinder/Display.h"
#include "cinder/WinRTUtils.h"
#include "cinder/Utilities.h"
#include "cinder/msw/CinderMsw.h"

#include <Windows.h>
#include <CommDlg.h>
Expand Down Expand Up @@ -160,7 +161,7 @@ void AppImplWinRT::getFolderPath( const fs::path &initialPath, std::vector<std:
{
if (folder)
{
f(fs::path(toUtf8(folder->Path->Data())));
f( fs::path( msw::toUtf8String( folder->Path->Data() ) ) );
}
else
{
Expand Down Expand Up @@ -192,7 +193,7 @@ void AppImplWinRT::getOpenFilePath( const fs::path &initialPath, std::vector<st
{
if (file)
{
f(fs::path(toUtf8(file->Path->Data())));
f( fs::path( msw::toUtf8String( file->Path->Data() ) ) );
}
else
{
Expand Down

0 comments on commit 247d5f7

Please sign in to comment.