[MPlayer-dev-eng] [PATCH] EOSD support for VDPAU (2nd)
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Feb 22 20:24:28 CET 2009
On Sun, Feb 22, 2009 at 08:06:45PM +0100, Grigori G wrote:
> It should be a lot cleaner now.
Well, I agree, though you improved the part I actually wasn't talking
about (I admit I did not notice that cleanup-possibility :-) )...
I think it should look like this:
> + // None found, allocate a new surface
> + if (found < 0) {
> + for (j=0; j<eosd_surface_count; j++) {
> + if (eosd_surfaces[j].in_use == 0) {
> + if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE)
> + vdp_bitmap_surface_destroy(eosd_surfaces[j].surface);
> + found = j;
> + break;
> + }
> + }
> + // Allocate new space for surface/target arrays
> + if (found < 0) {
> + found = eosd_surface_count;
> + eosd_surface_count = eosd_surface_count ? eosd_surface_count*2 : EOSD_SURFACES_INITIAL;
> + eosd_surfaces = realloc(eosd_surfaces, eosd_surface_count * sizeof(*eosd_surfaces));
> + eosd_targets = realloc(eosd_targets, eosd_surface_count * sizeof(*eosd_targets));
> + for(j=found; j<eosd_surface_count; j++) {
> + eosd_surfaces[j].surface = VDP_INVALID_HANDLE;
> + eosd_surfaces[j].in_use = 0;
> + }
> + }
> + vdp_st = vdp_bitmap_surface_create(vdp_device, VDP_RGBA_FORMAT_A8,
> + i->w, i->h, VDP_TRUE, &eosd_surfaces[found].surface);
> + CHECK_ST_WARNING("EOSD: error when creating surface")
> + }
Thus the vdp_bitmap_surface_create is not duplicated, and the k
variable is not needed either.
I admit it needs one indentation level more, but I don't think that is
that bad...
More information about the MPlayer-dev-eng
mailing list