@@ -492,7 +492,9 @@ void MCImage::rotate_transform(int32_t p_angle)
492492
493493 // IM-2013-04-22: [[ BZ 10858 ]] A transformed rep is needed if the angle is non-zero,
494494 // or the rect is locked and doesn't match the source dimensions.
495- if (p_angle == 0 && !(getflag (F_LOCK_LOCATION ) && (t_src_width != rect.width || t_src_height != rect.height )))
495+ // MW-2013-10-25: [[ Bug 11300 ]] Additionally a transform is needed if flipped on
496+ // either axis.
497+ if (p_angle == 0 && !(getflag (F_LOCK_LOCATION ) && (t_src_width != rect.width || t_src_height != rect.height )) && !m_flip_x && !m_flip_y)
496498 m_has_transform = false ;
497499 else
498500 {
@@ -502,8 +504,13 @@ void MCImage::rotate_transform(int32_t p_angle)
502504
503505 MCGAffineTransform t_transform = MCGAffineTransformMakeTranslation (-(int32_t )t_src_width / 2.0 , -(int32_t )t_src_height / 2.0 );
504506 t_transform = MCGAffineTransformRotate (t_transform, -p_angle);
507+
508+ // MW-2013-10-25: [[ Bug 11300 ]] If needed, flip the transform appropriately.
509+ if (m_flip_x || m_flip_y)
510+ t_transform = MCGAffineTransformScale (t_transform, m_flip_x ? -1 .0f : 1 .0f , m_flip_y ? -1 .0f : 1 .0f );
511+
505512 t_transform = MCGAffineTransformTranslate (t_transform, t_trans_width / 2.0 , t_trans_height / 2.0 );
506-
513+
507514 if (getflag (F_LOCK_LOCATION ))
508515 {
509516 t_transform = MCGAffineTransformScale (t_transform, rect.width / (MCGFloat)t_trans_width, rect.height / (MCGFloat)t_trans_height);
@@ -530,18 +537,49 @@ void MCImage::resize_transform()
530537{
531538 uint32_t t_src_width = rect.width , t_src_height = rect.height ;
532539 /* UNCHECKED */ getsourcegeometry (t_src_width, t_src_height);
533-
534- if (rect.width == t_src_width && rect.height == t_src_height)
535- m_has_transform = nil;
540+
541+ // MW-2013-10-25: [[ Bug 11300 ]] Additionally a transform is needed if flipped on
542+ // either axis.
543+ if (rect.width == t_src_width && rect.height == t_src_height && !m_flip_x && !m_flip_y)
544+ m_has_transform = false ;
536545 else
537546 {
538547 m_has_transform = true ;
539- MCGFloat t_mid_x = (MCGFloat)t_src_width / 2.0 ;
540- MCGFloat t_mid_y = (MCGFloat)t_src_height / 2.0 ;
541- m_transform = MCGAffineTransformMakeScale (rect.width / (MCGFloat)t_src_width, rect.height / (MCGFloat)t_src_height);
548+
549+ MCGAffineTransform t_transform;
550+
551+ // MW-2013-10-25: [[ Bug 11300 ]] If needed, flip the transform appropriately.
552+ if (m_flip_x || m_flip_y)
553+ {
554+ t_transform = MCGAffineTransformMakeTranslation (-(signed )t_src_width / 2 .0f , -(signed )t_src_height / 2 .0f );
555+ t_transform = MCGAffineTransformScale (t_transform, m_flip_x ? -1 .0f : 1 .0f , m_flip_y ? -1 .0f : 1 .0f );
556+ t_transform = MCGAffineTransformTranslate (t_transform, t_src_width / 2.0 , t_src_height / 2.0 );
557+ }
558+ else
559+ t_transform = MCGAffineTransformMakeIdentity ();
560+
561+ m_transform = MCGAffineTransformScale (t_transform, rect.width / (MCGFloat)t_src_width, rect.height / (MCGFloat)t_src_height);
542562 }
543563}
544564
565+ // MW-2013-05-25: [[ Bug 11300 ]] This applies the flip transform if needed.
566+ void MCImage::flip_transform ()
567+ {
568+ uint32_t t_src_width = rect.width , t_src_height = rect.height ;
569+ /* UNCHECKED */ getsourcegeometry (t_src_width, t_src_height);
570+
571+ if (!m_flip_x && !m_flip_y)
572+ m_has_transform = false ;
573+ else
574+ {
575+ m_has_transform = true ;
576+
577+ m_transform = MCGAffineTransformMakeTranslation (-(signed )t_src_width / 2.0 , -(signed )t_src_height / 2.0 );
578+ m_transform = MCGAffineTransformScale (m_transform, m_flip_x ? -1 .0f : 1 .0f , m_flip_y ? -1 .0f : 1 .0f );
579+ m_transform = MCGAffineTransformTranslate (m_transform, t_src_width / 2.0 , t_src_height / 2.0 );
580+ }
581+ }
582+
545583void MCImage::createbrush (Properties which)
546584{
547585 MCGImageRef t_image = nil;
0 commit comments