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

Method updateBlendFunc

core/2d/Sprite.cpp:1676–1695  ·  view source on GitHub ↗

MARK: Texture protocol

Source from the content-addressed store, hash-verified

1674
1675// MARK: Texture protocol
1676void Sprite::updateBlendFunc()
1677{
1678 AXASSERT(_renderMode != RenderMode::QUAD_BATCHNODE,
1679 "CCSprite: updateBlendFunc doesn't work when the sprite is rendered using a SpriteBatchNode");
1680
1681 // it is possible to have an untextured sprite
1682 backend::BlendDescriptor& blendDescriptor = _trianglesCommand.getPipelineDescriptor().blendDescriptor;
1683 blendDescriptor.blendEnabled = true;
1684
1685 if (!_texture || !_texture->hasPremultipliedAlpha())
1686 {
1687 _blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
1688 setOpacityModifyRGB(false);
1689 }
1690 else
1691 {
1692 _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
1693 setOpacityModifyRGB(true);
1694 }
1695}
1696
1697std::string Sprite::getDescription() const
1698{

Callers

nothing calls this directly

Calls 2

setOpacityModifyRGBFunction · 0.85
hasPremultipliedAlphaMethod · 0.80

Tested by

no test coverage detected