harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Igor Stolyarov" <igorvstolya...@gmail.com>
Subject Re: [HARMONY-5026] Dirty regions calculations...
Date Fri, 26 Oct 2007 11:08:46 GMT
Alexey, I agree with you, MultiRectArea has a lot of outstanding
functioanality. I think if we are creating TODO list for such topics it
would be great support for future Harmony improvement. I suggest create TODO
list and include MultiRectArea's improvement into it.

Thanks,
Igor


2007/10/26, Alexey Petrenko <alexey.a.petrenko@gmail.com>:
>
> Here is a part of the patch for HARMONY-5026 responsible for dirty
> regions calculations:
>
> === cut ===
>    public void addDirtyRegion(Rectangle r){
>        if (dirtyRegions == null) {
>            dirtyRegions = new MultiRectArea(r);
>        } else {
>            Rectangle rects[] = dirtyRegions.getRectangles();
>            if (rects.length == 1){
>                if (rects[0].contains(r)) return;
>            }
>            dirtyRegions.add(r);
>        }
>        invalidate();
>    }
>
>    public int[] getDirtyRegions(){
>        if(dirtyRegions != null) return dirtyRegions.rect;
>        else return null;
>    }
> === cut ===
>
> As we can see MultiRectArea.add method is used here for adding a new
> region.
> Here is the MultiRectArea.add method:
>
> === cut ===
>    public void add(Rectangle rect) {
>        setRect(union(this, new MultiRectArea(rect)).rect, false);
>        invalidate();
>    }
> === cut ===
>
> I would say that this is probably too heavy method to call very often.
>
> I can suggest the following strategy to use here:
> 1. Store all the dirty rectangles in some list (array, Vector or
> something)
> 2. Create MultiRectArea only once in getDirtyRegions methods. This
> will theoretically save us a lot of object creations and array copying
> in MultiRectArea.add method.
>
> Thoughts?
>
> SY, Alexey
>



-- 
Igor V. Stolyarov
Intel Middleware Products Division

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message