vfs: check userland buffers before reading them.
[haiku.git] / src / tests / servers / app / painter / BitmapView.cpp
blobca3ff752cf38846212b0527495de2664ee6a4f11
1 // BitmapView.cpp
3 #include <stdio.h>
5 #include <Bitmap.h>
7 #include "BitmapView.h"
9 // constructor
10 BitmapView::BitmapView(BRect frame, const char* name,
11 BBitmap* bitmap)
12 : BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
13 fBitmap(bitmap)
15 SetViewColor(B_TRANSPARENT_32_BIT);
16 SetHighColor(255, 0, 0, 255);
19 // destructor
20 BitmapView::~BitmapView()
22 delete fBitmap;
25 // Draw
26 void
27 BitmapView::Draw(BRect updateRect)
29 if (fBitmap) {
30 if (fBitmap->ColorSpace() == B_RGBA32) {
31 // draw the bitmap with pixel alpha
32 // against a red background
33 FillRect(updateRect);
34 SetDrawingMode(B_OP_ALPHA);
35 SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
37 DrawBitmap(fBitmap, Bounds().LeftTop());
41 // MouseDown
42 void
43 BitmapView::MouseDown(BPoint where)
47 // MouseUp
48 void
49 BitmapView::MouseUp(BPoint where)
53 // MouseMoved
54 void
55 BitmapView::MouseMoved(BPoint where, uint32 transit,
56 const BMessage* dragMessage)