| 28 | } |
| 29 | |
| 30 | bool VGNode::init() { |
| 31 | if (!Node::init()) return false; |
| 32 | NVGcontext* context = nvgCreate(_edgeAA, 0); |
| 33 | NVGLUframebuffer* framebuffer = nvgluCreateFramebuffer(context, |
| 34 | s_cast<int>(_frameWidth * _frameScale), |
| 35 | s_cast<int>(_frameHeight * _frameScale), 0); |
| 36 | bgfx::TextureInfo info; |
| 37 | bgfx::calcTextureSize(info, |
| 38 | s_cast<uint16_t>(_frameWidth * _frameScale), |
| 39 | s_cast<uint16_t>(_frameHeight * _frameScale), |
| 40 | 0, false, false, 1, bgfx::TextureFormat::RGBA8); |
| 41 | uint64_t flags = BGFX_TEXTURE_RT | BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP; |
| 42 | _surface = Sprite::create(VGTexture::create(context, framebuffer, info, flags)); |
| 43 | _surface->addTo(this); |
| 44 | return true; |
| 45 | } |
| 46 | |
| 47 | void VGNode::cleanup() { |
| 48 | if (_flags.isOff(Node::Cleanup)) { |
nothing calls this directly
no test coverage detected