Example #1
0
bool
Scaler::Matches(BRect rect, bool dither) const
{
	return fRect.IntegerWidth() == rect.IntegerWidth() &&
		fRect.IntegerHeight() == rect.IntegerHeight() &&
		fDither == dither;
}
Example #2
0
SoftPipeRenderer::SoftPipeRenderer(BGLView *view, ulong options,
		BGLDispatcher* dispatcher)
	: BGLRenderer(view, options, dispatcher),
	fBitmap(NULL),
	fDirectModeEnabled(false),
	fInfo(NULL),
	fInfoLocker("info locker"),
	fOptions(options),
	fColorSpace(B_NO_COLOR_SPACE)
{
	CALLED();
	time_t beg, end;
	beg = time(NULL);
	hsp_init(options);
	end = time(NULL);
	TRACE("hsp_init time: %f.\n", difftime(end, beg));
	BRect b = GLView()->Bounds();
	fColorSpace = B_RGBA32;
	if (fDirectModeEnabled && fInfo != NULL) {
		fColorSpace = BScreen(GLView()->Window()).ColorSpace();
	}
	int32 width = b.IntegerWidth();// + 1;
	int32 height = b.IntegerHeight();// + 1;
	TRACE("ColorSpace:\t%s\n", color_space_name(fColorSpace));
	fBitmap = new BBitmap(BRect(0.f, 0.f, width /*- 1*/, height /*- 1*/), fColorSpace);
	fWidth = width;
	fHeight = height;
	beg = time(NULL);
	fContext = hsp_create_layer_context(fBitmap, 0);
	TRACE("context:\t%d\n", (int)fContext);
	end = time(NULL);
	TRACE("hsp_create_layer_context time: %f.\n", difftime(end, beg));
	if (!hsp_get_current_context())
		LockGL();
}
Example #3
0
// ToolDraw
void
PickManipulator::ToolDraw(BView* into, BRect itemFrame)
{
	if (itemFrame.IntegerWidth() < 4)
		return;

	itemFrame.InsetBy(1, 1);
	int32 dotCount = itemFrame.IntegerHeight() / 3;

	BPoint p(itemFrame.LeftTop());
	for (int32 i = 0; i < dotCount; i++) {
		into->SetHighColor(0, 0, 0, 75);
		into->StrokeLine(p, p);
		p = p + BPoint(1, 1);
		into->SetHighColor(255, 255, 255, 200);
		into->StrokeLine(p, p);
		p = p + BPoint(-1, 2);
	}

	itemFrame.right--;
	if (itemFrame.IntegerWidth() < 6)
		return;

	p = itemFrame.RightTop();
	for (int32 i = 0; i < dotCount; i++) {
		into->SetHighColor(0, 0, 0, 75);
		into->StrokeLine(p, p);
		p = p + BPoint(1, 1);
		into->SetHighColor(255, 255, 255, 200);
		into->StrokeLine(p, p);
		p = p + BPoint(-1, 2);
	}
}
Example #4
0
void
ShowImageWindow::_SaveWidthAndHeight()
{
	if (fNavigator.CurrentPage() != 1)
		return;

	if (fImageView->Bitmap() == NULL)
		return;

	BRect bounds = fImageView->Bitmap()->Bounds();
	int32 width = bounds.IntegerWidth() + 1;
	int32 height = bounds.IntegerHeight() + 1;

	BNode node(&fNavigator.CurrentRef());
	if (node.InitCheck() != B_OK)
		return;

	const char* kWidthAttrName = "Media:Width";
	const char* kHeightAttrName = "Media:Height";

	int32 widthAttr;
	ssize_t attrSize = node.ReadAttr(kWidthAttrName, B_INT32_TYPE, 0,
		&widthAttr, sizeof(widthAttr));
	if (attrSize <= 0 || widthAttr != width)
		node.WriteAttr(kWidthAttrName, B_INT32_TYPE, 0, &width, sizeof(width));

	int32 heightAttr;
	attrSize = node.ReadAttr(kHeightAttrName, B_INT32_TYPE, 0,
		&heightAttr, sizeof(heightAttr));
	if (attrSize <= 0 || heightAttr != height)
		node.WriteAttr(kHeightAttrName, B_INT32_TYPE, 0, &height, sizeof(height));
}
PPSize
DisplayDevice_Haiku::getDisplayResolution() const
{
	BScreen screen;
	BRect frame = screen.Frame();
	return PPSize(frame.IntegerWidth(), frame.IntegerHeight());
}
Example #6
0
Size2 OS_Haiku::get_screen_size(int p_screen) const {
	// TODO: make this work with the p_screen parameter
	BScreen *screen = new BScreen(window);
	BRect frame = screen->Frame();
	delete screen;
	return Size2i(frame.IntegerWidth() + 1, frame.IntegerHeight() + 1);
}
Example #7
0
// FrameResized
void
ColorField::FrameResized(float width, float height)
{
	BRect r = _BitmapRect();
	_AllocBitmap(r.IntegerWidth() + 1, r.IntegerHeight() + 1);
	Invalidate();
}
Example #8
0
void MesaDriver::GetBufferSize(GLframebuffer * framebuffer, GLuint *width,
                            GLuint *height)
{
   GET_CURRENT_CONTEXT(ctx);
   if (!ctx)
		return;

   MesaDriver * md = (MesaDriver *) ctx->DriverCtx;
   BGLView *bglview = md->m_bglview;
   assert(bglview);

   BRect b = bglview->Bounds();
   *width = (GLuint) b.IntegerWidth() + 1; // (b.right - b.left + 1);
   *height = (GLuint) b.IntegerHeight() + 1; // (b.bottom - b.top + 1);
   md->m_bottom = (GLint) b.bottom;

   if (ctx->Visual.doubleBufferMode) {
      if (*width != md->m_width || *height != md->m_height) {
         // allocate new size of back buffer bitmap
         if (md->m_bitmap)
            delete md->m_bitmap;
         BRect rect(0.0, 0.0, *width - 1, *height - 1);
         md->m_bitmap = new BBitmap(rect, B_RGBA32);
      }
   }
   else
   {
      md->m_bitmap = NULL;
   }

   md->m_width = *width;
   md->m_height = *height;
}
Example #9
0
status_t
Controller::ReadBitmap(BBitmap* bitmap, bool includeCursor, BRect bounds)
{
	const bool &useDirectWindow = Settings().UseDirectWindow()
		&& fDirectWindowAvailable;
	
	if (!useDirectWindow)
		return BScreen().ReadBitmap(bitmap, includeCursor, &bounds);
		
	int32 bytesPerPixel = fDirectInfo.bits_per_pixel >> 3;
	if (bytesPerPixel <= 0)
		return B_ERROR;

	uint32 rowBytes = fDirectInfo.bytes_per_row / bytesPerPixel;
	const int32 offset = ((uint32)bounds.left +
		 ((uint32)bounds.top * rowBytes)) * bytesPerPixel;

	int32 height = bounds.IntegerHeight() + 1;
	void* from = (void*)((uint8*)fDirectInfo.bits + offset);    		
	void* to = bitmap->Bits();
	int32 bytesPerRow = bitmap->BytesPerRow();
	int32 areaSize = (bounds.IntegerWidth() + 1) * bytesPerPixel;
	for (int32 y = 0; y < height; y++) {  
		memcpy(to, from, areaSize);
	   	to = (void*)((uint8*)to + bytesPerRow);
		from = (void*)((uint8*)from + fDirectInfo.bytes_per_row);
	}
	 
	return B_OK;
}
Example #10
0
/* virtual */
void
HeaderListItem::DrawItem(BView *owner, BRect itemRect, bool drawEverthing)
{
	owner->SetDrawingMode(B_OP_COPY);

	owner->PushState();
	if (IsSelected()) {
		rgb_color lowColor = owner->LowColor();
		owner->SetHighColor(tint_color(lowColor, B_DARKEN_2_TINT));
		owner->FillRect(itemRect);
	}

	owner->PopState();

	itemRect.InsetBy(0, 1);
	owner->StrokeRect(itemRect);

	itemRect.InsetBy(1, 0);

	owner->SetDrawingMode(B_OP_OVER);

	BFont font;
	owner->GetFont(&font);
	float baseLine = itemRect.top + (itemRect.IntegerHeight() / 2 + font.Size() / 2);

	for (int32 c = 0; c < sizeof(fLabels) / sizeof(fLabels[0]); c++) {
		owner->MovePenTo(itemRect.left + 1 + (fRect.Width() + kDistance) * c, baseLine);
		owner->DrawString(fLabels[c]);
	}
}
Example #11
0
/*!	\brief Returns the frame of the specified workspace within the
		workspaces view.
*/
BRect
WorkspacesView::_WorkspaceAt(int32 i)
{
	int32 columns, rows;
	_GetGrid(columns, rows);

	BRect frame = Bounds();
	ConvertToScreen(&frame);

	int32 width = frame.IntegerWidth() / columns;
	int32 height = frame.IntegerHeight() / rows;

	int32 column = i % columns;
	int32 row = i / columns;

	BRect rect(column * width, row * height, (column + 1) * width,
		(row + 1) * height);

	rect.OffsetBy(frame.LeftTop());

	// make sure there is no gap anywhere
	if (column == columns - 1)
		rect.right = frame.right;
	if (row == rows - 1)
		rect.bottom = frame.bottom;

	return rect;
}
Example #12
0
ViewBuffer::ViewBuffer(BRect frame)
	:	BView(frame, "ViewBuffer", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS),
		fColumns(frame.IntegerWidth() / CHAR_WIDTH),
		fRows(frame.IntegerHeight() / CHAR_HEIGHT),
		fGlyphGrid(NULL),
		fResizeCallback(NULL),
		// initially, the cursor is hidden
		fCursorX(-1),
		fCursorY(-1)
{
	SetFont(be_fixed_font);
	
	// initialize private palette
	for (int i = 0; i < 8; i++) {
		fPalette[i].red = (sPalette32[i] >> 16) & 0xff;
		fPalette[i].green = (sPalette32[i] >> 8) & 0xff;
		fPalette[i].blue = (sPalette32[i] >> 0) & 0xff;
		fPalette[i].alpha = 0xff;
	}

	// initialize glyph grid
	uint32 size = fRows * fColumns;
	if (size > 0) {
		fGlyphGrid = new uint16[size];
		memset(fGlyphGrid, 0, size * sizeof(uint16));
	}
}
Example #13
0
static void testSetOriginAndScale4(BView *view, BRect frame)
{
	frame.InsetBy(2, 2);
	BPoint center = centerPoint(frame);
	
	BRect r(0, 0, frame.IntegerWidth() / 2, frame.IntegerHeight() / 2);
	view->SetOrigin(center);
	view->FillRect(r);
	
	view->SetScale(0.5);
	view->SetHighColor(kRed);
	view->FillRect(r);
	
	view->PushState();
		// 
		view->SetOrigin(center.x+1, center.y);
			// +1 to work around BeOS bug
			// where setting the origin has no
			// effect if it is the same as
			// the previous value althou
			// it is from the "outer" coordinate
			// system
		view->SetHighColor(kGreen);
		view->FillRect(r);
	view->PopState();
}
Example #14
0
/*****************************************************************************
 * VideoWindow::SetFullScreen
 *****************************************************************************/
