Mercurial > sdl-ios-xcode
diff src/video/bwindow/SDL_sysyuv.cc @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
line wrap: on
line diff
--- a/src/video/bwindow/SDL_sysyuv.cc Mon May 29 03:53:21 2006 +0000 +++ b/src/video/bwindow/SDL_sysyuv.cc Mon May 29 04:04:35 2006 +0000 @@ -38,18 +38,18 @@ BE_FreeYUVOverlay }; - BBitmap *BE_GetOverlayBitmap (BRect bounds, color_space cs) + BBitmap *BE_GetOverlayBitmap(BRect bounds, color_space cs) { BBitmap *bbitmap; - bbitmap = new BBitmap (bounds, B_BITMAP_WILL_OVERLAY, cs); - if (!bbitmap || bbitmap->InitCheck () != B_OK) { + bbitmap = new BBitmap(bounds, B_BITMAP_WILL_OVERLAY, cs); + if (!bbitmap || bbitmap->InitCheck() != B_OK) { delete bbitmap; return 0; } overlay_restrictions r; - bbitmap->GetOverlayRestrictions (&r); - uint32 width = bounds.IntegerWidth () + 1; - uint32 height = bounds.IntegerHeight () + 1; + bbitmap->GetOverlayRestrictions(&r); + uint32 width = bounds.IntegerWidth() + 1; + uint32 height = bounds.IntegerHeight() + 1; uint32 width_padding = 0; uint32 height_padding = 0; if ((r.source.horizontal_alignment != 0) || @@ -66,10 +66,9 @@ if (r.source.height_alignment != 0) { uint32 aligned_height = r.source.height_alignment + 1; if (height % aligned_height > 0) { - fprintf (stderr, - "GetOverlayBitmap failed height alignment\n"); - fprintf (stderr, "- height = %lu, aligned_height = %lu\n", - height, aligned_height); + fprintf(stderr, "GetOverlayBitmap failed height alignment\n"); + fprintf(stderr, "- height = %lu, aligned_height = %lu\n", + height, aligned_height); delete bbitmap; return 0; } @@ -77,18 +76,18 @@ if ((r.source.min_width > width) || (r.source.min_height > height) || (r.source.max_width < width) || (r.source.max_height < height)) { - fprintf (stderr, "GetOverlayBitmap failed bounds tests\n"); + fprintf(stderr, "GetOverlayBitmap failed bounds tests\n"); delete bbitmap; return 0; } if ((width_padding != 0) || (height_padding != 0)) { delete bbitmap; - bounds.Set (bounds.left, bounds.top, - bounds.right + width_padding, - bounds.bottom + height_padding); - bbitmap = new BBitmap (bounds, B_BITMAP_WILL_OVERLAY, cs); - if (!bbitmap || bbitmap->InitCheck () != B_OK) { - fprintf (stderr, "GetOverlayBitmap failed late\n"); + bounds.Set(bounds.left, bounds.top, + bounds.right + width_padding, + bounds.bottom + height_padding); + bbitmap = new BBitmap(bounds, B_BITMAP_WILL_OVERLAY, cs); + if (!bbitmap || bbitmap->InitCheck() != B_OK) { + fprintf(stderr, "GetOverlayBitmap failed late\n"); delete bbitmap; return 0; } @@ -98,7 +97,7 @@ // See <GraphicsDefs.h> [btw: Cb=U, Cr=V] // See also http://www.fourcc.org/indexyuv.htm - enum color_space convert_color_space (Uint32 format) + enum color_space convert_color_space(Uint32 format) { switch (format) { case SDL_YV12_OVERLAY: @@ -117,7 +116,7 @@ } // See SDL_video.h - int count_planes (Uint32 format) + int count_planes(Uint32 format) { switch (format) { case SDL_YV12_OVERLAY: @@ -132,8 +131,8 @@ } } - SDL_Overlay *BE_CreateYUVOverlay (_THIS, int width, int height, - Uint32 format, SDL_Surface * display) + SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, + Uint32 format, SDL_Surface * display) { SDL_Overlay *overlay; struct private_yuvhwdata *hwdata; @@ -143,13 +142,13 @@ color_space cs; /* find the appropriate BeOS colorspace descriptor */ - cs = convert_color_space (format); + cs = convert_color_space(format); if (cs == B_NO_COLOR_SPACE) { return NULL; } /* count planes */ - planes = count_planes (format); + planes = count_planes(format); if (planes == 0) { return NULL; } @@ -159,10 +158,10 @@ } /* Create the overlay structure */ - overlay = (SDL_Overlay *) SDL_calloc (1, sizeof (SDL_Overlay)); + overlay = (SDL_Overlay *) SDL_calloc(1, sizeof(SDL_Overlay)); if (overlay == NULL) { - SDL_OutOfMemory (); + SDL_OutOfMemory(); return NULL; } @@ -177,13 +176,13 @@ /* Create the pixel data and lookup tables */ hwdata = - (struct private_yuvhwdata *) SDL_calloc (1, - sizeof (struct - private_yuvhwdata)); + (struct private_yuvhwdata *) SDL_calloc(1, + sizeof(struct + private_yuvhwdata)); if (hwdata == NULL) { - SDL_OutOfMemory (); - SDL_FreeYUVOverlay (overlay); + SDL_OutOfMemory(); + SDL_FreeYUVOverlay(overlay); return NULL; } @@ -200,60 +199,60 @@ bounds.bottom = height - 1; BView *bview = - new BView (bounds, "overlay", B_FOLLOW_NONE, B_WILL_DRAW); + new BView(bounds, "overlay", B_FOLLOW_NONE, B_WILL_DRAW); if (!bview) { - SDL_OutOfMemory (); - SDL_FreeYUVOverlay (overlay); + SDL_OutOfMemory(); + SDL_FreeYUVOverlay(overlay); return NULL; } overlay->hwdata->bview = bview; overlay->hwdata->first_display = true; - bview->Hide (); + bview->Hide(); - bbitmap = BE_GetOverlayBitmap (bounds, cs); + bbitmap = BE_GetOverlayBitmap(bounds, cs); if (!bbitmap) { overlay->hwdata->bbitmap = NULL; - SDL_FreeYUVOverlay (overlay); + SDL_FreeYUVOverlay(overlay); return NULL; } overlay->hwdata->bbitmap = bbitmap; overlay->planes = planes; overlay->pitches = - (Uint16 *) SDL_calloc (overlay->planes, sizeof (Uint16)); + (Uint16 *) SDL_calloc(overlay->planes, sizeof(Uint16)); overlay->pixels = - (Uint8 **) SDL_calloc (overlay->planes, sizeof (Uint8 *)); + (Uint8 **) SDL_calloc(overlay->planes, sizeof(Uint8 *)); if (!overlay->pitches || !overlay->pixels) { - SDL_OutOfMemory (); - SDL_FreeYUVOverlay (overlay); + SDL_OutOfMemory(); + SDL_FreeYUVOverlay(overlay); return (NULL); } - overlay->pitches[0] = bbitmap->BytesPerRow (); - overlay->pixels[0] = (Uint8 *) bbitmap->Bits (); + overlay->pitches[0] = bbitmap->BytesPerRow(); + overlay->pixels[0] = (Uint8 *) bbitmap->Bits(); overlay->hw_overlay = 1; - if (SDL_Win->LockWithTimeout (1000000) != B_OK) { - SDL_FreeYUVOverlay (overlay); + if (SDL_Win->LockWithTimeout(1000000) != B_OK) { + SDL_FreeYUVOverlay(overlay); return (NULL); } - BView *view = SDL_Win->View (); - view->AddChild (bview); + BView *view = SDL_Win->View(); + view->AddChild(bview); rgb_color key; - bview->SetViewOverlay (bbitmap, bounds, bview->Bounds (), &key, - B_FOLLOW_ALL, - B_OVERLAY_FILTER_HORIZONTAL | - B_OVERLAY_FILTER_VERTICAL); - bview->SetViewColor (key); - bview->Flush (); - SDL_Win->Unlock (); + bview->SetViewOverlay(bbitmap, bounds, bview->Bounds(), &key, + B_FOLLOW_ALL, + B_OVERLAY_FILTER_HORIZONTAL | + B_OVERLAY_FILTER_VERTICAL); + bview->SetViewColor(key); + bview->Flush(); + SDL_Win->Unlock(); current_overlay = overlay; return overlay; } - int BE_LockYUVOverlay (_THIS, SDL_Overlay * overlay) + int BE_LockYUVOverlay(_THIS, SDL_Overlay * overlay) { if (overlay == NULL) { return 0; @@ -263,7 +262,7 @@ return 0; } - void BE_UnlockYUVOverlay (_THIS, SDL_Overlay * overlay) + void BE_UnlockYUVOverlay(_THIS, SDL_Overlay * overlay) { if (overlay == NULL) { return; @@ -272,36 +271,36 @@ overlay->hwdata->locked = 0; } - int BE_DisplayYUVOverlay (_THIS, SDL_Overlay * overlay, SDL_Rect * src, - SDL_Rect * dst) + int BE_DisplayYUVOverlay(_THIS, SDL_Overlay * overlay, SDL_Rect * src, + SDL_Rect * dst) { if ((overlay == NULL) || (overlay->hwdata == NULL) - || (overlay->hwdata->bview == NULL) || (SDL_Win->View () == NULL)) { + || (overlay->hwdata->bview == NULL) || (SDL_Win->View() == NULL)) { return -1; } - if (SDL_Win->LockWithTimeout (50000) != B_OK) { + if (SDL_Win->LockWithTimeout(50000) != B_OK) { return 0; } BView *bview = overlay->hwdata->bview; - if (SDL_Win->IsFullScreen ()) { + if (SDL_Win->IsFullScreen()) { int left, top; - SDL_Win->GetXYOffset (left, top); - bview->MoveTo (left + dst->x, top + dst->y); + SDL_Win->GetXYOffset(left, top); + bview->MoveTo(left + dst->x, top + dst->y); } else { - bview->MoveTo (dst->x, dst->y); + bview->MoveTo(dst->x, dst->y); } - bview->ResizeTo (dst->w, dst->h); - bview->Flush (); + bview->ResizeTo(dst->w, dst->h); + bview->Flush(); if (overlay->hwdata->first_display) { - bview->Show (); + bview->Show(); overlay->hwdata->first_display = false; } - SDL_Win->Unlock (); + SDL_Win->Unlock(); return 0; } - void BE_FreeYUVOverlay (_THIS, SDL_Overlay * overlay) + void BE_FreeYUVOverlay(_THIS, SDL_Overlay * overlay) { if (overlay == NULL) { return; @@ -315,7 +314,7 @@ delete overlay->hwdata->bbitmap; - SDL_free (overlay->hwdata); + SDL_free(overlay->hwdata); } }; // extern "C"