MCPcopy Create free account
hub / github.com/diasurgical/devilution / CelBlitOutline

Function CelBlitOutline

Source/engine.cpp:535–587  ·  view source on GitHub ↗

* @brief Blit a solid colder shape one pixel larger then the given sprite shape, to the back buffer at the given coordianates * @param col Color index from current palette * @param sx Back buffer coordinate * @param sy Back buffer coordinate * @param pCelBuff CEL buffer * @param nCel CEL frame number * @param nWidth Width of sprite */

Source from the content-addressed store, hash-verified

533 * @param nWidth Width of sprite
534 */
535void CelBlitOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
536{
537 int nDataSize, w;
538 BYTE *src, *dst, *end;
539 BYTE width;
540
541 assert(pCelBuff != NULL);
542 assert(gpBuffer);
543
544 src = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
545 end = &src[nDataSize];
546 dst = &gpBuffer[sx + BUFFER_WIDTH * sy];
547
548 for (; src != end; dst -= BUFFER_WIDTH + nWidth) {
549 for (w = nWidth; w;) {
550 width = *src++;
551 if (!(width & 0x80)) {
552 w -= width;
553 if (dst < gpBufEnd && dst > gpBufStart) {
554 if (dst >= gpBufEnd - BUFFER_WIDTH) {
555 while (width) {
556 if (*src++) {
557 dst[-BUFFER_WIDTH] = col;
558 dst[-1] = col;
559 dst[1] = col;
560 }
561 dst++;
562 width--;
563 }
564 } else {
565 while (width) {
566 if (*src++) {
567 dst[-BUFFER_WIDTH] = col;
568 dst[-1] = col;
569 dst[1] = col;
570 dst[BUFFER_WIDTH] = col;
571 }
572 dst++;
573 width--;
574 }
575 }
576 } else {
577 src += width;
578 dst += width;
579 }
580 } else {
581 width = -(char)width;
582 dst += width;
583 w -= width;
584 }
585 }
586 }
587}
588
589/**
590 * @brief Set the value of a single pixel in the back buffer, checks bounds

Callers 6

DrawInvFunction · 0.85
DrawInvBeltFunction · 0.85
DrawObjectFunction · 0.85
DrawItemFunction · 0.85
DrawMonsterHelperFunction · 0.85

Calls 1

CelGetFrameClippedFunction · 0.85

Tested by

no test coverage detected