void
VideoWindow::SetFullScreen(bool doIt)
{
    if (doIt)
    {
        SetLook( B_NO_BORDER_WINDOW_LOOK );
        BScreen screen( this );
        BRect rect = screen.Frame();
        Activate();
        MoveTo(0.0, 0.0);
        ResizeTo(rect.IntegerWidth(), rect.IntegerHeight());
        be_app->ObscureCursor();
        fInterfaceShowing = false;
        fSettings->AddFlags(VideoSettings::FLAG_FULL_SCREEN);
    }
    else
    {
        SetLook( B_TITLED_WINDOW_LOOK );
        MoveTo(winSize.left, winSize.top);
        ResizeTo(winSize.IntegerWidth(), winSize.IntegerHeight());
        be_app->ShowCursor();
        fInterfaceShowing = true;
        fSettings->ClearFlags(VideoSettings::FLAG_FULL_SCREEN);
    }
}
Example #15
0
// Get total size
void wxWindowBeOS::DoGetSize(int *x, int *y) const
{
    if (m_view)
    {
        BRect bounds = m_view->bounds();
        *x = bounds.IntegerWidth();
        *y = bounds.IntegerHeight();
    }
}
Example #16
0
// FrameResized
void
AlphaSlider::FrameResized(float width, float height)
{
	BRect r = _BitmapRect();
	_AllocBitmap(r.IntegerWidth() + 1, r.IntegerHeight() + 1);
	_UpdateColors();
	Invalidate();
	
}
Example #17
0
void
RemoteDrawingEngine::DrawBitmap(ServerBitmap* bitmap, const BRect& _bitmapRect,
	const BRect& _viewRect, uint32 options)
{
	if (!fClippingRegion.Intersects(_viewRect))
		return;

	BRect viewRect = _viewRect;
	BRect bitmapRect = _bitmapRect;
	if (bitmapRect.IntegerWidth() == viewRect.IntegerWidth()
		&& bitmapRect.IntegerHeight() == viewRect.IntegerHeight()) {
		// unscaled bitmap we can chop off stuff we don't need
		BRegion target(viewRect);
		target.IntersectWith(&fClippingRegion);
		BRect frame = target.Frame();

		if (frame != viewRect) {
			BPoint offset = frame.LeftTop() - viewRect.LeftTop();
			viewRect = frame;
			bitmapRect = viewRect.OffsetToCopy(bitmapRect.LeftTop() + offset);
		}
	}

	UtilityBitmap* other = NULL;
	BRect bounds = bitmap->Bounds();
	BRect newBounds;
	newBounds.right
		= min_c(bounds.IntegerWidth(), bitmapRect.IntegerWidth());
	newBounds.bottom	
		= min_c(bounds.IntegerHeight(), bitmapRect.IntegerHeight());

	if (newBounds.IntegerWidth() < bounds.IntegerWidth()
		|| newBounds.IntegerHeight() < bounds.IntegerHeight()) {

		other = new(std::nothrow) UtilityBitmap(newBounds, bitmap->ColorSpace(),
			bitmap->Flags());

		if (other != NULL && other->ImportBits(bitmap->Bits(),
				bitmap->BitsLength(), bitmap->BytesPerRow(),
				bitmap->ColorSpace(), bitmapRect.LeftTop(), BPoint(0, 0),
				newBounds.IntegerWidth() + 1,
				newBounds.IntegerHeight() + 1) == B_OK) {
			bitmapRect.OffsetTo(0, 0);
			bitmap = other;
		}
	}

	// TODO: we may want to cache/checksum bitmaps
	RemoteMessage message(NULL, fHWInterface->SendBuffer());
	message.Start(RP_DRAW_BITMAP);
	message.Add(fToken);
	message.Add(bitmapRect);
	message.Add(viewRect);
	message.Add(options);
	message.AddBitmap(*bitmap);

	if (other != NULL)
		delete other;
}
void
EditButtonWindow::SetGlobalInformation(void)
{
	WrkWindow *wi;

	if (gad)
	{
		OldWindow = NULL;

		if (gad != last)
		{
			left->SetValue(gad->x);
			top->SetValue(gad->y);
			width->SetValue(gad->wi);
			height->SetValue(gad->he);

			title->SetText(&gad->Title[0]);
			name->SetText(&gad->Name[0]);
	
			derived->SetValue(gad->derived);

			switch(gad->align)
			{
				case	FOLLOW_NONE:
				case	FOLLOW_ALL:
				{
					EnableRadio(false);
				}
				break;
			
				default:
				{
					EnableRadio(true);
				}
				break;
			}
		}

		last = gad;
	}
		else
	{
		if (wi = DefWin)
		{
			BRect rct = wi->Frame();
		
			left->SetValue((int)rct.left);
			top->SetValue((int)rct.top);
			width->SetValue(rct.IntegerWidth());
			height->SetValue(rct.IntegerHeight());

			title->SetText(&wi->WTitle[0]);
			name->SetText(&wi->Name[0]);
		}	
	}
}
static cairo_rectangle_int16_t
_brect_to_cairo_rect (const BRect& rect)
{
    cairo_rectangle_int16_t retval;
    retval.x = int(rect.left + 0.5);
    retval.y = int(rect.top + 0.5);
    retval.width = rect.IntegerWidth() + 1;
    retval.height = rect.IntegerHeight() + 1;
    return retval;
}
Example #20
0
void
FieldView::Draw(BRect update)
{
	if (fPauseMode)
	{
		SetHighColor(128,128,128);
		FillRect(Bounds());
		SetHighColor(255,255,255);
		SetDrawingMode(B_OP_ALPHA);

		BFont font;
		font.SetSize(28.0);
		font_height fh;
		font.GetHeight(&fh);
		float width = font.StringWidth(B_TRANSLATE("PAUSED"));
		SetFont(&font);
		float y = (Bounds().Height() / 3) + fh.ascent;
		DrawString(B_TRANSLATE("PAUSED"),BPoint( (Bounds().Width() - width) / 2.0,y));
		SetFont(be_plain_font);
		y += fh.descent + fh.leading + 10.0;
		width = be_plain_font->StringWidth(B_TRANSLATE("Click to resume"));
		DrawString(B_TRANSLATE("Click to resume"),BPoint( (Bounds().Width() - width) / 2.0,y));
	}
	else
	{
		// The corresponding box numbers for the update rectangle
		uint16 leftx,rightx,topy,bottomy;

		BRect r = gGameStyle->TileSize();

		// We have to do this because of a bug in BRect::Width()/Height()
		// A rect of (0,0,23,23) will return a Width/Height of 23, not 24.
		int32 tilewidth = r.IntegerWidth() + 1;
		int32 tileheight = r.IntegerHeight() + 1;
		leftx = uint16(update.left / tilewidth);
		rightx = uint16(update.right / tilewidth);
		topy = uint16(update.top / tileheight);
		bottomy = uint16(update.bottom / tileheight);

		for (uint16 y = topy; y <= bottomy; y++)
			for (uint16 x = leftx; x <= rightx; x++)
			{
				bool down = false;
				if (fTracking && fSelection.x == x && fSelection.y == y)
					down = true;
				DrawBox(x,y, down);
			}

		if (gGameState == GAME_OVER)
		{
			SetHighColor(64,64,64,72);
			FillRect(Bounds());
		}
	}
}
Example #21
0
BBitmap*
Utility::MakeScreenshot(bool includeMouse, bool activeWindow,
	bool includeBorder) const
{
	if (wholeScreen == NULL)
		return NULL;

	BRect bounds = cursorBitmap->Bounds();
	int cursorWidth = bounds.IntegerWidth() + 1;
	int cursorHeight = bounds.IntegerHeight() + 1;

	if (includeMouse && cursorBitmap != NULL) {
		// Import the cursor bitmap into wholeScreen
		wholeScreen->ImportBits(cursorBitmap->Bits(),
			cursorBitmap->BitsLength(), cursorBitmap->BytesPerRow(),
			cursorBitmap->ColorSpace(), BPoint(0, 0), cursorPosition,
			cursorWidth, cursorHeight);

	} else if (cursorAreaBitmap != NULL) {
		// Import the cursor area bitmap into wholeScreen
		wholeScreen->ImportBits(cursorAreaBitmap->Bits(),
			cursorAreaBitmap->BitsLength(), cursorAreaBitmap->BytesPerRow(),
			cursorAreaBitmap->ColorSpace(), BPoint(0, 0), cursorPosition,
			cursorWidth, cursorHeight);
	}

	BBitmap* screenshot = NULL;

	if (activeWindow && activeWindowFrame.IsValid()) {

		BRect frame(activeWindowFrame);	
		if (includeBorder) {
			frame.InsetBy(-borderSize, -borderSize);
			frame.top -= tabFrame.bottom - tabFrame.top;
		}

		screenshot = new BBitmap(frame.OffsetToCopy(B_ORIGIN), B_RGBA32, true);

		if (screenshot->ImportBits(wholeScreen->Bits(),
			wholeScreen->BitsLength(), wholeScreen->BytesPerRow(),
			wholeScreen->ColorSpace(), frame.LeftTop(),
			BPoint(0, 0), frame.IntegerWidth() + 1,
			frame.IntegerHeight() + 1) != B_OK) {
			delete screenshot;
			return NULL;
		}

		if (includeBorder)
			_MakeTabSpaceTransparent(screenshot, frame);
	} else
		screenshot = new BBitmap(wholeScreen);

	return screenshot;
}
Example #22
0
void 
KnobSwitch::GetPreferredSize(float *width, float *height) 
{ 
        BRect bounds; 
        if (fUpBmap) { 
                bounds = fUpBmap->Bounds(); 
        } else { 
                bounds = Bounds(); 
        } 
        *width = bounds.IntegerWidth(); 
        *height = bounds.IntegerHeight(); 
} 
Example #23
0
IntelRenderer::IntelRenderer(BGLView *view, ulong options,
	BGLDispatcher* dispatcher)
	:
	BGLRenderer(view, options, dispatcher),
	fBitmap(NULL),
	fDirectModeEnabled(false),
	fInfo(NULL),
	fInfoLocker("info locker"),
	fOptions(options),
	fColorSpace(B_NO_COLOR_SPACE)
{
	CALLED();

	// Disable double buffer for the moment.
	options &= ~BGL_DOUBLE;

	// Initialize the "Haiku Software GL Pipe"
	time_t beg;
	time_t end;
	beg = time(NULL);
	fContextObj = new GalliumContext(options);
	end = time(NULL);
	TRACE("Haiku Intel GL Pipe initialization time: %f.\n",
		difftime(end, beg));

	// Allocate a bitmap
	BRect b = view->Bounds();
	fColorSpace = BScreen(view->Window()).ColorSpace();
	TRACE("%s: Colorspace:\t%s\n", __func__, color_space_name(fColorSpace));

	fWidth = (GLint)b.IntegerWidth();
	fHeight = (GLint)b.IntegerHeight();
	fNewWidth = fWidth;
	fNewHeight = fHeight;

	_AllocateBitmap();

	// Initialize the first "Haiku Intel GL Pipe" context
	beg = time(NULL);
	fContextID = fContextObj->CreateContext(fBitmap);
	end = time(NULL);

	if (fContextID < 0)
		ERROR("%s: There was an error creating the context!\n", __func__);
	else {
		TRACE("%s: Haiku Intel GL Pipe context creation time: %f.\n",
			__func__, difftime(end, beg));
	}

	if (!fContextObj->GetCurrentContext())
		LockGL();
}
Example #24
0
static void testSetOriginAndScale(BView *view, BRect frame)
{
	frame.InsetBy(2, 2);
	BPoint center = centerPoint(frame);
	
	BRect r(0, 0, frame.IntegerWidth() / 2, frame.IntegerHeight() / 2);
	view->SetOrigin(center);
	view->FillRect(r);
	
	view->SetScale(0.5);
	view->SetHighColor(kRed);
	view->FillRect(r);
}
Example #25
0
void 
OutputView::BuildCodecMenu(const media_format_family &family)
{
	Settings settings;
	BRect rect = settings.CaptureArea();//ClipFrame();
	rect.right++;
	rect.bottom++;
		
	GetCodecsForFamily(family, (const int32 &)rect.IntegerWidth(),
		(const int32 &)rect.IntegerHeight(), fCodecMenu->Menu(), fFormat);
		
	// Make the app object the menu's message target
	fCodecMenu->Menu()->SetTargetForItems(this);
}
Example #26
0
void
ShowImageWindow::_UpdateStatusText(const BMessage* message)
{
	BString frameText;
	if (fImageView->Bitmap() != NULL) {
		BRect bounds = fImageView->Bitmap()->Bounds();
		frameText << bounds.IntegerWidth() + 1
			<< "x" << bounds.IntegerHeight() + 1;
	}
	BString pages;
	if (fNavigator.PageCount() > 1)
		pages << fNavigator.CurrentPage() << "/" << fNavigator.PageCount();
	fStatusView->Update(fNavigator.CurrentRef(), frameText, pages, fImageType,
		fImageView->Zoom());
}
Example #27
0
/*****************************************************************************
 * VideoWindow constructor and destructor
 *****************************************************************************/
