MCPcopy Index your code
hub / github.com/MapServer/MapServer / msApplyOutputFormat

Function msApplyOutputFormat

mapoutput.c:639–722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

637/************************************************************************/
638
639void msApplyOutputFormat( outputFormatObj **target,
640 outputFormatObj *format,
641 int transparent,
642 int interlaced,
643 int imagequality )
644
645{
646 int change_needed = MS_FALSE;
647 int old_imagequality, old_interlaced;
648 outputFormatObj *formatToFree = NULL;
649
650 assert( target != NULL );
651
652 if( *target != NULL && --((*target)->refcount) < 1 )
653 {
654 formatToFree = *target;
655 *target = NULL;
656 }
657
658 if( format == NULL )
659 {
660 if( formatToFree )
661 msFreeOutputFormat( formatToFree );
662 return;
663 }
664
665 msOutputFormatValidate( format, MS_FALSE );
666
667/* -------------------------------------------------------------------- */
668/* Do we need to change any values? If not, then just apply */
669/* and return. */
670/* -------------------------------------------------------------------- */
671 if( transparent != MS_NOOVERRIDE && !format->transparent != !transparent )
672 change_needed = MS_TRUE;
673
674 old_imagequality = atoi(msGetOutputFormatOption( format, "QUALITY", "75"));
675 if( imagequality != MS_NOOVERRIDE && old_imagequality != imagequality )
676 change_needed = MS_TRUE;
677
678 old_interlaced =
679 strcasecmp(msGetOutputFormatOption( format, "INTERLACE", "ON"),
680 "OFF") != 0;
681 if( interlaced != MS_NOOVERRIDE && !interlaced != !old_interlaced )
682 change_needed = MS_TRUE;
683
684 if( change_needed )
685 {
686 char new_value[128];
687
688 if( format->refcount > 0 )
689 format = msCloneOutputFormat( format );
690
691 if( transparent != MS_NOOVERRIDE )
692 {
693 format->transparent = transparent;
694 if( format->imagemode == MS_IMAGEMODE_RGB )
695 format->imagemode = MS_IMAGEMODE_RGBA;
696 }

Callers 13

msDrawScalebarFunction · 0.85
msDrawLegendIconFunction · 0.85
msCreateLegendIconFunction · 0.85
msDrawLegendFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
msCopyMapFunction · 0.85
msWCSGetCoverageFunction · 0.85
msWCSGetCoverage20Function · 0.85
msWMSLoadGetMapParamsFunction · 0.85
mapwms.cFile · 0.85

Calls 7

msFreeOutputFormatFunction · 0.85
msOutputFormatValidateFunction · 0.85
msGetOutputFormatOptionFunction · 0.85
strcasecmpFunction · 0.85
msCloneOutputFormatFunction · 0.85
msSetOutputFormatOptionFunction · 0.85

Tested by

no test coverage detected