Merge tag '1.11.0-beta2' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # .github/workflows/release.yml # CMakeLists.txt # src/blitter/32bpp_optimized.cpp # src/debug.cpp # src/gfx.cpp # src/gfx_func.h # src/lang/czech.txt # src/lang/english.txt # src/lang/italian.txt # src/lang/swedish.txt # src/lang/ukrainian.txt # src/network/network_server.cpp # src/os/windows/crashlog_win.cpp # src/os/windows/win32.cpp # src/pathfinder/follow_track.hpp # src/screenshot.cpp # src/settings_type.h # src/spritecache.cpp # src/vehicle_gui.cpp # src/video/sdl2_v.cpp # src/video/video_driver.cpp # src/video/video_driver.hpp # src/video/win32_v.cpp
This commit is contained in:
66
src/blitter/40bpp_anim.hpp
Normal file
66
src/blitter/40bpp_anim.hpp
Normal file
@@ -0,0 +1,66 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 40bpp_optimized.hpp Optimized 40 bpp blitter. */
|
||||
|
||||
#ifndef BLITTER_40BPP_OPTIMIZED_HPP
|
||||
#define BLITTER_40BPP_OPTIMIZED_HPP
|
||||
|
||||
|
||||
#include "32bpp_optimized.hpp"
|
||||
#include "../video/video_driver.hpp"
|
||||
|
||||
/** The optimized 40 bpp blitter (for OpenGL video driver). */
|
||||
class Blitter_40bppAnim : public Blitter_32bppOptimized {
|
||||
public:
|
||||
|
||||
// void *MoveTo(void *video, int x, int y) override;
|
||||
void SetPixel(void *video, int x, int y, uint8 colour) override;
|
||||
void SetRect(void *video, int x, int y, const uint8 *colours, uint lines, uint width, uint pitch) override;
|
||||
void SetRect32(void *video, int x, int y, const uint32 *colours, uint lines, uint width, uint pitch) override;
|
||||
void DrawRect(void *video, int width, int height, uint8 colour) override;
|
||||
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override;
|
||||
void CopyFromBuffer(void *video, const void *src, int width, int height) override;
|
||||
void CopyToBuffer(const void *video, void *dst, int width, int height) override;
|
||||
void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override;
|
||||
void ScrollBuffer(void *video, int left, int top, int width, int height, int scroll_x, int scroll_y) override;
|
||||
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
|
||||
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
|
||||
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
|
||||
int BufferSize(int width, int height) override;
|
||||
Blitter::PaletteAnimation UsePaletteAnimation() override;
|
||||
bool NeedsAnimationBuffer() override;
|
||||
|
||||
const char *GetName() override { return "40bpp-anim"; }
|
||||
int GetBytesPerPixel() override { return 5; }
|
||||
|
||||
template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||
|
||||
protected:
|
||||
static inline Colour RealizeBlendedColour(uint8 anim, Colour c)
|
||||
{
|
||||
return anim != 0 ? AdjustBrightness(LookupColourInPalette(anim), GetColourBrightness(c)) : c;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/** Factory for the 40 bpp animated blitter (for OpenGL). */
|
||||
class FBlitter_40bppAnim : public BlitterFactory {
|
||||
protected:
|
||||
bool IsUsable() const override
|
||||
{
|
||||
return VideoDriver::GetInstance() == nullptr || VideoDriver::GetInstance()->HasAnimBuffer();
|
||||
}
|
||||
|
||||
public:
|
||||
FBlitter_40bppAnim() : BlitterFactory("40bpp-anim", "40bpp Animation Blitter (OpenGL)") {}
|
||||
Blitter *CreateInstance() override { return new Blitter_40bppAnim(); }
|
||||
};
|
||||
|
||||
#endif /* BLITTER_40BPP_OPTIMIZED_HPP */
|
||||
Reference in New Issue
Block a user