mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13489 from jianglong0156/fixwin32textureCacheTest
fix texturecache didn't show correctly in win32
This commit is contained in:
commit
c6c1b429c6
|
@ -197,18 +197,18 @@ void Downloader::downloadToBuffer(const std::string& srcUrl, const std::string&
|
|||
|
||||
CC_ASSERT(_downloaderImpl && "Cannot instanciate more than one instance of DownloaderImpl");
|
||||
|
||||
DownloadUnit unit;
|
||||
unit.srcUrl = srcUrl;
|
||||
unit.customId = customId;
|
||||
unit.fp = buffer;
|
||||
unit.downloaded = 0;
|
||||
unit.totalToDownload = 0;
|
||||
|
||||
StreamData streamBuffer;
|
||||
streamBuffer.buffer = buffer;
|
||||
streamBuffer.total = size;
|
||||
streamBuffer.offset = 0;
|
||||
|
||||
DownloadUnit unit;
|
||||
unit.srcUrl = srcUrl;
|
||||
unit.customId = customId;
|
||||
unit.fp = &streamBuffer;
|
||||
unit.downloaded = 0;
|
||||
unit.totalToDownload = 0;
|
||||
|
||||
int res = _downloaderImpl->performDownload(&unit,
|
||||
std::bind(&Downloader::bufferWriteFunc, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4),
|
||||
std::bind(&Downloader::downloadProgressFunc, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)
|
||||
|
|
|
@ -48,7 +48,10 @@ static size_t _fileWriteFunc(void *ptr, size_t size, size_t nmemb, void* userdat
|
|||
int ret = this_->getWriterCallback()(ptr, size, nmemb, unit);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static size_t _fileWriteFuncForAdapter(void *ptr, size_t size, size_t nmemb, void* userdata)
|
||||
{
|
||||
return nmemb;
|
||||
}
|
||||
static int _downloadProgressFunc(void* userdata, double totalToDownload, double nowDownloaded, double totalToUpLoad, double nowUpLoaded)
|
||||
{
|
||||
DownloadUnit *downloadUnit = (DownloadUnit*)userdata;
|
||||
|
@ -284,7 +287,8 @@ int DownloaderImpl::getHeader(const std::string& url, HeaderInfo* headerInfo)
|
|||
curl_easy_setopt(curlHandle, CURLOPT_HEADER, 1);
|
||||
curl_easy_setopt(curlHandle, CURLOPT_NOBODY, 1);
|
||||
curl_easy_setopt(curlHandle, CURLOPT_NOSIGNAL, 1);
|
||||
|
||||
// in win32 platform, if not set the writeFunction, it will return CURLE_WRITE_ERROR
|
||||
curl_easy_setopt(curlHandle, CURLOPT_WRITEFUNCTION, _fileWriteFuncForAdapter);
|
||||
if ((_lastErrCode=curl_easy_perform(curlHandle)) == CURLE_OK)
|
||||
{
|
||||
char *effectiveUrl;
|
||||
|
|
Loading…
Reference in New Issue