Page 3 of 6 FirstFirst 12345 ... LastLast
Results 21 to 30 of 51

Thread: More "efficient" redraw?

  1. #21
    Join Date
    May 2006
    Location
    Canada
    Posts
    20,742
    ccnb, may be your right, I noticed I have a line in the GetRenderList() that returns this
    Code:
                if (isActivated == false)
                {
                    return new List<UiElement>();
                }
    isActivated is set false by my popup code.

    Martin
    Last edited by mvallevand; 2011-12-29 at 08:08 PM.

  2. #22
    Join Date
    Aug 2011
    Location
    Virginia, USA
    Posts
    453
    Ok, but why is GetRenderList() on the plugin screen being called when NeedsRendering() for the plugin is returning false?

  3. #23
    Join Date
    Nov 2003
    Location
    NextPVR HQ, Wellington, New Zealand
    Posts
    75,869
    Quote Originally Posted by cncb View Post
    Ok, but why is GetRenderList() on the plugin screen being called when NeedsRendering() for the plugin is returning false?
    Probably because the screensaver is returning true from it's NeedsRendering(). Like the default one when it animates.

  4. #24
    Join Date
    Aug 2011
    Location
    Virginia, USA
    Posts
    453
    Quote Originally Posted by sub View Post
    Probably because the screensaver is returning true from it's NeedsRendering(). Like the default one when it animates.
    I changed my popup/screensaver to always return false for NeedsRendering() but GetRenderList() on the popup/screensaver is still called multiple times per second so I think there might be an underlying problem here...

  5. #25
    Join Date
    Nov 2003
    Location
    NextPVR HQ, Wellington, New Zealand
    Posts
    75,869
    Given it's working for others, I'm inclined to think it will something that is being done in this plugin or screensaver, but I'm happy to take a closer look if you can provide the binary files for me to reproduce it here - without me having install extra apps on my development machine (which is currently nice and clean after a fresh Windows install on a new drive).

  6. #26
    Join Date
    Aug 2011
    Location
    Virginia, USA
    Posts
    453
    I think I have finally narrowed this down. It seems to be the black background in the popup causing it. The attached simple example plugin shows a popup with a black background when you select the single list item. I have NeedsRendering() for the popup always returning false. It sits there for several seconds not updating the time text and then all the sudden the time text is updating every second and GetRenderList() is called multiple times per second as can be seen in the log file. If I don't add the black background in GetRenderList() then this GetRenderList() call flurry never seems to occur.

    I can post the whole project with source if you want. Here is how I am creating the black background/UIElement (as you suggested I do it when I asked a while ago):

    Code:
    Bitmap black = new Bitmap(32, 32);
    Graphics g = Graphics.FromImage(black);
    g.Clear(Color.Black);
    g.Dispose();
    _Black = new UiElement("screensaver-black", new RectangleF(0, 0, 100, 100), black, 255);

  7. #27
    Join Date
    Nov 2006
    Location
    Louisville, KY, USA
    Posts
    7,690
    Is that code in your GetRenderList()?

    Try defining "_Black" as a global variable. When you need the background, set a variable to true ("_needsBlack" for the purposes of this example).

    Then modify the above code with:

    Code:
    if (_needsBlack)
    {
      if (_Black == null)
      {
        Bitmap black = new Bitmap(32, 32);
        Graphics g = Graphics.FromImage(black);
        g.Clear(Color.Black);
        g.Dispose();
        _Black = new UiElement("screensaver-black", new RectangleF(0, 0, 100, 100), black, 255);
      }
    } else if (_Black != null)
    {
      _Black = null;
    }
    Currently, it seems that you are creating and disposing the bitmap whenever you need to render _Black.

  8. #28
    Join Date
    Aug 2011
    Location
    Virginia, USA
    Posts
    453
    Quote Originally Posted by whurlston View Post
    Is that code in your GetRenderList()?

    Try defining "_Black" as a global variable. When you need the background, set a variable to true ("_needsBlack" for the purposes of this example).
    No, '_Black' is a class member variable and the code above is from the constructor so it is not being created multiple times.

  9. #29
    Join Date
    Nov 2006
    Location
    Louisville, KY, USA
    Posts
    7,690
    Ah, then ignore everything I just said. Can you post the source to that test plugin?

  10. #30
    Join Date
    Aug 2011
    Location
    Virginia, USA
    Posts
    453
    Quote Originally Posted by whurlston View Post
    Can you post the source to that test plugin?
    Attached
    Last edited by cncb; 2012-01-14 at 06:23 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •