mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
3 Commits
c059ce0c97
...
01728177e7
Author | SHA1 | Date |
---|---|---|
|
01728177e7 | |
|
071fdab236 | |
|
bbd64bbe2b |
|
@ -48,7 +48,6 @@ public:
|
|||
Blitter::PaletteAnimation UsePaletteAnimation() override;
|
||||
|
||||
const char *GetName() override { return "32bpp-anim"; }
|
||||
int GetBytesPerPixel() override { return 6; }
|
||||
void PostResize() override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,6 @@ 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.
|
||||
|
|
|
@ -33,7 +33,6 @@ 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);
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ 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 */
|
||||
|
|
|
@ -198,11 +198,6 @@ public:
|
|||
*/
|
||||
virtual const char *GetName() = 0;
|
||||
|
||||
/**
|
||||
* Get how many bytes are needed to store a pixel.
|
||||
*/
|
||||
virtual int GetBytesPerPixel() = 0;
|
||||
|
||||
/**
|
||||
* Post resize event
|
||||
*/
|
||||
|
|
|
@ -32,7 +32,6 @@ 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. */
|
||||
|
|
|
@ -363,7 +363,6 @@ 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;
|
||||
|
@ -923,6 +922,8 @@ 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);
|
||||
|
@ -1077,7 +1078,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), 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), SetFill(1, 0), 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),
|
||||
|
|
|
@ -533,6 +533,7 @@ 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
|
||||
|
@ -3383,6 +3384,7 @@ 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
|
||||
|
@ -5187,6 +5189,7 @@ 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
|
||||
|
|
|
@ -3385,6 +3385,7 @@ 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
|
||||
|
@ -5189,6 +5190,7 @@ 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
|
||||
|
|
|
@ -501,7 +501,8 @@ NWidgetBase *MakeCargoesLegendLinkGraphGUI(int *biggest_index)
|
|||
spc->SetResize(0, 0);
|
||||
col->Add(spc);
|
||||
}
|
||||
panel->Add(col);
|
||||
/* 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);
|
||||
*biggest_index = WID_LGL_CARGO_LAST;
|
||||
return panel;
|
||||
}
|
||||
|
|
|
@ -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 uint8_t *_chatmessage_backup = nullptr; ///< Backup in case text is moved.
|
||||
static ReusableBuffer<uint8_t> _chatmessage_backup; ///< Backup in case text is moved.
|
||||
|
||||
/**
|
||||
* Test if there are any chat messages to display.
|
||||
|
@ -103,7 +103,6 @@ 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. */
|
||||
|
@ -156,7 +155,7 @@ void NetworkUndrawChatMessage()
|
|||
|
||||
_chatmessage_visible = false;
|
||||
/* Put our 'shot' back to the screen */
|
||||
blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup, width, height);
|
||||
blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup.GetBuffer(), width, height);
|
||||
/* And make sure it is updated next time */
|
||||
VideoDriver::GetInstance()->MakeDirty(x, y, width, height);
|
||||
|
||||
|
@ -208,10 +207,9 @@ 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) */
|
||||
blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup, width, height);
|
||||
uint8_t *buffer = _chatmessage_backup.Allocate(BlitterFactory::GetCurrentBlitter()->BufferSize(width, height));
|
||||
blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), buffer, width, height);
|
||||
|
||||
_cur_dpi = &_screen; // switch to _screen painting
|
||||
|
||||
|
|
Loading…
Reference in New Issue