1
0
Fork 0

Compare commits

..

No commits in common. "01728177e7bf1f4b0131ad7eccd2fa76abc6d641" and "c059ce0c97b653914e94808ef2e2a8c9e0ff75ad" have entirely different histories.

11 changed files with 19 additions and 14 deletions

View File

@ -48,6 +48,7 @@ public:
Blitter::PaletteAnimation UsePaletteAnimation() override;
const char *GetName() override { return "32bpp-anim"; }
int GetBytesPerPixel() override { return 6; }
void PostResize() override;
/**

View File

@ -30,6 +30,7 @@ public:
size_t BufferSize(uint width, uint height) override;
void PaletteAnimate(const Palette &palette) override;
Blitter::PaletteAnimation UsePaletteAnimation() override;
int GetBytesPerPixel() override { return 4; }
/**
* Look up the colour in the current palette.

View File

@ -33,6 +33,7 @@ public:
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);

View File

@ -28,6 +28,7 @@ public:
size_t BufferSize(uint width, uint height) override;
void PaletteAnimate(const Palette &palette) override;
Blitter::PaletteAnimation UsePaletteAnimation() override;
int GetBytesPerPixel() override { return 1; }
};
#endif /* BLITTER_8BPP_BASE_HPP */

View File

@ -198,6 +198,11 @@ public:
*/
virtual const char *GetName() = 0;
/**
* Get how many bytes are needed to store a pixel.
*/
virtual int GetBytesPerPixel() = 0;
/**
* Post resize event
*/

View File

@ -32,6 +32,7 @@ public:
Blitter::PaletteAnimation UsePaletteAnimation() override { return Blitter::PALETTE_ANIMATION_NONE; };
const char *GetName() override { return "null"; }
int GetBytesPerPixel() override { return 0; }
};
/** Factory for the blitter that does nothing. */

View File

@ -363,6 +363,7 @@ protected:
if (this->num_on_x_axis == 0) return;
assert(this->num_on_x_axis > 0);
assert(this->num_dataset > 0);
/* draw text strings on the y axis */
int64_t y_label = interval.highest;
@ -922,8 +923,6 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
return;
}
size->height = FONT_HEIGHT_SMALL + WidgetDimensions::scaled.framerect.Vertical();
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
SetDParam(0, cs->name);
Dimension d = GetStringBoundingBox(STR_GRAPH_CARGO_PAYMENT_CARGO);
@ -1078,7 +1077,7 @@ static const NWidgetPart _nested_cargo_payment_rates_widgets[] = {
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CPR_DISABLE_CARGOES), SetDataTip(STR_GRAPH_CARGO_DISABLE_ALL, STR_GRAPH_CARGO_TOOLTIP_DISABLE_ALL), SetFill(1, 0),
NWidget(NWID_SPACER), SetMinimalSize(0, 4),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_MATRIX, COLOUR_BROWN, WID_CPR_MATRIX), SetFill(1, 0), SetResize(0, 2), SetMatrixDataTip(1, 0, STR_GRAPH_CARGO_PAYMENT_TOGGLE_CARGO), SetScrollbar(WID_CPR_MATRIX_SCROLLBAR),
NWidget(WWT_MATRIX, COLOUR_BROWN, WID_CPR_MATRIX), SetResize(0, 2), SetMatrixDataTip(1, 0, STR_GRAPH_CARGO_PAYMENT_TOGGLE_CARGO), SetScrollbar(WID_CPR_MATRIX_SCROLLBAR),
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_CPR_MATRIX_SCROLLBAR),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 24), SetFill(0, 1),

View File

@ -533,7 +533,6 @@ STR_ABOUT_MENU_ABOUT_OPENTTD :About 'OpenTTD'
STR_ABOUT_MENU_SPRITE_ALIGNER :Sprite aligner
STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES :Toggle bounding boxes
STR_ABOUT_MENU_TOGGLE_DIRTY_BLOCKS :Toggle coloring of dirty blocks
STR_ABOUT_MENU_TOGGLE_WIDGET_OUTLINES :Toggle widget outlines
# Place in highscore window
###length 15
@ -3384,7 +3383,6 @@ STR_SAVE_PRESET_SAVE :{BLACK}Save
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}Save the preset to the current selected name
# NewGRF parameters window
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}Change base graphics parameters
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}Change NewGRF parameters
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}Close
STR_NEWGRF_PARAMETERS_RESET :{BLACK}Reset
@ -5189,7 +5187,6 @@ STR_ERROR_CAN_T_TIMETABLE_VEHICLE :{WHITE}Can't ti
STR_ERROR_TIMETABLE_ONLY_WAIT_AT_STATIONS :{WHITE}Vehicles can only wait at stations
STR_ERROR_TIMETABLE_NOT_STOPPING_HERE :{WHITE}This vehicle is not stopping at this station
STR_ERROR_TIMETABLE_INCOMPLETE :{WHITE}... timetable is incomplete
STR_ERROR_TIMETABLE_NOT_STARTED :{WHITE}... timetable has not started yet
# Sign related errors
STR_ERROR_TOO_MANY_SIGNS :{WHITE}... too many signs

