/**更新关键帧*/
        private void upDateKeyFrame(Bitmap newKeyFrame, ShortPoint point)
        {
            globalComparerBitmap = (Bitmap)newKeyFrame.Clone();

            DifferentBitmapWithCursor differentBitmapWithCursor = new ScreenBitmap.DifferentBitmapWithCursor();
            differentBitmapWithCursor.setBitmapType(SendPacket.BitmapType.COMPLETE);
            differentBitmapWithCursor.setCursorPoint(point);
            differentBitmapWithCursor.setDifBitmap(newKeyFrame);
            screenCopyDifQueue.Enqueue(differentBitmapWithCursor);
            textBoxDBQ.Text = "" + screenCopyDifQueue.getQueueSize();
        }
        private void bitmapCmpToBlockingQueue()
        {
            while (isSendPic)
            {
                while (!picFlag)
                {
                    try
                    {
                        manulResetEvent.WaitOne();
                    }
                    catch (ThreadInterruptedException ex)
                    {
                        manulResetEvent.Reset();
                        Console.WriteLine(ex.Message);
                        ErrorInfo.getErrorWriter().writeErrorMassageToFile(ex.Message);
                        return;
                    }
                }
                while (picFlag)
                {
                    BitmapWithCursor bitmapWithCursor = screenCopyQueue.Dequeue();

                    if (bitmapWithCursor != null)
                    {
                        // Console.WriteLine("btmCmpThread***********");
                        try
                        {
                            //发送关键帧,校准
                            //keyFrameAdjusttimes++;
                            //if (keyFrameAdjusttimes > 300)
                            //{
                            //    keyFrameAdjusttimes = 0;
                            //    sendKeyFrame();
                            //}
                            Bitmap btm1 = bitmapWithCursor.getScreenBitmap();

                            if (isFirstFrame)
                            {
                                globalBtmWidth = btm1.Width;
                                globalBtmHeight = btm1.Height;
                                upDateKeyFrame(btm1, bitmapWithCursor.getCursorPoint());
                                isFirstFrame = false;
                            }
                            else
                            {
                                int lastBtmWidth = btm1.Width;
                                int lastBtmHeight = btm1.Height;
                                if (lastBtmWidth != globalBtmWidth || lastBtmHeight != globalBtmHeight)
                                {
                                    globalBtmWidth = lastBtmWidth;
                                    globalBtmHeight = lastBtmHeight;
                                    upDateKeyFrame(btm1, bitmapWithCursor.getCursorPoint());
                                    continue;
                                }
                                Bitmap btm2 = globalComparerBitmap;

                                List<ShortRec> difPoints = null;
                                if (isWin8Above)
                                {

                                    // Stopwatch sw = new Stopwatch();
                                    //sw.Start();
                                    difPoints = BitmapCmp32Bit.Compare(bitmapWithCursor.dirtyRecs, btm2, btm1, bitCmpSize);
                                    //sw.Stop();
                                  /* foreach (ShortRec rec in difPoints)
                                    {
                                        Console.WriteLine("dif---->" + rec.xPoint+":"+rec.yPoint+":"+rec.width+":"+rec.height);
                                    }*/
                                }
                                else
                                {
                                    difPoints = BitmapCmp24Bit.Compare(btm1, btm2, bitCmpSize);
                                }
                                Bitmap sendPic = null;
                                if (difPoints.Count > 0)
                                {
                                    DifferentBitmapWithCursor differentBitmapWithCursor = new ScreenBitmap.DifferentBitmapWithCursor();
                                    double VPTNOW = (double)(CopyScreen.getReslution().Width * CopyScreen.getReslution().Height) / (bitCmpSize.Width * bitCmpSize.Height);
                                    if ((double)difPoints.Count >= VPT07 * VPTNOW)//超过70%的改变,直接发送K帧
                                    {
                                        sendPic = btm1;
                                        differentBitmapWithCursor.setBitmapType(SendPacket.BitmapType.COMPLETE);
                                    }
                                    else
                                    {
                                        difPoints=unionShortRecs(difPoints);
                                        //Stopwatch sw = new Stopwatch();
                                        //sw.Start();
                                        sendPic = GetDifBlocks.getBlocksIn1BitmapClone(difPoints, btm1, bitCmpSize);
                                        //sw.Stop();
                                        //Console.WriteLine(sw.ElapsedMilliseconds+"ms");
                                        differentBitmapWithCursor.setBitmapType(SendPacket.BitmapType.BLOCK);
                                        differentBitmapWithCursor.setDifPointsList(difPoints);

                                    }
                                    /**更新全局比较帧*/
                                    globalComparerBitmap.Dispose();
                                    globalComparerBitmap = (Bitmap)btm1.Clone();
                                    differentBitmapWithCursor.setCursorPoint(bitmapWithCursor.getCursorPoint());
                                    differentBitmapWithCursor.setDifBitmap(sendPic);


                                    screenCopyDifQueue.Enqueue(differentBitmapWithCursor);
                                    textBoxDBQ.Text = "" + screenCopyDifQueue.getQueueSize();

                                }
                            }

                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            ErrorInfo.getErrorWriter().writeErrorMassageToFile(ex.Message);
                            return;
                        }
                    }
                }

            }
        }