
Tutorial
FM4, S6E2DH/S6E2DF/S6E2D5/S6E2D3 Series, 32-Bit Microcontroller, Graphic Driver User Manual, Doc. No. 002-04387 Rev. *A
56
Figure 22. Version 2
6.8.6.3
Version 3
Can we use only one rendering pass by rendering images that are larger than the source? We can! We just define
that the rendering rectangle is defined by the target buffer.
/* Again blend hub over rotated needle to store ... */
UTIL_SUCCESS(ret, mmlGdcPeBindSurface(&ctx, MML_GDC_PE_STORE, &sNeedle));
UTIL_SUCCESS(ret, mmlGdcPeBindSurface(&ctx, MML_GDC_PE_DST, &sSrc[BMP_NEEDLE]));
UTIL_SUCCESS(ret, mmlGdcPeBindSurface(&ctx, MML_GDC_PE_SRC, &sSrc[BMP_HUB]));
UTIL_SUCCESS(ret, mmlGdcPeSetMatrix(&ctx, MML_GDC_PE_SRC,
MML_GDC_PE_GEO_MATRIX_FORMAT_3X2, mat[BMP_HUB]));
/* ... but we render the whole target buffer in one step. */
UTIL_SUCCESS(ret, mmlGdcPeSelectArea(&ctx, MML_GDC_PE_STORE));
while
(TRUE)
{
/* Blend the hub over rotated needle but we draw the whole target frame so we don’t need to clear the buffer */
UTIL_SUCCESS(ret, mmlGdcPeSetMatrix(&ctx, MML_GDC_PE_DST,
MML_GDC_PE_GEO_MATRIX_FORMAT_3X2, mat[BMP_NEEDLE]));
UTIL_SUCCESS(ret, mmlGdcPeBlt(&ctx, BGR_WIDTH * 0.5f, ROT_CENTER_Y));
}
Now we have only one rendering step. The hardware fills black pixels outside the hub and needle buffer, and this is
exactly what we need to clear the previous frame.
Figure 23. Version3