* implemented view bitmap options (B_BITMAP_TILE...) in
ViewLayer (for example, fixes NetPositive rendering HTML with a background image) * use BRegion pool everywhere in ViewLayer * WindowLayer update sessions distinguish between different reasons for the update: exposed and requested - on expose updates, the view backgrounds are cleared immidiately (as on R5), to keep the time previous stuff keeps showing as short as possible, while on requested updates, the background clearing is delayed until the client draws something, to keep the time until the client fills a view with content as small as possible to reduce flickering (might need more work, could be buggy yet) * HWInterface and DrawingEngine support delayed syncing to the graphics hardware at least for FillRect/Region. The speed up gained by this is minor though. * HWInterface cursor rendering uses a bit of rounding to avoid the slight transparent shadow around the cursor (I don't know if it is fully correct though, at least the shasow disappeared) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17172 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -103,6 +103,7 @@ Server haiku_app_server :
|
||||
AccelerantBuffer.cpp
|
||||
AccelerantHWInterface.cpp
|
||||
BitmapBuffer.cpp
|
||||
drawing_support.cpp
|
||||
DrawingEngine.cpp
|
||||
MallocBuffer.cpp
|
||||
UpdateQueue.cpp
|
||||
@@ -148,6 +149,7 @@ SubInclude HAIKU_TOP src tests servers app copy_bits ;
|
||||
SubInclude HAIKU_TOP src tests servers app cursor_test ;
|
||||
SubInclude HAIKU_TOP src tests servers app desktop_window ;
|
||||
SubInclude HAIKU_TOP src tests servers app event_mask ;
|
||||
SubInclude HAIKU_TOP src tests servers app following ;
|
||||
SubInclude HAIKU_TOP src tests servers app look_and_feel ;
|
||||
SubInclude HAIKU_TOP src tests servers app painter ;
|
||||
SubInclude HAIKU_TOP src tests servers app playground ;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
SubDir HAIKU_TOP src tests servers app following ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
AddSubDirSupportedPlatforms libbe_test ;
|
||||
|
||||
UseHeaders [ FDirName os app ] ;
|
||||
UseHeaders [ FDirName os interface ] ;
|
||||
|
||||
SimpleTest Following :
|
||||
main.cpp
|
||||
: be ;
|
||||
|
||||
if ( $(TARGET_PLATFORM) = libbe_test ) {
|
||||
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : Following
|
||||
: tests!apps ;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
// main.cpp
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Application.h>
|
||||
#include <Message.h>
|
||||
#include <Button.h>
|
||||
#include <View.h>
|
||||
#include <Window.h>
|
||||
|
||||
enum {
|
||||
TRACKING_NONE = 0,
|
||||
TRACKING_ALL,
|
||||
TRACKING_RIGHT,
|
||||
TRACKING_BOTTOM,
|
||||
TRACKING_RIGHT_BOTTOM,
|
||||
};
|
||||
|
||||
class TestView : public BView {
|
||||
|
||||
public:
|
||||
TestView(BRect frame, const char* name,
|
||||
uint32 resizeFlags, uint32 flags)
|
||||
: BView(frame, name, resizeFlags, flags),
|
||||
fTracking(TRACKING_NONE),
|
||||
fLastMousePos(0.0, 0.0)
|
||||
{
|
||||
rgb_color color;
|
||||
color.red = rand() / 256;
|
||||
color.green = rand() / 256;
|
||||
color.blue = rand() / 256;
|
||||
color.alpha = 255;
|
||||
SetViewColor(color);
|
||||
SetLowColor(color);
|
||||
}
|
||||
|
||||
virtual void Draw(BRect updateRect);
|
||||
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||
const BMessage* dragMessage);
|
||||
|
||||
private:
|
||||
uint32 fTracking;
|
||||
|
||||
BPoint fLastMousePos;
|
||||
};
|
||||
|
||||
// Draw
|
||||
void
|
||||
TestView::Draw(BRect updateRect)
|
||||
{
|
||||
// text
|
||||
SetHighColor(0, 0, 0, 255);
|
||||
const char* message = "Click and drag to move this view!";
|
||||
DrawString(message, BPoint(20.0, 30.0));
|
||||
|
||||
BRect r(Bounds());
|
||||
r.right -= 15.0;
|
||||
r.bottom -= 15.0;
|
||||
StrokeLine(r.RightTop(), BPoint(r.right, Bounds().bottom));
|
||||
StrokeLine(r.LeftBottom(), BPoint(Bounds().right, r.bottom));
|
||||
}
|
||||
|
||||
// MouseDown
|
||||
void
|
||||
TestView::MouseDown(BPoint where)
|
||||
{
|
||||
BRect r(Bounds());
|
||||
r.right -= 15.0;
|
||||
r.bottom -= 15.0;
|
||||
if (r.Contains(where))
|
||||
fTracking = TRACKING_ALL;
|
||||
else if (r.bottom < where.y && r.right < where.x)
|
||||
fTracking = TRACKING_RIGHT_BOTTOM;
|
||||
else if (r.bottom < where.y)
|
||||
fTracking = TRACKING_BOTTOM;
|
||||
else if (r.right < where.x)
|
||||
fTracking = TRACKING_RIGHT;
|
||||
|
||||
fLastMousePos = where;
|
||||
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
|
||||
}
|
||||
|
||||
// MouseUp
|
||||
void
|
||||
TestView::MouseUp(BPoint where)
|
||||
{
|
||||
fTracking = TRACKING_NONE;
|
||||
}
|
||||
|
||||
// MouseMoved
|
||||
void
|
||||
TestView::MouseMoved(BPoint where, uint32 transit,
|
||||
const BMessage* dragMessage)
|
||||
{
|
||||
BPoint offset = where - fLastMousePos;
|
||||
switch (fTracking) {
|
||||
case TRACKING_ALL:
|
||||
MoveBy(offset.x, offset.y);
|
||||
// fLastMousePos stays fixed
|
||||
break;
|
||||
case TRACKING_RIGHT:
|
||||
ResizeBy(offset.x, 0.0);
|
||||
fLastMousePos = where;
|
||||
break;
|
||||
case TRACKING_BOTTOM:
|
||||
ResizeBy(0.0, offset.y);
|
||||
fLastMousePos = where;
|
||||
break;
|
||||
case TRACKING_RIGHT_BOTTOM:
|
||||
ResizeBy(offset.x, offset.y);
|
||||
fLastMousePos = where;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// show_window
|
||||
void
|
||||
show_window(BRect frame, const char* name)
|
||||
{
|
||||
BWindow* window = new BWindow(frame, name,
|
||||
B_TITLED_WINDOW,
|
||||
B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE);
|
||||
|
||||
BView* view = new TestView(window->Bounds(), "test 1", B_FOLLOW_ALL,
|
||||
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
|
||||
|
||||
window->AddChild(view);
|
||||
|
||||
BRect bounds = view->Bounds();
|
||||
bounds.InsetBy(20, 20);
|
||||
BView* view1 = new TestView(bounds, "test 2", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM,
|
||||
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
|
||||
view->AddChild(view1);
|
||||
|
||||
bounds = view1->Bounds();
|
||||
bounds.InsetBy(20, 20);
|
||||
BView* view2 = new TestView(bounds, "test 3", B_FOLLOW_NONE,
|
||||
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
|
||||
view1->AddChild(view2);
|
||||
|
||||
|
||||
window->Show();
|
||||
}
|
||||
|
||||
// main
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
BApplication* app = new BApplication("application/x.vnd-Haiku.Following");
|
||||
|
||||
BRect frame(50.0, 50.0, 300.0, 250.0);
|
||||
show_window(frame, "Following Test");
|
||||
|
||||
app->Run();
|
||||
|
||||
delete app;
|
||||
return 0;
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../../../../generated/tests/apps/run_haiku_registrar || exit
|
||||
|
||||
if test -f ../../../../../generated/tests/apps/haiku_app_server; then
|
||||
../../../../../generated/tests/apps/haiku_app_server &
|
||||
else
|
||||
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
|
||||
fi
|
||||
|
||||
sleep 1s
|
||||
|
||||
if test -f ../../../../../generated/tests/apps/Following; then
|
||||
../../../../../generated/tests/apps/Following
|
||||
else
|
||||
echo "You need to \"TARGET_PLATFORM=r5 jam install-test-apps\" first."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user