[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:44:52 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit db08d6885920fdf63d0c95088578ff1e4ec10425
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 19 01:41:12 2001 +0000

    Files for the kwq test app
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/kwq/tests/draw/Makefile b/WebCore/kwq/tests/draw/Makefile
new file mode 100644
index 0000000..796e5d9
--- /dev/null
+++ b/WebCore/kwq/tests/draw/Makefile
@@ -0,0 +1,10 @@
+drawdemo.o: drawdemo.cpp
+	c++  -c -I$(QTDIR)/include -fno-exceptions -pipe -g  -o drawdemo.o drawdemo.cpp
+
+drawdemo: drawdemo.o
+	c++ -L$(QTDIR)/lib -o ./drawdemo drawdemo.o   -lqt  -L/usr/X11R6/lib   -lz -ljpeg  -lXext -lX11
+
+clean:
+	rm *.o drawdemo
+
+all: drawdemo
diff --git a/WebCore/kwq/tests/draw/drawdemo b/WebCore/kwq/tests/draw/drawdemo
new file mode 100644
index 0000000..6206075
Binary files /dev/null and b/WebCore/kwq/tests/draw/drawdemo differ
diff --git a/WebCore/kwq/tests/draw/drawdemo.cpp b/WebCore/kwq/tests/draw/drawdemo.cpp
new file mode 100644
index 0000000..9f09c8e
--- /dev/null
+++ b/WebCore/kwq/tests/draw/drawdemo.cpp
@@ -0,0 +1,177 @@
+/****************************************************************************
+** $Id$
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of an example program for Qt.  This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qwidget.h>
+#include <qpainter.h>
+#include <qapplication.h>
+#include <math.h>
+
+
+//
+// This function draws a color wheel.
+// The coordinate system x=(0..500), y=(0..500) spans the paint device.
+//
+
+#define SLICE_LENGTH 15
+
+void drawColorWheel( QPainter *p )
+{
+    p->save();
+    
+    QFont f( "times", 18, QFont::Bold );
+    p->setFont( f );
+    p->setPen( Qt::black );
+    //p->setWindow( 0, 0, 500, 500 );		// defines coordinate system
+
+    for ( int i=0; i<36; i++ ) {		// draws 36 rotated rectangles
+
+        QWMatrix matrix;
+        matrix.translate( 390.0F, 140.0F );	// move to center
+        matrix.shear( 0.0F, 0.3F );		// twist it
+        matrix.rotate( (float)i*10 );		// rotate 0,10,20,.. degrees
+        p->setWorldMatrix( matrix );		// use this world matrix
+
+        QColor c;
+        c.setHsv( i*10, 255, 255 );		// rainbow effect
+        p->setBrush( c );			// solid fill with color c
+        p->drawRect( 70, -10, SLICE_LENGTH, 10 );		// draw the rectangle
+
+        QString n;
+        n.sprintf( "H=%d", i*10 );
+        p->drawText( SLICE_LENGTH+70+5, 0, n );		// draw the hue number
+    }
+    p->restore();
+}
+
+
+//
+// This function draws a few lines of text using different fonts.
+//
+
+#define DRAW_FONT_OFFSET 270.0F
+
+void drawFonts( QPainter *p )
+{
+    static const char *fonts[] = { "Helvetica", "Courier", "Times", 0 };
+    static int	 sizes[] = { 10, 12, 18, 24, 36, 0 };
+    int f = 0;
+    int y = 0;
+    
+    p->save();
+
+    QWMatrix matrix;
+    matrix.translate( 0.0F, DRAW_FONT_OFFSET );	// move to center
+    p->setWorldMatrix( matrix );		// use this world matrix
+    while ( fonts[f] ) {
+        int s = 0;
+        while ( sizes[s] ) {
+            QFont font( fonts[f], sizes[s] );
+            p->setFont( font );
+            QFontMetrics fm = p->fontMetrics();
+            y += fm.ascent();
+            p->drawText( 10, y, fonts[f] );
+            p->drawText( 10 + p->fontMetrics().width(fonts[f]), y, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefhijklmnopqrstuvwxyz" );
+            y += fm.descent();
+            s++;
+        }
+        f++;
+    }
+    p->restore();
+}
+
+
+//
+// This function draws some shapes
+//
+
+#define DRAW_SHAPES_OFFSET 600.0F
+
+void drawShapes( QPainter *p )
+{
+    QBrush b1( Qt::blue );
+    QBrush b2( Qt::green, Qt::Dense6Pattern );		// green 12% fill
+    QBrush b3( Qt::NoBrush );				// void brush
+    QBrush b4( Qt::CrossPattern );			// black cross pattern
+
+    p->save();
+    
+    QWMatrix matrix;
+    matrix.translate( 0.0F, DRAW_SHAPES_OFFSET );	// move to center
+    p->setWorldMatrix( matrix );		// use this world matrix
+
+    p->setPen( Qt::red );
+    p->setBrush( b1 );
+    p->drawRect( 10, 10, 200, 100 );
+    p->setBrush( b2 );
+    p->drawRoundRect( 10, 150, 200, 100, 20, 20 );
+    p->setBrush( b3 );
+    p->drawEllipse( 250, 10, 200, 100 );
+    p->setBrush( b4 );
+    p->drawPie( 250, 150, 200, 100, 45*16, 90*16 );
+
+    p->restore();
+}
+
+
+class DrawView : public QWidget
+{
+public:
+    DrawView();
+    ~DrawView();
+protected:
+    void   paintEvent( QPaintEvent * );
+private:
+};
+
+
+//
+// Construct the DrawView with buttons.
+//
+
+DrawView::DrawView()
+{
+    setCaption( "Qt Draw Demo Application" );
+    setBackgroundColor( white );    
+    resize( 640,900 );
+}
+
+//
+// Clean up
+//
+DrawView::~DrawView()
+{
+}
+
+//
+// Called when the widget needs to be updated.
+//
+
+void DrawView::paintEvent( QPaintEvent * )
+{
+    QPainter paint( this );
+    
+    drawColorWheel (&paint);
+    drawFonts (&paint);
+    drawShapes (&paint);
+}
+
+
+//
+// Create and display our widget.
+//
+
+int main( int argc, char **argv )
+{
+    QApplication app( argc, argv );
+    DrawView   draw;
+    app.setMainWidget( &draw );
+    draw.show();
+    return app.exec();
+}
diff --git a/WebCore/kwq/tests/draw/drawdemo.o b/WebCore/kwq/tests/draw/drawdemo.o
new file mode 100644
index 0000000..b88ccf3
Binary files /dev/null and b/WebCore/kwq/tests/draw/drawdemo.o differ
diff --git a/WebCore/src/kwq/tests/draw/Makefile b/WebCore/src/kwq/tests/draw/Makefile
new file mode 100644
index 0000000..796e5d9
--- /dev/null
+++ b/WebCore/src/kwq/tests/draw/Makefile
@@ -0,0 +1,10 @@
+drawdemo.o: drawdemo.cpp
+	c++  -c -I$(QTDIR)/include -fno-exceptions -pipe -g  -o drawdemo.o drawdemo.cpp
+
+drawdemo: drawdemo.o
+	c++ -L$(QTDIR)/lib -o ./drawdemo drawdemo.o   -lqt  -L/usr/X11R6/lib   -lz -ljpeg  -lXext -lX11
+
+clean:
+	rm *.o drawdemo
+
+all: drawdemo
diff --git a/WebCore/src/kwq/tests/draw/drawdemo b/WebCore/src/kwq/tests/draw/drawdemo
new file mode 100644
index 0000000..6206075
Binary files /dev/null and b/WebCore/src/kwq/tests/draw/drawdemo differ
diff --git a/WebCore/src/kwq/tests/draw/drawdemo.cpp b/WebCore/src/kwq/tests/draw/drawdemo.cpp
new file mode 100644
index 0000000..9f09c8e
--- /dev/null
+++ b/WebCore/src/kwq/tests/draw/drawdemo.cpp
@@ -0,0 +1,177 @@
+/****************************************************************************
+** $Id$
+**
+** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+**
+** This file is part of an example program for Qt.  This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qwidget.h>
+#include <qpainter.h>
+#include <qapplication.h>
+#include <math.h>
+
+
+//
+// This function draws a color wheel.
+// The coordinate system x=(0..500), y=(0..500) spans the paint device.
+//
+
+#define SLICE_LENGTH 15
+
+void drawColorWheel( QPainter *p )
+{
+    p->save();
+    
+    QFont f( "times", 18, QFont::Bold );
+    p->setFont( f );
+    p->setPen( Qt::black );
+    //p->setWindow( 0, 0, 500, 500 );		// defines coordinate system
+
+    for ( int i=0; i<36; i++ ) {		// draws 36 rotated rectangles
+
+        QWMatrix matrix;
+        matrix.translate( 390.0F, 140.0F );	// move to center
+        matrix.shear( 0.0F, 0.3F );		// twist it
+        matrix.rotate( (float)i*10 );		// rotate 0,10,20,.. degrees
+        p->setWorldMatrix( matrix );		// use this world matrix
+
+        QColor c;
+        c.setHsv( i*10, 255, 255 );		// rainbow effect
+        p->setBrush( c );			// solid fill with color c
+        p->drawRect( 70, -10, SLICE_LENGTH, 10 );		// draw the rectangle
+
+        QString n;
+        n.sprintf( "H=%d", i*10 );
+        p->drawText( SLICE_LENGTH+70+5, 0, n );		// draw the hue number
+    }
+    p->restore();
+}
+
+
+//
+// This function draws a few lines of text using different fonts.
+//
+
+#define DRAW_FONT_OFFSET 270.0F
+
+void drawFonts( QPainter *p )
+{
+    static const char *fonts[] = { "Helvetica", "Courier", "Times", 0 };
+    static int	 sizes[] = { 10, 12, 18, 24, 36, 0 };
+    int f = 0;
+    int y = 0;
+    
+    p->save();
+
+    QWMatrix matrix;
+    matrix.translate( 0.0F, DRAW_FONT_OFFSET );	// move to center
+    p->setWorldMatrix( matrix );		// use this world matrix
+    while ( fonts[f] ) {
+        int s = 0;
+        while ( sizes[s] ) {
+            QFont font( fonts[f], sizes[s] );
+            p->setFont( font );
+            QFontMetrics fm = p->fontMetrics();
+            y += fm.ascent();
+            p->drawText( 10, y, fonts[f] );
+            p->drawText( 10 + p->fontMetrics().width(fonts[f]), y, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefhijklmnopqrstuvwxyz" );
+            y += fm.descent();
+            s++;
+        }
+        f++;
+    }
+    p->restore();
+}
+
+
+//
+// This function draws some shapes
+//
+
+#define DRAW_SHAPES_OFFSET 600.0F
+
+void drawShapes( QPainter *p )
+{
+    QBrush b1( Qt::blue );
+    QBrush b2( Qt::green, Qt::Dense6Pattern );		// green 12% fill
+    QBrush b3( Qt::NoBrush );				// void brush
+    QBrush b4( Qt::CrossPattern );			// black cross pattern
+
+    p->save();
+    
+    QWMatrix matrix;
+    matrix.translate( 0.0F, DRAW_SHAPES_OFFSET );	// move to center
+    p->setWorldMatrix( matrix );		// use this world matrix
+
+    p->setPen( Qt::red );
+    p->setBrush( b1 );
+    p->drawRect( 10, 10, 200, 100 );
+    p->setBrush( b2 );
+    p->drawRoundRect( 10, 150, 200, 100, 20, 20 );
+    p->setBrush( b3 );
+    p->drawEllipse( 250, 10, 200, 100 );
+    p->setBrush( b4 );
+    p->drawPie( 250, 150, 200, 100, 45*16, 90*16 );
+
+    p->restore();
+}
+
+
+class DrawView : public QWidget
+{
+public:
+    DrawView();
+    ~DrawView();
+protected:
+    void   paintEvent( QPaintEvent * );
+private:
+};
+
+
+//
+// Construct the DrawView with buttons.
+//
+
+DrawView::DrawView()
+{
+    setCaption( "Qt Draw Demo Application" );
+    setBackgroundColor( white );    
+    resize( 640,900 );
+}
+
+//
+// Clean up
+//
+DrawView::~DrawView()
+{
+}
+
+//
+// Called when the widget needs to be updated.
+//
+
+void DrawView::paintEvent( QPaintEvent * )
+{
+    QPainter paint( this );
+    
+    drawColorWheel (&paint);
+    drawFonts (&paint);
+    drawShapes (&paint);
+}
+
+
+//
+// Create and display our widget.
+//
+
+int main( int argc, char **argv )
+{
+    QApplication app( argc, argv );
+    DrawView   draw;
+    app.setMainWidget( &draw );
+    draw.show();
+    return app.exec();
+}
diff --git a/WebCore/src/kwq/tests/draw/drawdemo.o b/WebCore/src/kwq/tests/draw/drawdemo.o
new file mode 100644
index 0000000..b88ccf3
Binary files /dev/null and b/WebCore/src/kwq/tests/draw/drawdemo.o differ

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list