2016-12-05 08:22:45 +00:00
|
|
|
/*
|
|
|
|
** Drawer commands for the RT family of drawers
|
|
|
|
** Copyright (c) 2016 Magnus Norddahl
|
|
|
|
**
|
|
|
|
** This software is provided 'as-is', without any express or implied
|
|
|
|
** warranty. In no event will the authors be held liable for any damages
|
|
|
|
** arising from the use of this software.
|
|
|
|
**
|
|
|
|
** Permission is granted to anyone to use this software for any purpose,
|
|
|
|
** including commercial applications, and to alter it and redistribute it
|
|
|
|
** freely, subject to the following restrictions:
|
|
|
|
**
|
|
|
|
** 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
** claim that you wrote the original software. If you use this software
|
|
|
|
** in a product, an acknowledgment in the product documentation would be
|
|
|
|
** appreciated but is not required.
|
|
|
|
** 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
** misrepresented as being the original software.
|
|
|
|
** 3. This notice may not be removed or altered from any source distribution.
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2016-06-13 21:10:54 +00:00
|
|
|
|
|
|
|
#include "r_draw.h"
|
2016-06-14 21:05:20 +00:00
|
|
|
#include "v_palette.h"
|
2016-10-07 02:01:38 +00:00
|
|
|
#include "r_thread.h"
|
2017-02-02 14:10:06 +00:00
|
|
|
#include "swrenderer/viewport/r_skydrawer.h"
|
|
|
|
#include "swrenderer/viewport/r_spandrawer.h"
|
|
|
|
#include "swrenderer/viewport/r_walldrawer.h"
|
|
|
|
#include "swrenderer/viewport/r_spritedrawer.h"
|
2016-06-13 21:10:54 +00:00
|
|
|
|
2017-01-10 12:39:57 +00:00
|
|
|
#ifdef __arm__
|
|
|
|
#define NO_SSE
|
|
|
|
#endif
|
|
|
|
|
2016-06-30 11:45:06 +00:00
|
|
|
#ifndef NO_SSE
|
|
|
|
#include <immintrin.h>
|
|
|
|
#endif
|
|
|
|
|
2016-10-07 02:01:38 +00:00
|
|
|
struct FSpecialColormap;
|
|
|
|
|
|
|
|
EXTERN_CVAR(Bool, r_mipmap)
|
2016-11-05 15:12:59 +00:00
|
|
|
EXTERN_CVAR(Float, r_lod_bias)
|
2016-10-07 02:01:38 +00:00
|
|
|
|
2016-12-22 04:20:53 +00:00
|
|
|
namespace swrenderer
|
2016-12-01 01:38:32 +00:00
|
|
|
{
|
2016-12-05 08:22:45 +00:00
|
|
|
// Give the compiler a strong hint we want these functions inlined:
|
|
|
|
#ifndef FORCEINLINE
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define FORCEINLINE __forceinline
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
#define FORCEINLINE __attribute__((always_inline)) inline
|
|
|
|
#else
|
|
|
|
#define FORCEINLINE inline
|
|
|
|
#endif
|
|
|
|
#endif
|
2016-12-01 01:38:32 +00:00
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
// Promise compiler we have no aliasing of this pointer
|
|
|
|
#ifndef RESTRICT
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define RESTRICT __restrict
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
#define RESTRICT __restrict__
|
|
|
|
#else
|
|
|
|
#define RESTRICT
|
|
|
|
#endif
|
|
|
|
#endif
|
2016-06-13 21:10:54 +00:00
|
|
|
|
2017-02-25 00:22:54 +00:00
|
|
|
// Force the compiler to use a calling convention that works for vector types
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define VECTORCALL __vectorcall
|
|
|
|
#else
|
|
|
|
#define VECTORCALL
|
|
|
|
#endif
|
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
class DrawFuzzColumnRGBACommand : public DrawerCommand
|
|
|
|
{
|
|
|
|
int _x;
|
|
|
|
int _yl;
|
|
|
|
int _yh;
|
|
|
|
uint8_t * RESTRICT _destorg;
|
|
|
|
int _pitch;
|
|
|
|
int _fuzzpos;
|
|
|
|
int _fuzzviewheight;
|
|
|
|
|
|
|
|
public:
|
2017-01-30 10:27:58 +00:00
|
|
|
DrawFuzzColumnRGBACommand(const SpriteDrawerArgs &drawerargs);
|
2016-12-05 08:22:45 +00:00
|
|
|
void Execute(DrawerThread *thread) override;
|
|
|
|
FString DebugInfo() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class FillSpanRGBACommand : public DrawerCommand
|
|
|
|
{
|
|
|
|
int _x1;
|
|
|
|
int _x2;
|
|
|
|
int _y;
|
2017-02-01 21:24:34 +00:00
|
|
|
uint8_t * RESTRICT _dest;
|
2016-12-05 08:22:45 +00:00
|
|
|
fixed_t _light;
|
|
|
|
int _color;
|
|
|
|
|
|
|
|
public:
|
2017-01-29 09:05:37 +00:00
|
|
|
FillSpanRGBACommand(const SpanDrawerArgs &drawerargs);
|
2016-12-05 08:22:45 +00:00
|
|
|
void Execute(DrawerThread *thread) override;
|
|
|
|
FString DebugInfo() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DrawFogBoundaryLineRGBACommand : public DrawerCommand
|
|
|
|
{
|
|
|
|
int _y;
|
|
|
|
int _x;
|
|
|
|
int _x2;
|
2017-02-01 21:24:34 +00:00
|
|
|
uint8_t * RESTRICT _line;
|
2016-12-05 08:22:45 +00:00
|
|
|
fixed_t _light;
|
|
|
|
ShadeConstants _shade_constants;
|
|
|
|
|
|
|
|
public:
|
2017-03-12 17:54:39 +00:00
|
|
|
DrawFogBoundaryLineRGBACommand(const SpanDrawerArgs &drawerargs);
|
2016-12-05 08:22:45 +00:00
|
|
|
void Execute(DrawerThread *thread) override;
|
|
|
|
FString DebugInfo() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DrawTiltedSpanRGBACommand : public DrawerCommand
|
2016-06-24 09:37:51 +00:00
|
|
|
{
|
2016-12-05 08:22:45 +00:00
|
|
|
int _x1;
|
|
|
|
int _x2;
|
|
|
|
int _y;
|
2017-02-01 21:24:34 +00:00
|
|
|
uint8_t * RESTRICT _dest;
|
2016-12-05 08:22:45 +00:00
|
|
|
fixed_t _light;
|
|
|
|
ShadeConstants _shade_constants;
|
|
|
|
FVector3 _plane_sz;
|
|
|
|
FVector3 _plane_su;
|
|
|
|
FVector3 _plane_sv;
|
|
|
|
bool _plane_shade;
|
|
|
|
int _planeshade;
|
|
|
|
float _planelightfloat;
|
|
|
|
fixed_t _pviewx;
|
|
|
|
fixed_t _pviewy;
|
|
|
|
int _xbits;
|
|
|
|
int _ybits;
|
|
|
|
const uint32_t * RESTRICT _source;
|
2017-03-12 17:54:39 +00:00
|
|
|
RenderViewport *viewport;
|
2016-12-05 08:22:45 +00:00
|
|
|
|
|
|
|
public:
|
2017-03-12 17:54:39 +00:00
|
|
|
DrawTiltedSpanRGBACommand(const SpanDrawerArgs &drawerargs, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy);
|
2016-12-05 08:22:45 +00:00
|
|
|
void Execute(DrawerThread *thread) override;
|
|
|
|
FString DebugInfo() override;
|
|
|
|
};
|
2016-06-14 21:05:20 +00:00
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
class DrawColoredSpanRGBACommand : public DrawerCommand
|
2016-06-14 21:05:20 +00:00
|
|
|
{
|
2016-12-05 08:22:45 +00:00
|
|
|
int _y;
|
|
|
|
int _x1;
|
|
|
|
int _x2;
|
2017-02-01 21:24:34 +00:00
|
|
|
uint8_t * RESTRICT _dest;
|
2016-12-05 08:22:45 +00:00
|
|
|
fixed_t _light;
|
|
|
|
int _color;
|
2016-06-24 09:37:51 +00:00
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
public:
|
2017-03-12 17:54:39 +00:00
|
|
|
DrawColoredSpanRGBACommand(const SpanDrawerArgs &drawerargs);
|
2016-12-05 08:22:45 +00:00
|
|
|
|
|
|
|
void Execute(DrawerThread *thread) override;
|
|
|
|
FString DebugInfo() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ApplySpecialColormapRGBACommand : public DrawerCommand
|
2016-06-14 21:05:20 +00:00
|
|
|
{
|
2016-12-05 08:22:45 +00:00
|
|
|
uint8_t *buffer;
|
|
|
|
int pitch;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int start_red;
|
|
|
|
int start_green;
|
|
|
|
int start_blue;
|
|
|
|
int end_red;
|
|
|
|
int end_green;
|
|
|
|
int end_blue;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ApplySpecialColormapRGBACommand(FSpecialColormap *colormap, DFrameBuffer *screen);
|
|
|
|
void Execute(DrawerThread *thread) override;
|
|
|
|
FString DebugInfo() override { return "ApplySpecialColormapRGBACommand"; }
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename CommandType, typename BlendMode>
|
|
|
|
class DrawerBlendCommand : public CommandType
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void Execute(DrawerThread *thread) override
|
2016-06-24 09:37:51 +00:00
|
|
|
{
|
2016-12-05 08:22:45 +00:00
|
|
|
typename CommandType::LoopIterator loop(this, thread);
|
|
|
|
if (!loop) return;
|
|
|
|
BlendMode blend(*this, loop);
|
|
|
|
do
|
|
|
|
{
|
|
|
|
blend.Blend(*this, loop);
|
|
|
|
} while (loop.next());
|
2016-06-24 09:37:51 +00:00
|
|
|
}
|
2016-12-05 08:22:45 +00:00
|
|
|
};
|
2016-06-14 21:05:20 +00:00
|
|
|
|
2016-12-24 00:50:54 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class DrawParticleColumnRGBACommand : public DrawerCommand
|
|
|
|
{
|
|
|
|
public:
|
2016-12-24 13:45:56 +00:00
|
|
|
DrawParticleColumnRGBACommand(uint32_t *dest, int dest_y, int pitch, int count, uint32_t fg, uint32_t alpha, uint32_t fracposx);
|
2016-12-24 00:50:54 +00:00
|
|
|
void Execute(DrawerThread *thread) override;
|
|
|
|
FString DebugInfo() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint32_t *_dest;
|
2017-01-29 06:49:04 +00:00
|
|
|
int _dest_y;
|
2016-12-24 00:50:54 +00:00
|
|
|
int _pitch;
|
|
|
|
int _count;
|
|
|
|
uint32_t _fg;
|
|
|
|
uint32_t _alpha;
|
2016-12-24 13:45:56 +00:00
|
|
|
uint32_t _fracposx;
|
2016-12-24 00:50:54 +00:00
|
|
|
};
|
|
|
|
|
2016-12-27 07:47:51 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class SWTruecolorDrawers : public SWPixelFormatDrawers
|
|
|
|
{
|
|
|
|
public:
|
2017-02-04 11:38:05 +00:00
|
|
|
using SWPixelFormatDrawers::SWPixelFormatDrawers;
|
|
|
|
|
2017-02-17 21:58:55 +00:00
|
|
|
void DrawWallColumn(const WallDrawerArgs &args) override;
|
2017-02-18 04:34:26 +00:00
|
|
|
void DrawWallMaskedColumn(const WallDrawerArgs &args) override;
|
|
|
|
void DrawWallAddColumn(const WallDrawerArgs &args) override;
|
|
|
|
void DrawWallAddClampColumn(const WallDrawerArgs &args) override;
|
|
|
|
void DrawWallSubClampColumn(const WallDrawerArgs &args) override;
|
|
|
|
void DrawWallRevSubClampColumn(const WallDrawerArgs &args) override;
|
2017-02-21 00:25:08 +00:00
|
|
|
void DrawSingleSkyColumn(const SkyDrawerArgs &args) override;
|
|
|
|
void DrawDoubleSkyColumn(const SkyDrawerArgs &args) override;
|
2017-02-19 00:23:16 +00:00
|
|
|
void DrawColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void FillColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void FillAddColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void FillAddClampColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void FillSubClampColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void FillRevSubClampColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void DrawFuzzColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void DrawAddColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void DrawTranslatedColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void DrawTranslatedAddColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void DrawShadedColumn(const SpriteDrawerArgs &args) override;
|
2017-03-15 18:28:16 +00:00
|
|
|
void DrawAddClampShadedColumn(const SpriteDrawerArgs &args) override;
|
2017-02-19 00:23:16 +00:00
|
|
|
void DrawAddClampColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void DrawAddClampTranslatedColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void DrawSubClampColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void DrawSubClampTranslatedColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void DrawRevSubClampColumn(const SpriteDrawerArgs &args) override;
|
|
|
|
void DrawRevSubClampTranslatedColumn(const SpriteDrawerArgs &args) override;
|
2017-02-20 21:49:52 +00:00
|
|
|
void DrawSpan(const SpanDrawerArgs &args) override;
|
|
|
|
void DrawSpanMasked(const SpanDrawerArgs &args) override;
|
|
|
|
void DrawSpanTranslucent(const SpanDrawerArgs &args) override;
|
|
|
|
void DrawSpanMaskedTranslucent(const SpanDrawerArgs &args) override;
|
|
|
|
void DrawSpanAddClamp(const SpanDrawerArgs &args) override;
|
|
|
|
void DrawSpanMaskedAddClamp(const SpanDrawerArgs &args) override;
|
2017-02-04 11:38:05 +00:00
|
|
|
void FillSpan(const SpanDrawerArgs &args) override { Queue->Push<FillSpanRGBACommand>(args); }
|
2017-01-29 09:05:37 +00:00
|
|
|
|
2017-03-12 17:54:39 +00:00
|
|
|
void DrawTiltedSpan(const SpanDrawerArgs &args, const FVector3 &plane_sz, const FVector3 &plane_su, const FVector3 &plane_sv, bool plane_shade, int planeshade, float planelightfloat, fixed_t pviewx, fixed_t pviewy, FDynamicColormap *basecolormap) override
|
2016-12-27 07:47:51 +00:00
|
|
|
{
|
2017-03-12 17:54:39 +00:00
|
|
|
Queue->Push<DrawTiltedSpanRGBACommand>(args, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy);
|
2016-12-27 07:47:51 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 17:54:39 +00:00
|
|
|
void DrawColoredSpan(const SpanDrawerArgs &args) override { Queue->Push<DrawColoredSpanRGBACommand>(args); }
|
|
|
|
void DrawFogBoundaryLine(const SpanDrawerArgs &args) override { Queue->Push<DrawFogBoundaryLineRGBACommand>(args); }
|
2016-12-27 07:47:51 +00:00
|
|
|
};
|
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Pixel shading inline functions:
|
2016-06-24 09:37:51 +00:00
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
class LightBgra
|
2016-06-14 21:05:20 +00:00
|
|
|
{
|
2016-12-05 08:22:45 +00:00
|
|
|
public:
|
|
|
|
// calculates the light constant passed to the shade_pal_index function
|
|
|
|
FORCEINLINE static uint32_t calc_light_multiplier(dsfixed_t light)
|
2016-06-24 09:37:51 +00:00
|
|
|
{
|
2016-12-05 08:22:45 +00:00
|
|
|
return 256 - (light >> (FRACBITS - 8));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculates a ARGB8 color for the given palette index and light multiplier
|
|
|
|
FORCEINLINE static uint32_t shade_pal_index_simple(uint32_t index, uint32_t light)
|
|
|
|
{
|
|
|
|
const PalEntry &color = GPalette.BaseColors[index];
|
|
|
|
uint32_t red = color.r;
|
|
|
|
uint32_t green = color.g;
|
|
|
|
uint32_t blue = color.b;
|
|
|
|
|
2016-06-24 09:37:51 +00:00
|
|
|
red = red * light / 256;
|
|
|
|
green = green * light / 256;
|
|
|
|
blue = blue * light / 256;
|
2016-12-05 08:22:45 +00:00
|
|
|
|
|
|
|
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
2016-06-24 09:37:51 +00:00
|
|
|
}
|
2016-12-05 08:22:45 +00:00
|
|
|
|
|
|
|
// Calculates a ARGB8 color for the given palette index, light multiplier and dynamic colormap
|
|
|
|
FORCEINLINE static uint32_t shade_pal_index(uint32_t index, uint32_t light, const ShadeConstants &constants)
|
2016-06-24 09:37:51 +00:00
|
|
|
{
|
2016-12-05 08:22:45 +00:00
|
|
|
const PalEntry &color = GPalette.BaseColors[index];
|
|
|
|
uint32_t alpha = color.d & 0xff000000;
|
|
|
|
uint32_t red = color.r;
|
|
|
|
uint32_t green = color.g;
|
|
|
|
uint32_t blue = color.b;
|
|
|
|
if (constants.simple_shade)
|
|
|
|
{
|
|
|
|
red = red * light / 256;
|
|
|
|
green = green * light / 256;
|
|
|
|
blue = blue * light / 256;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
uint32_t inv_light = 256 - light;
|
|
|
|
uint32_t inv_desaturate = 256 - constants.desaturate;
|
2016-06-14 21:05:20 +00:00
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
uint32_t intensity = ((red * 77 + green * 143 + blue * 37) >> 8) * constants.desaturate;
|
2016-06-14 21:05:20 +00:00
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
red = (red * inv_desaturate + intensity) / 256;
|
|
|
|
green = (green * inv_desaturate + intensity) / 256;
|
|
|
|
blue = (blue * inv_desaturate + intensity) / 256;
|
2016-06-14 21:05:20 +00:00
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
red = (constants.fade_red * inv_light + red * light) / 256;
|
|
|
|
green = (constants.fade_green * inv_light + green * light) / 256;
|
|
|
|
blue = (constants.fade_blue * inv_light + blue * light) / 256;
|
2016-06-14 21:05:20 +00:00
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
red = (red * constants.light_red) / 256;
|
|
|
|
green = (green * constants.light_green) / 256;
|
|
|
|
blue = (blue * constants.light_blue) / 256;
|
|
|
|
}
|
|
|
|
return alpha | (red << 16) | (green << 8) | blue;
|
2016-06-24 09:37:51 +00:00
|
|
|
}
|
2016-06-14 21:05:20 +00:00
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
FORCEINLINE static uint32_t shade_bgra_simple(uint32_t color, uint32_t light)
|
|
|
|
{
|
|
|
|
uint32_t red = RPART(color) * light / 256;
|
|
|
|
uint32_t green = GPART(color) * light / 256;
|
|
|
|
uint32_t blue = BPART(color) * light / 256;
|
|
|
|
return 0xff000000 | (red << 16) | (green << 8) | blue;
|
|
|
|
}
|
2016-12-01 01:38:32 +00:00
|
|
|
|
2016-12-05 08:22:45 +00:00
|
|
|
FORCEINLINE static uint32_t shade_bgra(uint32_t color, uint32_t light, const ShadeConstants &constants)
|
|
|
|
{
|
|
|
|
uint32_t alpha = color & 0xff000000;
|
|
|
|
uint32_t red = (color >> 16) & 0xff;
|
|
|
|
uint32_t green = (color >> 8) & 0xff;
|
|
|
|
uint32_t blue = color & 0xff;
|
|
|
|
if (constants.simple_shade)
|
|
|
|
{
|
|
|
|
red = red * light / 256;
|
|
|
|
green = green * light / 256;
|
|
|
|
blue = blue * light / 256;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
uint32_t inv_light = 256 - light;
|
|
|
|
uint32_t inv_desaturate = 256 - constants.desaturate;
|
|
|
|
|
|
|
|
uint32_t intensity = ((red * 77 + green * 143 + blue * 37) >> 8) * constants.desaturate;
|
|
|
|
|
|
|
|
red = (red * inv_desaturate + intensity) / 256;
|
|
|
|
green = (green * inv_desaturate + intensity) / 256;
|
|
|
|
blue = (blue * inv_desaturate + intensity) / 256;
|
|
|
|
|
|
|
|
red = (constants.fade_red * inv_light + red * light) / 256;
|
|
|
|
green = (constants.fade_green * inv_light + green * light) / 256;
|
|
|
|
blue = (constants.fade_blue * inv_light + blue * light) / 256;
|
|
|
|
|
|
|
|
red = (red * constants.light_red) / 256;
|
|
|
|
green = (green * constants.light_green) / 256;
|
|
|
|
blue = (blue * constants.light_blue) / 256;
|
|
|
|
}
|
|
|
|
return alpha | (red << 16) | (green << 8) | blue;
|
|
|
|
}
|
|
|
|
};
|
2017-03-08 22:35:13 +00:00
|
|
|
|
2017-03-17 05:58:36 +00:00
|
|
|
struct BgraColor
|
2017-03-08 22:35:13 +00:00
|
|
|
{
|
2017-03-17 05:58:36 +00:00
|
|
|
uint32_t b, g, r, a;
|
|
|
|
BgraColor() { }
|
|
|
|
BgraColor(uint32_t c) : b(BPART(c)), g(GPART(c)), r(RPART(c)), a(APART(c)) { }
|
|
|
|
BgraColor &operator=(uint32_t c) { b = BPART(c); g = GPART(c); r = RPART(c); a = APART(c); return *this; }
|
|
|
|
operator uint32_t() const { return MAKEARGB(a, r, g, b); }
|
|
|
|
};
|
2016-12-05 08:22:45 +00:00
|
|
|
}
|