VideoWindow::VideoWindow(int v_width, int v_height, BRect frame,
                         vout_thread_t *p_videoout)
    : BWindow(frame, NULL, B_TITLED_WINDOW, B_NOT_CLOSABLE | B_NOT_MINIMIZABLE),
      i_width(frame.IntegerWidth()),
      i_height(frame.IntegerHeight()),
      winSize(frame),
      i_buffer(0),
      teardownwindow(false),
      fTrueWidth(v_width),
      fTrueHeight(v_height),
      fCachedFeel(B_NORMAL_WINDOW_FEEL),
      fInterfaceShowing(false),
      fInitStatus(B_ERROR),
      fSettings(new VideoSettings(*VideoSettings::DefaultSettings()))
{
    p_vout = p_videoout;

    // create the view to do the display
    view = new VLCView( Bounds(), p_vout );

    // create background view
    BView *mainView =  new BackgroundView( Bounds(), view );
    AddChild(mainView);
    mainView->AddChild(view);

    // allocate bitmap buffers
    for (int32_t i = 0; i < 3; i++)
        bitmap[i] = NULL;
    fInitStatus = _AllocateBuffers(v_width, v_height, &mode);

    // make sure we layout the view correctly
    FrameResized(i_width, i_height);

    if (fInitStatus >= B_OK && mode == OVERLAY)
    {
       overlay_restrictions r;

       bitmap[0]->GetOverlayRestrictions(&r);
       SetSizeLimits((i_width * r.min_width_scale), i_width * r.max_width_scale,
                     (i_height * r.min_height_scale), i_height * r.max_height_scale);
    }

    // vlc settings override settings from disk
    if (config_GetInt(p_vout, "fullscreen"))
        fSettings->AddFlags(VideoSettings::FLAG_FULL_SCREEN);

    _SetToSettings();
}
Example #28
0
static void testSetFontSize(BView *view, BRect frame)
{
	frame.InsetBy(2, 2);
	int size = frame.IntegerHeight() / 3;
	
	frame.OffsetBy(0, size);
	view->MovePenTo(BPoint(frame.left, frame.top));
	view->SetFontSize(size);
	view->DrawString("Haiku");
	
	size *= 2;	
	frame.OffsetBy(0, size);
	view->MovePenTo(BPoint(frame.left, frame.top));
	view->SetFontSize(size);
	view->DrawString("Haiku");	
}
Example #29
0
void TutGLView::AttachedToWindow( void )
{
	// Make keyboard/mouse input go to this view when its window has
	// focus (that'll stay in effect until another view calls MakeFocus()
	// or the user puts the focus on a control... which won't happen in
	// this app because there are no other views and no controls).
	MakeFocus();

	// Initialize OpenGL; gInit() sets things up, gReshape() makes sure
	// OpenGL knows about the view's size/shape.
	LockGL();
	BGLView::AttachedToWindow();
	gInit();
	BRect r = Bounds();
	gReshape( r.IntegerWidth(), r.IntegerHeight() );
	UnlockGL();
}
Example #30
0
void
SATWindow::_UpdateSizeLimits()
{
	int32 minWidth, minHeight;
	int32 maxWidth, maxHeight;
	fWindow->GetSizeLimits(&fOriginalMinWidth, &maxWidth,
		&fOriginalMinHeight, &maxHeight);
	minWidth = fOriginalMinWidth;
	minHeight = fOriginalMinHeight;
	if (maxWidth != B_SIZE_UNLIMITED)
		fOriginalMaxWidth = maxWidth;
	if (maxHeight != B_SIZE_UNLIMITED)
		fOriginalMaxHeight = maxHeight;
	SATDecorator* decorator = GetDecorator();
	// if no size limit is set but the window is not resizeable choose the
	// current size as limit
	if (fWindow->Look() == B_MODAL_WINDOW_LOOK
		|| fWindow->Look() == B_BORDERED_WINDOW_LOOK
		|| fWindow->Look() == B_NO_BORDER_WINDOW_LOOK
		|| (fWindow->Flags() & B_NOT_RESIZABLE) != 0
		|| (fWindow->Flags() & B_NOT_H_RESIZABLE) != 0
		|| (fWindow->Flags() & B_NOT_V_RESIZABLE) != 0) {
		int32 minDecorWidth = 1, maxDecorWidth = 1;
		int32 minDecorHeight = 1, maxDecorHeight = 1;
		if (decorator)
			decorator->GetSizeLimits(&minDecorWidth, &minDecorHeight,
				&maxDecorWidth, &maxDecorHeight);
		BRect frame = fWindow->Frame();
		if (fOriginalMinWidth <= minDecorWidth)
			minWidth = frame.IntegerWidth();
		if (fOriginalMinHeight <= minDecorHeight)
			minHeight = frame.IntegerHeight();
	}
	fWindow->SetSizeLimits(minWidth, B_SIZE_UNLIMITED,
		minHeight, B_SIZE_UNLIMITED);


	if (decorator) {
		minWidth += 2 * (int32)decorator->BorderWidth();
		minHeight += 2 * (int32)decorator->BorderWidth()
			+ (int32)decorator->TabHeight() + 1;
	}
	fGroupCookie->SetSizeLimits(minWidth, B_SIZE_UNLIMITED, minHeight,
		B_SIZE_UNLIMITED);
}