MCPcopy Create free account
hub / github.com/axmolengine/axmol / getDevicePVRPixelFormat

Function getDevicePVRPixelFormat

core/platform/Image.cpp:495–534  ·  view source on GitHub ↗

* Notes: PVR file Specification have many pixel formats, cocos2d-x-v2~v4 and axmol only support pvrtc and etc1 * see: https://cdn.imgtec.com/sdk-documentation/PVR+File+Format.Specification.pdf */

Source from the content-addressed store, hash-verified

493 * see: https://cdn.imgtec.com/sdk-documentation/PVR+File+Format.Specification.pdf
494 */
495static backend::PixelFormat getDevicePVRPixelFormat(backend::PixelFormat format)
496{
497 switch (format)
498 {
499 case backend::PixelFormat::PVRTC4:
500 case backend::PixelFormat::PVRTC4A:
501 case backend::PixelFormat::PVRTC2:
502 case backend::PixelFormat::PVRTC2A:
503 if (Configuration::getInstance()->supportsPVRTC())
504 return format;
505 else
506 return backend::PixelFormat::RGBA8;
507 case backend::PixelFormat::ETC1:
508 if (Configuration::getInstance()->supportsETC1())
509 return format;
510 else if (Configuration::getInstance()->supportsETC2())
511 return backend::PixelFormat::ETC2_RGB;
512 else
513 return backend::PixelFormat::RGBA8;
514
515 case backend::PixelFormat::ASTC4x4:
516 case backend::PixelFormat::ASTC5x4:
517 case backend::PixelFormat::ASTC5x5:
518 case backend::PixelFormat::ASTC6x5:
519 case backend::PixelFormat::ASTC6x6:
520 case backend::PixelFormat::ASTC8x5:
521 case backend::PixelFormat::ASTC8x6:
522 case backend::PixelFormat::ASTC8x8:
523 case backend::PixelFormat::ASTC10x5:
524 case backend::PixelFormat::ASTC10x6:
525 case backend::PixelFormat::ASTC10x8:
526 case backend::PixelFormat::ASTC10x10:
527 case backend::PixelFormat::ASTC12x10:
528 case backend::PixelFormat::ASTC12x12:
529 return Configuration::getInstance()->supportsASTC() ? format : backend::PixelFormat::RGBA8;
530
531 default:
532 return format;
533 }
534}
535
536namespace
537{

Callers 2

initWithPVRv2DataMethod · 0.85
initWithPVRv3DataMethod · 0.85

Calls 5

getInstanceFunction · 0.85
supportsPVRTCMethod · 0.80
supportsETC1Method · 0.80
supportsETC2Method · 0.80
supportsASTCMethod · 0.80

Tested by

no test coverage detected