Example #1
0
 public GetFindResultsEventArgs(int requestID,
                                int numMatches,
                                AweRect selection,
                                int curMatch,
                                bool finalUpdate)
 {
     this.requestID   = requestID;
     this.numMatches  = numMatches;
     this.selection   = selection;
     this.curMatch    = curMatch;
     this.finalUpdate = finalUpdate;
 }
 public GetFindResultsEventArgs( int requestID, 
     int numMatches, 
     AweRect selection,
     int curMatch, 
     bool finalUpdate )
 {
     this.requestID = requestID;
     this.numMatches = numMatches;
     this.selection = selection;
     this.curMatch = curMatch;
     this.finalUpdate = finalUpdate;
 }
        protected override void Paint(IntPtr srcBuffer, int srcRowSpan, AweRect srcRect, AweRect destRect)
        {
            unsafe
            {
                Texture.SetData(
                    0,
                    srcBuffer.ToPointer(),
                    new RECT(destRect.X, destRect.Y, destRect.X + destRect.Width, destRect.Y + destRect.Height),
                    (uint)srcRowSpan,
                    new RECT(srcRect.X, srcRect.Y, srcRect.X + srcRect.Width, srcRect.Y + srcRect.Height), D3DFORMAT.A8R8G8B8
                    );
            }
            base.Paint(srcBuffer, srcRowSpan, srcRect, destRect);

            if (OnDraw != null)
            {
                OnDraw(destRect);
            }
        }
Example #4
0
 void ISurface.Scroll(int dx, int dy, AweRect clipRect)
 {
     throw new NotImplementedException();
 }
Example #5
0
        private void internalUpdateIME( IntPtr caller, int state, AweRect caret_rect )
        {
            UpdateImeEventArgs e = new UpdateImeEventArgs( (IMEState)state, caret_rect );
            this.OnImeUpdated( this, e );

            CommandManager.InvalidateRequerySuggested();
        }
Example #6
0
        /// <summary>
        /// This method is called whenever the IWebView instance this surface is assigned to, wants to paint a certain section of the Surface with a block of pixels. It is your responsibility to copy srcBuffer to the location in this Surface specified by destRect.
        /// </summary>
        /// <param name="srcBuffer">A pointer to a block of pixels in 32-bit BGRA format. The size of the buffer is: srcRowSpan * srcRect.Height.</param>
        /// <param name="srcRowSpan">The number of bytes of each row. (Usually: srcRect.Width * 4)</param>
        /// <param name="srcRect">The dimensions of the region of srcBuffer to copy from. May have a non-zero origin.</param>
        /// <param name="destRect">The location to copy srcBuffer to. Always has same dimensions as srcRect but may have different origin (which specifies the offset of the section to copy to).</param>
        public void Paint(IntPtr srcBuffer, int srcRowSpan, AweRect srcRect, AweRect destRect)
        {
            if (_disposed)
                throw new ObjectDisposedException("FastBitmapSurface");

            CopyMemoryRectangular(srcBuffer, _internalBuffer, srcRowSpan, _width*BytesPerPixel, srcRect, destRect,
                                  BytesPerPixel);

            OnUpdated(CalculateTotalUpdatedRectangle(destRect));
        }
Example #7
0
        private static object CoerceDirtyBounds( DependencyObject d, object baseValue )
        {
            WebControl owner = (WebControl)d;

            if ( !owner.IsLive )
                return new AweRect();

            AweRect bounds = awe_webview_get_dirty_bounds( owner.Instance );
            AweRect result = new AweRect
            {
                X = bounds.X,
                Y = bounds.Y,
                Width = bounds.Width,
                Height = bounds.Height
            };

            return result;
        }
Example #8
0
        private void internalGetFindResults( IntPtr caller, int request_id, int num_matches, AweRect selection, int cur_match, bool finalUpdate )
        {
            GetFindResultsEventArgs e = new GetFindResultsEventArgs( request_id,
                num_matches,
                selection,
                cur_match,
                finalUpdate );

            this.OnFindResultsReceived( this, e );

            CommandManager.InvalidateRequerySuggested();
        }
Example #9
0
 private void InvalidateRectangle(AweRect aweRect)
 {
     //Invalidate the area of the texture drawn to
     Invalidate(new Rectangle(aweRect.X, aweRect.Y, aweRect.Width, aweRect.Height));
 }
 public UpdateImeEventArgs( IMEState state, AweRect caretRect )
 {
     this.state = state;
     this.caretRect = caretRect;
 }
Example #11
0
 public void ClearDirty()
 {
     _isDirty = false;
     _dirtyRegion=AweRect.Empty;
 }
Example #12
0
 private void internalUpdateIME( IntPtr caller, int state, AweRect caret_rect )
 {
     UpdateImeEventArgs e = new UpdateImeEventArgs( (IMEState)state, caret_rect );
     this.OnImeUpdated( this, e );
 }
Example #13
0
 void ISurface.Paint(IntPtr srcBuffer, int srcRowSpan, AweRect srcRect, AweRect destRect)
 {
     throw new NotImplementedException();
 }
Example #14
0
 protected override void Scroll(int dx, int dy, AweRect clipRect)
 {
     throw new NotSupportedException();
 }
