Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 24bd18e

Browse files
committed
[[ Drawing ]] Use types more effectively
This patch changes the libgraphics drawing implementation to use MCSpan, MCGPoint, MCGSize and MCGRectangle rather than separate pointer/lengths and multiple float parameters.
1 parent 86e42c6 commit 24bd18e

File tree

3 files changed

+221
-175
lines changed

3 files changed

+221
-175
lines changed

engine/src/graphicscontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ void MCGraphicsContext::drawpict(uint1 *data, uint4 length, bool embed, const MC
12341234
{
12351235
MCGContextSave(m_gcontext);
12361236
MCGContextClipToRect(m_gcontext, MCRectangleToMCGRectangle(crect));
1237-
MCGContextPlayback(m_gcontext, MCRectangleToMCGRectangle(drect), data, length);
1237+
MCGContextPlayback(m_gcontext, MCRectangleToMCGRectangle(drect), MCMakeSpan(static_cast<const byte_t*>(data), length));
12381238
MCGContextRestore(m_gcontext);
12391239
}
12401240

libgraphics/include/graphics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ void MCGContextDrawPlatformText(MCGContextRef context, const unichar_t *text, ui
10151015
MCGFloat MCGContextMeasurePlatformText(MCGContextRef context, const unichar_t *text, uindex_t length, const MCGFont &p_font, const MCGAffineTransform &p_transform);
10161016
bool MCGContextMeasurePlatformTextImageBounds(MCGContextRef context, const unichar_t *text, uindex_t length, const MCGFont &p_font, const MCGAffineTransform &p_transform, MCGRectangle &r_bounds);
10171017

1018-
void MCGContextPlayback(MCGContextRef context, MCGRectangle p_dst_rect, const void *p_drawing, size_t p_drawing_byte_size);
1018+
void MCGContextPlayback(MCGContextRef context, MCGRectangle p_dst_rect, MCSpan<const byte_t> p_drawing);
10191019

10201020
////////////////////////////////////////////////////////////////////////////////
10211021

0 commit comments

Comments
 (0)