LCOV - code coverage report
Current view: top level - source/gui - CGUISprite.cpp (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 19 0.0 %
Date: 2023-01-19 00:18:29 Functions: 0 5 0.0 %

          Line data    Source code
       1             : /* Copyright (C) 2021 Wildfire Games.
       2             :  * This file is part of 0 A.D.
       3             :  *
       4             :  * 0 A.D. is free software: you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation, either version 2 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * 0 A.D. is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  * GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License
      15             :  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
      16             :  */
      17             : 
      18             : #include "precompiled.h"
      19             : 
      20             : #include "CGUISprite.h"
      21             : 
      22             : CGUISprite::~CGUISprite() = default;
      23             : 
      24           0 : void CGUISprite::AddImage(std::unique_ptr<SGUIImage> image)
      25             : {
      26           0 :     m_Images.emplace_back(std::move(image));
      27           0 : }
      28             : 
      29           0 : void CGUISpriteInstance::Draw(CGUI& pGUI, CCanvas2D& canvas, const CRect& Size, std::map<CStr, std::unique_ptr<const CGUISprite>>& Sprites) const
      30             : {
      31           0 :     if (m_CachedSize != Size)
      32             :     {
      33           0 :         GUIRenderer::UpdateDrawCallCache(pGUI, m_DrawCallCache, m_SpriteName, Size, Sprites);
      34           0 :         m_CachedSize = Size;
      35             :     }
      36           0 :     GUIRenderer::Draw(m_DrawCallCache, canvas);
      37           0 : }
      38             : 
      39             : // Plus a load of constructors / assignment operators, which don't copy the
      40             : // DrawCall cache (to avoid losing track of who has allocated various bits
      41             : // of data):
      42             : 
      43           0 : CGUISpriteInstance::CGUISpriteInstance()
      44             : {
      45           0 : }
      46             : 
      47           0 : CGUISpriteInstance::CGUISpriteInstance(const CStr& SpriteName)
      48           0 :     : m_SpriteName(SpriteName)
      49             : {
      50           0 : }
      51             : 
      52           0 : void CGUISpriteInstance::SetName(const CStr& SpriteName)
      53             : {
      54           0 :     m_SpriteName = SpriteName;
      55           0 :     m_CachedSize = CRect();
      56           0 :     m_DrawCallCache.clear();
      57           0 : }

Generated by: LCOV version 1.13