MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / _zoomSurfaceY

Method _zoomSurfaceY

src/Engine/Zoom.cpp:694–905  ·  view source on GitHub ↗

* Internal 8-bit Zoomer without smoothing. * Source code originally from SDL_gfx (LGPL) with permission by author. * * Zooms 8bit palette/Y 'src' surface to 'dst' surface. * Assumes src and dst surfaces are of 8-bit depth. * Assumes dst surface was allocated with the correct dimensions. * * @param src The surface to zoom (input). * @param dst The zoomed surface (output). * @param flipx Fl

Source from the content-addressed store, hash-verified

692 * @return 0 for success or -1 for error.
693 */
694int Zoom::_zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst, int flipx, int flipy)
695{
696 int x, y;
697 static Uint32 *sax, *say;
698 Uint32 *csax, *csay;
699 int csx, csy;
700 Uint8 *sp, *dp, *csp;
701 int dgap;
702 static bool proclaimed = false;
703
704 if (Options::useHQXFilter)
705 {
706 static bool initDone = false;
707
708 if (!initDone)
709 {
710 hqxInit();
711 initDone = true;
712 }
713
714 // HQX_API void HQX_CALLCONV hq2x_32_rb( uint32_t * src, uint32_t src_rowBytes, uint32_t * dest, uint32_t dest_rowBytes, int width, int height );
715
716 if (dst->w == src->w * 2 && dst->h == src->h * 2)
717 {
718 hq2x_32_rb((uint32_t*) src->pixels, src->pitch, (uint32_t*) dst->pixels, dst->pitch, src->w, src->h);
719 return 0;
720 }
721
722 if (dst->w == src->w * 3 && dst->h == src->h * 3)
723 {
724 hq3x_32_rb((uint32_t*) src->pixels, src->pitch, (uint32_t*) dst->pixels, dst->pitch, src->w, src->h);
725 return 0;
726 }
727
728 if (dst->w == src->w * 4 && dst->h == src->h * 4)
729 {
730 hq4x_32_rb((uint32_t*) src->pixels, src->pitch, (uint32_t*) dst->pixels, dst->pitch, src->w, src->h);
731 return 0;
732 }
733
734 }
735
736 if (Options::useScaleFilter)
737 {
738 // check the resolution to see which of scale2x, scale3x, etc. we need
739
740 if (dst->w == src->w * 2 && dst->h == src->h *2 && !scale_precondition(2, src->format->BytesPerPixel, src->w, src->h))
741 {
742 scale(2, dst->pixels, dst->pitch, src->pixels, src->pitch, src->format->BytesPerPixel, src->w, src->h);
743 return 0;
744 }
745
746 if (dst->w == src->w * 3 && dst->h == src->h *3 && !scale_precondition(3, src->format->BytesPerPixel, src->w, src->h))
747 {
748 scale(3, dst->pixels, dst->pitch, src->pixels, src->pitch, src->format->BytesPerPixel, src->w, src->h);
749 return 0;
750 }
751

Callers

nothing calls this directly

Calls 5

hqxInitFunction · 0.85
hq2x_32_rbFunction · 0.85
hq3x_32_rbFunction · 0.85
scale_preconditionFunction · 0.85
scaleFunction · 0.85

Tested by

no test coverage detected