MCPcopy Create free account
hub / github.com/EasyRPG/Player / Draw

Method Draw

src/transition.cpp:177–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void Transition::Draw(Bitmap& dst) {
178 if (!IsActive())
179 return;
180
181 std::vector<int> z_pos(2), z_size(2), z_length(2);
182 int z_min, z_max, z_percent, z_fixed_pos, z_fixed_size;
183 uint8_t m_r, m_g, m_b, m_a;
184 uint32_t *m_pointer, blocks_to_print;
185 int m_size;
186
187 BitmapRef screen_pointer1, screen_pointer2;
188 int w = dst.GetWidth();
189 int h = dst.GetHeight();
190
191 if (flash_iterations > 0) {
192 auto color = Flash::MakeColor(flash.red, flash.green, flash.blue, flash.current_level);
193 dst.BlendBlit(0, 0, *screen1, screen1->GetRect(), color, 255);
194 return;
195 }
196
197 int percentage = (current_frame) * 100 / (total_frames);
198
199 switch (transition_type) {
200 case TransitionFadeIn:
201 case TransitionFadeOut:
202 dst.Blit(0, 0, *screen1, screen1->GetRect(), 255);
203 dst.Blit(0, 0, *screen2, screen2->GetRect(), 255 * percentage / 100);
204 break;
205 case TransitionRandomBlocks:
206 case TransitionRandomBlocksDown:
207 case TransitionRandomBlocksUp:
208 blocks_to_print = random_blocks.size() * percentage / 100;
209
210 for (uint32_t i = current_blocks_print; i < blocks_to_print; i++) {
211 random_block_transition->Blit(random_blocks[i] % (w / size_random_blocks) * size_random_blocks,
212 random_blocks[i] / (w / size_random_blocks) * size_random_blocks, *screen2,
213 Rect(random_blocks[i] % (w / size_random_blocks) * size_random_blocks, random_blocks[i] / (w / size_random_blocks) * size_random_blocks,
214 size_random_blocks, size_random_blocks), Opacity::Opaque());
215 }
216 dst.Blit(0, 0, *screen1, screen1->GetRect(), Opacity::Opaque());
217 dst.Blit(0, 0, *random_block_transition, random_block_transition->GetRect(), Opacity::Opaque());
218 current_blocks_print = blocks_to_print;
219 break;
220 case TransitionBlindOpen:
221 for (int i = 0; i < h / 8; i++) {
222 dst.Blit(0, i * 8, *screen1, Rect(0, i * 8, w, 8 - 8 * percentage / 100), 255);
223 dst.Blit(0, i * 8 + 8 - 8 * percentage / 100, *screen2, Rect(0, i * 8 + 8 - 8 * percentage / 100, w, 8 * percentage / 100), 255);
224 }
225 break;
226 case TransitionBlindClose:
227 for (int i = 0; i < h / 8; i++) {
228 dst.Blit(0, i * 8 + 8 * percentage / 100, *screen1, Rect(0, i * 8 + 8 * percentage / 100, w, 8 - 8 * percentage / 100), 255);
229 dst.Blit(0, i * 8, *screen2, Rect(0, i * 8, w, 8 * percentage / 100), 255);
230 }
231 break;
232 case TransitionVerticalStripesIn:
233 case TransitionVerticalStripesOut:
234 for (int i = 0; i < h / 6 + 1 - h / 6 * percentage / 100; i++) {

Callers

nothing calls this directly

Calls 15

MakeColorFunction · 0.85
maxFunction · 0.85
minFunction · 0.85
BlendBlitMethod · 0.80
GetRectMethod · 0.80
BlitMethod · 0.80
StretchBlitMethod · 0.80
pixelsMethod · 0.80
FillRectMethod · 0.80
WaverBlitMethod · 0.80
RectClass · 0.70
ColorClass · 0.70

Tested by

no test coverage detected