Пример #1
0
        // Token: 0x06002D1D RID: 11549 RVA: 0x000ADEE8 File Offset: 0x000AC0E8
        public static bool smethod_1(Class150 left, Class150 right, int max_diff)
        {
            if (left.size_0 != right.size_0)
            {
                int  width  = Math.Min(left.size_0.Width, right.size_0.Width);
                int  height = Math.Min(left.size_0.Width, right.size_0.Height);
                Size sz     = new Size(width, height);
                left  = left.method_5(sz);
                right = right.method_5(sz);
            }
            int num  = 1;
            int num2 = Class150.smethod_2(left, right, 0, 0);

            if (num2 <= max_diff)
            {
                return(true);
            }
            bool flag  = left.size_0.Width > num;
            bool flag2 = left.size_0.Height > num;

            if (flag)
            {
                int num3;
                if ((num3 = Class150.smethod_2(left, right, -num, 0)) < num2)
                {
                    num2 = num3;
                }
                if (num2 <= max_diff)
                {
                    return(true);
                }
                if ((num3 = Class150.smethod_2(left, right, num, 0)) < num2)
                {
                    num2 = num3;
                }
                if (num2 <= max_diff)
                {
                    return(true);
                }
            }
            if (flag && flag2)
            {
                int num3;
                if ((num3 = Class150.smethod_2(left, right, -num, num)) < num2)
                {
                    num2 = num3;
                }
                if (num2 <= max_diff)
                {
                    return(true);
                }
                if ((num3 = Class150.smethod_2(left, right, -num, -num)) < num2)
                {
                    num2 = num3;
                }
                if (num2 <= max_diff)
                {
                    return(true);
                }
                if ((num3 = Class150.smethod_2(left, right, num, num)) < num2)
                {
                    num2 = num3;
                }
                if (num2 <= max_diff)
                {
                    return(true);
                }
                if ((num3 = Class150.smethod_2(left, right, num, -num)) < num2)
                {
                    num2 = num3;
                }
                if (num2 <= max_diff)
                {
                    return(true);
                }
            }
            if (flag2)
            {
                int num3;
                if ((num3 = Class150.smethod_2(left, right, 0, -num)) < num2)
                {
                    num2 = num3;
                }
                if (num2 <= max_diff)
                {
                    return(true);
                }
                if ((num3 = Class150.smethod_2(left, right, 0, num)) < num2)
                {
                    num2 = num3;
                }
                if (num2 <= max_diff)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        // Token: 0x06002D1C RID: 11548 RVA: 0x000ADB68 File Offset: 0x000ABD68
        public unsafe static bool smethod_0(Class150 source, Struct46 sourceRatio, Class150 value, Struct46 valueRatio, int max_diff, out Point location)
        {
            int num  = (int)((double)source.size_0.Width / sourceRatio.double_2);
            int num2 = (int)((double)source.size_0.Height / sourceRatio.double_3);
            int num3 = (int)((double)value.size_0.Width / valueRatio.double_2);
            int num4 = (int)((double)value.size_0.Height / valueRatio.double_3);
            int num5;

            if (num > num3)
            {
                num5 = num3;
            }
            else
            {
                num5 = num;
            }
            int num6;

            if (num2 > num4)
            {
                num6 = num4;
            }
            else
            {
                num6 = num2;
            }
            Size sz  = new Size((int)Math.Round(sourceRatio.double_2 * (double)num5), (int)Math.Round(sourceRatio.double_3 * (double)num6));
            Size sz2 = new Size((int)Math.Round(valueRatio.double_2 * (double)num5), (int)Math.Round(valueRatio.double_3 * (double)num6));

            if (sz2.Width <= sz.Width && sz2.Height <= sz.Height)
            {
                Class150 @class = source.method_5(sz);
                Class150 class2 = value.method_5(sz2);
                lock (@class.object_0)
                {
                    lock (class2.object_0)
                    {
                        Struct33 *pBase  = @class.class125_0.pBase;
                        Struct33 *pBase2 = class2.class125_0.pBase;
                        decimal   d      = sz2.Width * sz2.Height * 3m;
                        for (int i = 0; i < sz.Height - sz2.Height; i++)
                        {
                            for (int j = 0; j < sz.Width - sz2.Width; j++)
                            {
                                Struct33 *ptr  = pBase2;
                                uint      num7 = 0U;
                                int       num8 = j + sz2.Width;
                                for (int k = i; k < i + sz2.Height; k++)
                                {
                                    Struct33 *ptr2 = pBase + k * sz.Width + j;
                                    for (int l = j; l < num8; l++)
                                    {
                                        num7 = num7 + Class477.smethod_8((int)ptr2->R, (int)ptr->R) + Class477.smethod_8((int)ptr2->G, (int)ptr->G) + Class477.smethod_8((int)ptr2->B, (int)ptr->B);
                                        ptr2++;
                                        ptr++;
                                    }
                                    if (num7 / d > max_diff)
                                    {
                                        break;
                                    }
                                }
                                if (num7 / d < max_diff)
                                {
                                    location = new Point((int)Math.Round((double)j / (double)sz.Width * (double)source.size_0.Width), (int)Math.Round((double)i / (double)sz.Height * (double)source.size_0.Height));
                                    return(true);
                                }
                            }
                        }
                    }
                }
                location = Point.Empty;
                return(false);
            }
            location = Point.Empty;
            return(false);
        }