Fixed libwebpjs memmove problem
This commit is contained in:
parent
97f0f80808
commit
4b0bd16aab
@ -64,8 +64,7 @@
|
|||||||
<script type="text/javascript" src="vendor/zlib/gunzip.min.js"></script>
|
<script type="text/javascript" src="vendor/zlib/gunzip.min.js"></script>
|
||||||
<script type="text/javascript" src="vendor/closure/long.js"></script>
|
<script type="text/javascript" src="vendor/closure/long.js"></script>
|
||||||
<script type="text/javascript" src="vendor/leemon_bigint/bigint.js"></script>
|
<script type="text/javascript" src="vendor/leemon_bigint/bigint.js"></script>
|
||||||
<!--script type="text/javascript" src="vendor/libwebpjs/libwebp-0.2.0.min.js"></script-->
|
<script type="text/javascript" src="vendor/libwebpjs/libwebp-0.2.0.js"></script>
|
||||||
<script type="text/javascript" src="vendor/libwebpjs/libwebp-0.1.13.js"></script>
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript" src="js/lib/utils.js"></script>
|
<script type="text/javascript" src="js/lib/utils.js"></script>
|
||||||
|
@ -205,6 +205,19 @@ angular.module('izhukov.utils', [])
|
|||||||
return $q.reject(e);
|
return $q.reject(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (fileData.file) {
|
||||||
|
var deferred = $q.defer();
|
||||||
|
fileData.file(function (blob) {
|
||||||
|
getByteArray(blob).then(function (result) {
|
||||||
|
deferred.resolve(result);
|
||||||
|
}, function (error) {
|
||||||
|
deferred.reject(error);
|
||||||
|
})
|
||||||
|
}, function (error) {
|
||||||
|
deferred.reject(error);
|
||||||
|
});
|
||||||
|
return deferred.promise;
|
||||||
|
}
|
||||||
return $q.when(fileData);
|
return $q.when(fileData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,30 +463,17 @@ function versionCompare (ver1, ver2) {
|
|||||||
image.onerror = function () {
|
image.onerror = function () {
|
||||||
nativeWebpSupport = false;
|
nativeWebpSupport = false;
|
||||||
};
|
};
|
||||||
// image.src = 'data:image/webp;base64,UklGRjIAAABXRUJQVlA4ICYAAACyAgCdASoCAAEALmk0mk0iIiIiIgBoSygABc6zbAAA/v56QAAAAA==';
|
image.src = 'data:image/webp;base64,UklGRjIAAABXRUJQVlA4ICYAAACyAgCdASoCAAEALmk0mk0iIiIiIgBoSygABc6zbAAA/v56QAAAAA==';
|
||||||
|
|
||||||
var canvas, context;
|
var canvas, context;
|
||||||
|
|
||||||
function convertBinaryToArray (a) {
|
|
||||||
var b = new Array();
|
|
||||||
var c = a.length;
|
|
||||||
for (i = 0; i < c; ++i) b.push(a.charCodeAt(i));
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getPngUrlFromData(data) {
|
function getPngUrlFromData(data) {
|
||||||
console.log(data);
|
|
||||||
data = convertBinaryToArray(data);
|
|
||||||
|
|
||||||
|
|
||||||
var start = tsNow();
|
var start = tsNow();
|
||||||
|
|
||||||
var decoder = new WebPDecoder();
|
var decoder = new WebPDecoder();
|
||||||
|
|
||||||
var config = decoder.WebPDecoderConfig;
|
var config = decoder.WebPDecoderConfig;
|
||||||
var buffer = config.output;
|
var buffer = config.j || config.output;
|
||||||
// var buffer = config.j;
|
|
||||||
var bitstream = config.input;
|
var bitstream = config.input;
|
||||||
|
|
||||||
if (!decoder.WebPInitDecoderConfig(config)) {
|
if (!decoder.WebPInitDecoderConfig(config)) {
|
||||||
@ -495,10 +482,11 @@ function versionCompare (ver1, ver2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// console.log('[webpjs] status code', decoder.VP8StatusCode);
|
// console.log('[webpjs] status code', decoder.VP8StatusCode);
|
||||||
|
var StatusCode = decoder.VP8StatusCode;
|
||||||
|
|
||||||
status = decoder.WebPGetFeatures(data, data.length, bitstream);
|
status = decoder.WebPGetFeatures(data, data.length, bitstream);
|
||||||
if (status != 0) {
|
if (status != (StatusCode.VP8_STATUS_OK || 0)) {
|
||||||
console.error('[webpjs] status error', status);
|
console.error('[webpjs] status error', status, StatusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
var mode = decoder.WEBP_CSP_MODE;
|
var mode = decoder.WEBP_CSP_MODE;
|
||||||
|
@ -3792,25 +3792,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
return FileManager.getByteArray(blob).then(function (bytes) {
|
return FileManager.getByteArray(blob).then(function (bytes) {
|
||||||
var deferred = $q.defer();
|
return {
|
||||||
var freader = new FileReader();
|
id: doc.id,
|
||||||
freader.onload = function (evt) {
|
src: WebpManager.getPngUrlFromData(bytes)
|
||||||
return {
|
|
||||||
id: doc.id,
|
|
||||||
src: WebpManager.getPngUrlFromData(evt.target.result)
|
|
||||||
};
|
|
||||||
// WebPDecodeAndDraw(evt.target.result)
|
|
||||||
};
|
};
|
||||||
freader.readAsBinaryString(bytes);
|
|
||||||
|
|
||||||
return deferred.promise;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// id: doc.id,
|
|
||||||
// src: WebpManager.getPngUrlFromData(bytes)
|
|
||||||
// };
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
4079
app/vendor/libwebpjs/libwebp-0.2.0.js
vendored
Normal file
4079
app/vendor/libwebpjs/libwebp-0.2.0.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
|
|
||||||
# 63
|
# 61
|
||||||
|
|
||||||
NETWORK:
|
NETWORK:
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user