Example #15
0
        /// <summary>
        /// Copy rectangle chunk from source to destination rectangle chunk of the same size
        /// </summary>
        /// <param name="srcBuffer">A pointer to a block of pixels in 32-bit BGRA format. The size of the buffer is: srcRowSpan * srcRect.Height.</param>
        /// <param name="destBuffer">A pointer to a block of pixels in 32-bit BGRA format. The size of the buffer is: srcRowSpan * srcRect.Height.</param>
        /// <param name="srcRowspan">The number of bytes per-row of the source - of small image (only the region that needs to be updated)</param>
        /// <param name="dstRowspan">The number of bytes per-row of the destination</param>
        /// <param name="srcRect">The dimensions of the region of srcBuffer to copy from. May have a non-zero origin.</param>
        /// <param name="destRect">The location to copy srcBuffer to. Always has same dimensions as srcRect but may have different origin (which specifies the offset of the section to copy to).</param>
        internal static void CopyMemoryRectangular(IntPtr srcBuffer, IntPtr destBuffer, int srcRowspan,int dstRowspan, AweRect srcRect, AweRect destRect,int bytesPerPixel)
        {
            int startSrcX = srcRect.X*BytesPerPixel;
            int startSrcY = srcRect.Y;
            int startDstX = destRect.X*BytesPerPixel;
            int startDstY = destRect.Y;
            int rowDst = startDstY;

            int copyWidth = srcRect.Width*bytesPerPixel;

            IntPtr fromPtr, toPtr;
            for (int rowSrc = startSrcY; rowSrc < srcRect.Height+startSrcY; rowSrc++)
                //Parallel.For(startSrcY, srcRect.Height , (rowSrc) =>
            {
                fromPtr = (IntPtr) (srcBuffer.ToInt64() + startSrcX + rowSrc*srcRowspan);

                toPtr = (IntPtr) (destBuffer.ToInt64() + startDstX + rowDst*dstRowspan);

                Win32.memcpy(toPtr, fromPtr, new UIntPtr((uint) copyWidth));
                rowDst++;
            }
        }
Example #16
0
 private void OnUpdated(AweRect clipRect)
 {
     if (Updated != null)
     {
         Updated(this, new FastBitmapSurfaceUpdatedEventArgs(clipRect));
     }
 }
Example #17
0
        public void Scroll(int dx, int dy, AweRect clipRect)
        {
            if (_disposed)
                throw new ObjectDisposedException("FastBitmapSurface");
            int srcRowSpan = _width * BytesPerPixel;
            int destRowSpan = srcRowSpan;

            int srcHeight = clipRect.Height - Math.Abs(dy);
            int srcWidth = clipRect.Width - Math.Abs(dx);

            int srcX=0, srcY=0,dstX=0,dstY=0;
            if (dy != 0)
            {
                if (dy < 0)
                    srcY = -dy;
                else
                    dstY = dy;
            }
            if (dx != 0)
            {
                if (dx < 0)
                    srcX = -dx;
                else
                    dstX = dx;
            }
            var srcRect = new AweRect(srcX, srcY, srcWidth, srcHeight);
            var destRect = new AweRect(dstX, dstY, srcWidth, srcHeight);

            CopyMemoryRectangular(_internalBuffer, _tempScrollingBuffer, srcRowSpan, destRowSpan, srcRect, srcRect, 
                                  BytesPerPixel);
            CopyMemoryRectangular(_tempScrollingBuffer, _internalBuffer, srcRowSpan, destRowSpan, srcRect, destRect,
                                  BytesPerPixel);

            OnUpdated(CalculateTotalUpdatedRectangle(clipRect));
        }
Example #18
0
 internal FastBitmapSurfaceUpdatedEventArgs(AweRect dirtyRegion)
 {
     _dirtyRegion = dirtyRegion;
 }
Example #19
0
        private AweRect CalculateTotalUpdatedRectangle(AweRect destRect)
        {
            _isDirty = true;
            if (_dirtyRegion == AweRect.Empty)
            {
                _dirtyRegion = destRect;
                return _dirtyRegion;
            }
            else
                _dirtyRegion=new AweRect(_width,_height,0,0);

            _dirtyRegion=new AweRect(destRect.X<_dirtyRegion.X?destRect.X:_dirtyRegion.X,
                destRect.Y<_dirtyRegion.Y?destRect.Y:_dirtyRegion.Y,
                destRect.Width>_dirtyRegion.Width?destRect.Width:_dirtyRegion.Width,
                destRect.Height>_dirtyRegion.Height?destRect.Height:_dirtyRegion.Height
                );
            return _dirtyRegion;
        }
 public UpdateImeEventArgs(IMEState state, AweRect caretRect)
 {
     this.state     = state;
     this.caretRect = caretRect;
 }
Example #21
0
        public AweRect GetDirtyBounds()
        {
            VerifyLive();

            AweRect bounds = awe_webview_get_dirty_bounds( Instance );
            AweRect result = new AweRect
            {
                X = bounds.X,
                Y = bounds.Y,
                Width = bounds.Width,
                Height = bounds.Height
            };

            return result;
        }