mirror of https://github.com/axmolengine/axmol.git
commit
3f0a5ab945
|
@ -572,6 +572,11 @@ bool CCImage::initWithImageData(void * pData,
|
|||
bRet = _initWithTiffData(pData, nDataLen);
|
||||
break;
|
||||
}
|
||||
else if (kFmtWebp == eFmt)
|
||||
{
|
||||
bRet = _initWithWebpData(pData, nDataLen);
|
||||
break;
|
||||
}
|
||||
else if (kFmtRawData == eFmt)
|
||||
{
|
||||
bRet = _initWithRawData(pData, nDataLen, nWidth, nHeight, nBitsPerComponent);
|
||||
|
|
|
@ -33,5 +33,5 @@ files
|
|||
|
||||
["headers"]
|
||||
("libwebp/webp")
|
||||
|
||||
"*.h"
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
//
|
||||
// Author: Christian Duvivier (cduvivier@google.com)
|
||||
|
||||
#include "platform/CCPlatformConfig.h"
|
||||
|
||||
#include "./dsp.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
|
@ -33,7 +35,7 @@ static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) {
|
|||
: "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
|
||||
: "a"(info_type));
|
||||
}
|
||||
#elif defined(__i386__) || defined(__x86_64__)
|
||||
#elif (defined(__i386__) || defined(__x86_64__) ) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) {
|
||||
__asm__ volatile (
|
||||
"cpuid\n"
|
||||
|
@ -44,7 +46,7 @@ static WEBP_INLINE void GetCPUInfo(int cpu_info[4], int info_type) {
|
|||
#define GetCPUInfo __cpuid
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(WEBP_MSC_SSE2)
|
||||
#if (defined(__i386__) || defined(__x86_64__) || defined(WEBP_MSC_SSE2)) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
static int x86CPUInfo(CPUFeature feature) {
|
||||
int cpu_info[4];
|
||||
GetCPUInfo(cpu_info, 1);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#ifndef WEBP_DSP_DSP_H_
|
||||
#define WEBP_DSP_DSP_H_
|
||||
|
||||
#include "platform/CCPlatformConfig.h"
|
||||
|
||||
#include "../webp/types.h"
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
|
@ -21,11 +23,11 @@ extern "C" {
|
|||
//------------------------------------------------------------------------------
|
||||
// CPU detection
|
||||
|
||||
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
|
||||
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
#define WEBP_MSC_SSE2 // Visual C++ SSE2 targets
|
||||
#endif
|
||||
|
||||
#if defined(__SSE2__) || defined(WEBP_MSC_SSE2)
|
||||
#if (defined(__SSE2__) || defined(WEBP_MSC_SSE2)) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
#define WEBP_USE_SSE2
|
||||
#endif
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
// Jyrki Alakuijala (jyrki@google.com)
|
||||
// Urvang Joshi (urvang@google.com)
|
||||
|
||||
#include "platform/CCPlatformConfig.h"
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -1066,11 +1068,11 @@ static void CopyOrSwap(const uint32_t* src, int num_pixels, uint8_t* dst,
|
|||
const uint32_t* const src_end = src + num_pixels;
|
||||
while (src < src_end) {
|
||||
uint32_t argb = *src++;
|
||||
#if !defined(__BIG_ENDIAN__) && (defined(__i386__) || defined(__x86_64__))
|
||||
#if (!defined(__BIG_ENDIAN__) && (defined(__i386__) || defined(__x86_64__))) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
__asm__ volatile("bswap %0" : "=r"(argb) : "0"(argb));
|
||||
*(uint32_t*)dst = argb;
|
||||
dst += sizeof(argb);
|
||||
#elif !defined(__BIG_ENDIAN__) && defined(_MSC_VER)
|
||||
#elif (!defined(__BIG_ENDIAN__) && defined(_MSC_VER)) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
argb = _byteswap_ulong(argb);
|
||||
*(uint32_t*)dst = argb;
|
||||
dst += sizeof(argb);
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#ifndef WEBP_ENC_BACKWARD_REFERENCES_H_
|
||||
#define WEBP_ENC_BACKWARD_REFERENCES_H_
|
||||
|
||||
#include "platform/CCPlatformConfig.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include "../webp/types.h"
|
||||
|
@ -37,7 +39,7 @@ extern "C" {
|
|||
static WEBP_INLINE int BitsLog2Floor(uint32_t n) {
|
||||
return n == 0 ? -1 : 31 ^ __builtin_clz(n);
|
||||
}
|
||||
#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
|
||||
#elif (defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
#include <intrin.h>
|
||||
#pragma intrinsic(_BitScanReverse)
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#ifndef WEBP_UTILS_BIT_READER_H_
|
||||
#define WEBP_UTILS_BIT_READER_H_
|
||||
|
||||
#include "platform/CCPlatformConfig.h"
|
||||
|
||||
#include <assert.h>
|
||||
#ifdef _MSC_VER
|
||||
#include <stdlib.h> // _byteswap_ulong
|
||||
|
@ -81,10 +83,10 @@ static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) {
|
|||
br->buf_ += (BITS) >> 3;
|
||||
#if !defined(__BIG_ENDIAN__)
|
||||
#if (BITS == 32)
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#if (defined(__i386__) || defined(__x86_64__) ) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
__asm__ volatile("bswap %k0" : "=r"(in_bits) : "0"(in_bits));
|
||||
bits = (bit_t)in_bits; // 32b -> 64b zero-extension
|
||||
#elif defined(_MSC_VER)
|
||||
#elif defined(_MSC_VER) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
|
||||
bits = _byteswap_ulong(in_bits);
|
||||
#else
|
||||
bits = (bit_t)(in_bits >> 24) | ((in_bits >> 8) & 0xff00)
|
||||
|
|
Loading…
Reference in New Issue