View File

@ -3385,7 +3385,6 @@ STR_SAVE_PRESET_SAVE :{BLACK}Sauvegar
STR_SAVE_PRESET_SAVE_TOOLTIP :{BLACK}Sauvegarder la présélection sous le nom actuellement sélectionné
# NewGRF parameters window
STR_BASEGRF_PARAMETERS_CAPTION :{WHITE}Modifier les paramètres des graphiques de base
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}Modifier les paramètres NewGRF
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}Fermer
STR_NEWGRF_PARAMETERS_RESET :{BLACK}Réinitialiser
@ -5190,7 +5189,6 @@ STR_ERROR_CAN_T_TIMETABLE_VEHICLE :{WHITE}Impossib
STR_ERROR_TIMETABLE_ONLY_WAIT_AT_STATIONS :{WHITE}Les véhicules ne peuvent attendre qu'aux stations
STR_ERROR_TIMETABLE_NOT_STOPPING_HERE :{WHITE}Ce véhicule ne s'arrête pas à cette station
STR_ERROR_TIMETABLE_INCOMPLETE :{WHITE}... l'horaire est incomplet
STR_ERROR_TIMETABLE_NOT_STARTED :{WHITE}... cet horaire n'a pas encore démarré
# Sign related errors
STR_ERROR_TOO_MANY_SIGNS :{WHITE}... trop de panneaux

View File

@ -501,8 +501,7 @@ NWidgetBase *MakeCargoesLegendLinkGraphGUI(int *biggest_index)
spc->SetResize(0, 0);
col->Add(spc);
}
/* If there are no cargo specs defined, then col won't have been created so don't add it. */
if (col != nullptr) panel->Add(col);
panel->Add(col);
*biggest_index = WID_LGL_CARGO_LAST;
return panel;
}

View File

@ -58,7 +58,7 @@ static std::chrono::steady_clock::time_point _chatmessage_dirty_time;
* the left and pixels from the bottom. The height is the maximum height.
*/
static PointDimension _chatmsg_box;
static ReusableBuffer<uint8_t> _chatmessage_backup; ///< Backup in case text is moved.
static uint8_t *_chatmessage_backup = nullptr; ///< Backup in case text is moved.
/**
* Test if there are any chat messages to display.
@ -103,6 +103,7 @@ void NetworkReInitChatBoxSize()
{
_chatmsg_box.y = 3 * FONT_HEIGHT_NORMAL;
_chatmsg_box.height = MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + ScaleGUITrad(NETWORK_CHAT_LINE_SPACING)) + ScaleGUITrad(4);
_chatmessage_backup = ReallocT(_chatmessage_backup, static_cast<size_t>(_chatmsg_box.width) * _chatmsg_box.height * BlitterFactory::GetCurrentBlitter()->GetBytesPerPixel());
}
/** Initialize all buffers of the chat visualisation. */
@ -155,7 +156,7 @@ void NetworkUndrawChatMessage()
_chatmessage_visible = false;
/* Put our 'shot' back to the screen */
blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup.GetBuffer(), width, height);
blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup, width, height);
/* And make sure it is updated next time */
VideoDriver::GetInstance()->MakeDirty(x, y, width, height);
@ -207,9 +208,10 @@ void NetworkDrawChatMessage()
}
if (width <= 0 || height <= 0) return;
assert(blitter->BufferSize(width, height) <= static_cast<size_t>(_chatmsg_box.width) * _chatmsg_box.height * blitter->GetBytesPerPixel());
/* Make a copy of the screen as it is before painting (for undraw) */
uint8_t *buffer = _chatmessage_backup.Allocate(BlitterFactory::GetCurrentBlitter()->BufferSize(width, height));
blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), buffer, width, height);
blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup, width, height);
_cur_dpi = &_screen; // switch to _screen painting