Animation restrictions?
Animation restrictions?
Are there any restrictions to animators? Wrote my own gif implementation and have noticed, that sometimes (espesially when there are a lot of animations are inside rv and while scrolling it) animation dissapears (just a rv background is drawing, like animator is skipped). That is definetly not a bug of my lib, have checked everything. RichView just don't paint it for some reason i can't understand...
So, is there any way to force animator painting?
So, is there any way to force animator painting?
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Animations is supported only for the following gif implementations:
-TGifImage by Anders Melander,
- TGifImage included in Delphi 2007-2008
- TJvGifImage from JVCL.
Did you implement a special TRichView animator like it was implemented for these classes? Animators for these classes are in units: RVGifAnimate, RVGifAnimate2007, RVJvGifAnimate.
-TGifImage by Anders Melander,
- TGifImage included in Delphi 2007-2008
- TJvGifImage from JVCL.
Did you implement a special TRichView animator like it was implemented for these classes? Animators for these classes are in units: RVGifAnimate, RVGifAnimate2007, RVJvGifAnimate.
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
no, i've tested it on 50k gifs. But it is just to reproduce the bug. it appears even on small count of animations, but it is hard to catch it then. This is happening after some hours of intensive work with adding/removing gifs.
The strangiest thing is that gif appears again when animation cycle starts from the beginning. It's kinda mystery for me
The strangiest thing is that gif appears again when animation cycle starts from the beginning. It's kinda mystery for me
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
exactly the same test is impossible. too many GDI leaks. thats the reason i wrote my lib for. TGifImage brakes application in a few scrolls of whole area with EOuOfMemory. TjvGifImage even less.
could you please tell me how TAnimator work and in what cases it cannot be drawn?
P.S. working on Delphi 7
could you please tell me how TAnimator work and in what cases it cannot be drawn?
P.S. working on Delphi 7
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
In my test, there were no GDI leaks with TGifImage.
And GDI resources are minimally used when animations are inserted in TRichView, because TRichView animates them itself, not using their built-in animation features.
What version of TRichView do you use? May be you use older version, which used much more resources for animation, and had much smaller default value of RVMaxAnimations?
And GDI resources are minimally used when animations are inserted in TRichView, because TRichView animates them itself, not using their built-in animation features.
What version of TRichView do you use? May be you use older version, which used much more resources for animation, and had much smaller default value of RVMaxAnimations?
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I cannot reproduce the problem with TGifImage.
I created a test project:
If animation is turned on (RVGifAnimate is included in the project, and RichView1.AnimationMode = rvaniOnFormat), I can scroll back and forth without problems. This is because animation is handled by TRichView, only memory for the current frame and only for visible animations are allocated.
If animation is turned off, the program really fails. But it's not because leaks, but because too many objects used. In this mode, images are shown using Canvas.Draw method. On each repainting, TGifImage displays a new frame (and creates a new bitmap for it). When I scroll back and forth, more and more frames are displayed, and more and more bitmaps are created, until the application fails. But again, it happens only if animation is turned off.
The last version of TRichView is 11.0.1 (11.0 is also ok).
Sorry, I do not know why your animators are not shown. Probably something is wrong with them, because I cannot reproduce this problem with TGifImage.
I created a test project:
Code: Select all
var i: Integer;
gif1, gif2: TGifImage;
begin
gif1 := TGifImage.Create;
gif1.LoadFromFile('kengu.gif');
for i := 1 to 20000 do begin
gif2 := TGifImage.Create;
gif2.Assign(gif1);
RichView1.AddPictureEx('', gif2, 0, rvvaBaseLine);
end;
gif1.Free;
RichView1.Format;
end;
If animation is turned off, the program really fails. But it's not because leaks, but because too many objects used. In this mode, images are shown using Canvas.Draw method. On each repainting, TGifImage displays a new frame (and creates a new bitmap for it). When I scroll back and forth, more and more frames are displayed, and more and more bitmaps are created, until the application fails. But again, it happens only if animation is turned off.
The last version of TRichView is 11.0.1 (11.0 is also ok).
Sorry, I do not know why your animators are not shown. Probably something is wrong with them, because I cannot reproduce this problem with TGifImage.
try this code. this will reproduce gdi leak bug easyly (especially when set the size of a window larger so the drawing area could be wider):
try to scroll it now.
But my problem is not a gdi leak (that is not a problem for me now). The problem is animation dissapearing...
Code: Select all
var i: Integer;
gif1, gif2: TGifImage;
begin
gif1 := TGifImage.Create;
gif1.LoadFromFile('kengu.gif');
for i := 1 to 20000 do begin
gif2 := TGifImage.Create;
gif2.Assign(gif1);
RichView1.AddPictureEx('', gif2, -1, rvvaBaseLine);
end;
gif1.Free;
RichView1.Format;
end;
But my problem is not a gdi leak (that is not a problem for me now). The problem is animation dissapearing...
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Well, you are right. While bitmaps were ok (used minimally), there is one more type of resource that is accumulated for each image: palettes.
I opened RVGifAnimate.pas, and added after
TGifSubImageHack(gif.Images[FrameIndex]).FreeMask:
I am not sure if this change is harmless, but after it the problem is gone.
Sorry, I do not know why your images disappearing.
I cannot reproduce this problem with TGifImage.
I opened RVGifAnimate.pas, and added after
TGifSubImageHack(gif.Images[FrameIndex]).FreeMask:
Code: Select all
TGifSubImageHack(gif.Images[FrameIndex]).Palette := 0;
gif.Palette := 0;
Sorry, I do not know why your images disappearing.
I cannot reproduce this problem with TGifImage.
sorry to dissapoint you, but your patch isn't working. show a gif with at least 15 frames, and scroll content by mouse-scroll. And take a look at task manager and the process GDI objects parameter. TGifImage by Anders Melanders is really buggy
Maybe the source of animator will be more helpful? Will upload a video of animation dissapearing in a few minutes to demonstrate how this is happening
Maybe the source of animator will be more helpful? Will upload a video of animation dissapearing in a few minutes to demonstrate how this is happening
here is the source of animator.
here is the video that describes the effect.
As you can see at the video, I've set the background of gif manually to the green color. (Instead of
i've commented that block and set
)
But sometimes, randomly, instead of drawing gif RV shows empty rect. That is definetly not a bug of the lib. But it could be wrong animator code. Maybe i lost something important. Something that tells RV not to draw it...
here is the video that describes the effect.
As you can see at the video, I've set the background of gif manually to the green color. (Instead of
Code: Select all
RVData.GetItemBackground(RVData.DrawItems[item.DrawItemNo].ItemNo, R, True,
FBackColor, bmpsrc, UseSrcBitmap);
gif.BackGroundColor := FBackColor;
if UseSrcBitmap then
gif.BackGroundBitmap := bmpsrc;
Code: Select all
gif.BackGroundColor := clGreen;
But sometimes, randomly, instead of drawing gif RV shows empty rect. That is definetly not a bug of the lib. But it could be wrong animator code. Maybe i lost something important. Something that tells RV not to draw it...