mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-01 15:50:27 +02:00
Reformat the code, using:
find -type f | # list all regular files grep -E '\.(h|cpp|mm)$' | # filter for source files grep -v '/mt_' | # filter out generated files grep -v '/vendor/' | # and vendored GL grep -v '/test/image_loader_test.cpp' | # and this file (has giant literals arrays) xargs -n 1 -P $(nproc) clang-format -i # reformat everything Co-authored-by: numzero <numzer0@yandex.ru>
This commit is contained in:
@ -4,55 +4,47 @@
|
||||
|
||||
#include "CGUIImageList.h"
|
||||
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace gui
|
||||
{
|
||||
|
||||
//! constructor
|
||||
CGUIImageList::CGUIImageList( video::IVideoDriver* driver )
|
||||
: Driver( driver ),
|
||||
Texture( 0 ),
|
||||
ImageCount( 0 ),
|
||||
ImageSize( 0, 0 ),
|
||||
ImagesPerRow( 0 ),
|
||||
UseAlphaChannel( false )
|
||||
CGUIImageList::CGUIImageList(video::IVideoDriver *driver) :
|
||||
Driver(driver),
|
||||
Texture(0),
|
||||
ImageCount(0),
|
||||
ImageSize(0, 0),
|
||||
ImagesPerRow(0),
|
||||
UseAlphaChannel(false)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName( "CGUIImageList" );
|
||||
#endif
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CGUIImageList");
|
||||
#endif
|
||||
|
||||
if( Driver )
|
||||
{
|
||||
if (Driver) {
|
||||
Driver->grab();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! destructor
|
||||
CGUIImageList::~CGUIImageList()
|
||||
{
|
||||
if( Driver )
|
||||
{
|
||||
if (Driver) {
|
||||
Driver->drop();
|
||||
}
|
||||
|
||||
if( Texture )
|
||||
{
|
||||
if (Texture) {
|
||||
Texture->drop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! Creates the image list from texture.
|
||||
bool CGUIImageList::createImageList(video::ITexture* texture,
|
||||
core::dimension2d<s32> imageSize,
|
||||
bool useAlphaChannel)
|
||||
bool CGUIImageList::createImageList(video::ITexture *texture,
|
||||
core::dimension2d<s32> imageSize,
|
||||
bool useAlphaChannel)
|
||||
{
|
||||
if( !texture )
|
||||
{
|
||||
if (!texture) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -70,23 +62,22 @@ bool CGUIImageList::createImageList(video::ITexture* texture,
|
||||
}
|
||||
|
||||
//! Draws an image and clips it to the specified rectangle if wanted
|
||||
void CGUIImageList::draw( s32 index, const core::position2d<s32>& destPos,
|
||||
const core::rect<s32>* clip /*= 0*/ )
|
||||
void CGUIImageList::draw(s32 index, const core::position2d<s32> &destPos,
|
||||
const core::rect<s32> *clip /*= 0*/)
|
||||
{
|
||||
core::rect<s32> sourceRect;
|
||||
|
||||
if( !Driver || index < 0 || index >= ImageCount )
|
||||
{
|
||||
if (!Driver || index < 0 || index >= ImageCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
sourceRect.UpperLeftCorner.X = ( index % ImagesPerRow ) * ImageSize.Width;
|
||||
sourceRect.UpperLeftCorner.Y = ( index / ImagesPerRow ) * ImageSize.Height;
|
||||
sourceRect.UpperLeftCorner.X = (index % ImagesPerRow) * ImageSize.Width;
|
||||
sourceRect.UpperLeftCorner.Y = (index / ImagesPerRow) * ImageSize.Height;
|
||||
sourceRect.LowerRightCorner.X = sourceRect.UpperLeftCorner.X + ImageSize.Width;
|
||||
sourceRect.LowerRightCorner.Y = sourceRect.UpperLeftCorner.Y + ImageSize.Height;
|
||||
|
||||
Driver->draw2DImage( Texture, destPos, sourceRect, clip,
|
||||
video::SColor( 255, 255, 255, 255 ), UseAlphaChannel );
|
||||
Driver->draw2DImage(Texture, destPos, sourceRect, clip,
|
||||
video::SColor(255, 255, 255, 255), UseAlphaChannel);
|
||||
}
|
||||
|
||||
} // end namespace gui
|
||||
|
Reference in New Issue
Block a user