[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 08:43:40 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 1834c70824b6b1402432bfd70229aec72bd7d1c3
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jun 4 01:36:34 2004 +0000

    	Added setCompositeOperation method to Context2D.
    	Actually pass composite operation to drawPixmap (instead of 1).
    
            Reviewed by jay lo.
    
            * khtml/ecma/kjs_html.cpp:
            (KJS::Context2DFunction::tryCall):
            * khtml/ecma/kjs_html.h:
            (KJS::Context2D::):
            * khtml/ecma/kjs_html.lut.h:
            (KJS::):
            * kwq/KWQPainter.h:
            * kwq/KWQPainter.mm:
            (QPainter::compositeOperatorFromString):
            (QPainter::drawPixmap):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6760 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index bfe3f5e..d56d208 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,21 @@
+2004-06-03  Richard Williamson   <rjw at apple.com>
+
+	Added setCompositeOperation method to Context2D.
+	Actually pass composite operation to drawPixmap (instead of 1).
+
+        Reviewed by jay lo.
+
+        * khtml/ecma/kjs_html.cpp:
+        (KJS::Context2DFunction::tryCall):
+        * khtml/ecma/kjs_html.h:
+        (KJS::Context2D::):
+        * khtml/ecma/kjs_html.lut.h:
+        (KJS::):
+        * kwq/KWQPainter.h:
+        * kwq/KWQPainter.mm:
+        (QPainter::compositeOperatorFromString):
+        (QPainter::drawPixmap):
+
 2004-06-03  David Hyatt  <hyatt at apple.com>
 
 	Add support for box-flex-group-transition (whew!), a new property that is going to enable some incredibly
diff --git a/WebCore/khtml/ecma/kjs_html.cpp b/WebCore/khtml/ecma/kjs_html.cpp
index 721a197..8cc9f7d 100644
--- a/WebCore/khtml/ecma/kjs_html.cpp
+++ b/WebCore/khtml/ecma/kjs_html.cpp
@@ -3885,7 +3885,7 @@ Value KJS::Context2DFunction::tryCall(ExecState *exec, Object &thisObj, const Li
             QString compositeOperator = args[5].toString(exec).qstring().lower();
             QPixmap pixmap = i->image()->pixmap();
             QPainter p;
-            p.drawPixmap (x, y, pixmap, 0, 0, w, h, 1, drawingContext);
+            p.drawPixmap (x, y, pixmap, 0, 0, w, h, QPainter::compositeOperatorFromString(compositeOperator), drawingContext);
             
             if (contextObject->_needsFlushRasterCache)
                 pixmap.flushRasterCache();
@@ -3894,7 +3894,7 @@ Value KJS::Context2DFunction::tryCall(ExecState *exec, Object &thisObj, const Li
             break;
         }
         case Context2D::DrawImageFromRect: {
-            if (args.size() != 6) {
+            if (args.size() != 10) {
                 Object err = Error::create(exec,SyntaxError);
                 exec->setException(err);
                 return err;
@@ -3917,7 +3917,8 @@ Value KJS::Context2DFunction::tryCall(ExecState *exec, Object &thisObj, const Li
             QString compositeOperator = args[9].toString(exec).qstring().lower();
             QPixmap pixmap = i->image()->pixmap();
             QPainter p;
-            p.drawPixmap (dx, dy, dw, dh, pixmap, sx, sy, sw, sh, 1, drawingContext);
+
+            p.drawPixmap (dx, dy, dw, dh, pixmap, sx, sy, sw, sh, QPainter::compositeOperatorFromString(compositeOperator), drawingContext);
             
             if (contextObject->_needsFlushRasterCache)
                 pixmap.flushRasterCache();
@@ -3935,6 +3936,16 @@ Value KJS::Context2DFunction::tryCall(ExecState *exec, Object &thisObj, const Li
             CGContextSetAlpha (drawingContext, a);
             break;
         }
+        case Context2D::SetCompositeOperation: {
+            if (args.size() != 1) {
+                Object err = Error::create(exec,SyntaxError);
+                exec->setException(err);
+                return err;
+            }
+            QString compositeOperator = args[0].toString(exec).qstring().lower();
+            QPainter::setCompositeOperation (drawingContext,compositeOperator);
+            break;
+        }
     }
 
     return Undefined();
@@ -3975,6 +3986,7 @@ const ClassInfo KJS::Context2D::info = { "Context2D", 0, &Context2DTable, 0 };
   setShadow                Context2D::SetShadow                   DontDelete|Function 3
   clearShadow              Context2D::ClearShadow                 DontDelete|Function 0
   setAlpha                 Context2D::SetAlpha                    DontDelete|Function 1
+  setCompositeOperation    Context2D::SetCompositeOperation       DontDelete|Function 1
 @end
 */
 
diff --git a/WebCore/khtml/ecma/kjs_html.h b/WebCore/khtml/ecma/kjs_html.h
index 3974dda..62c70f9 100644
--- a/WebCore/khtml/ecma/kjs_html.h
+++ b/WebCore/khtml/ecma/kjs_html.h
@@ -262,7 +262,7 @@ namespace KJS {
         ClearRect, FillRect, StrokeRect,
         DrawImage, DrawImageFromRect,
         SetShadow, ClearShadow,
-        SetAlpha};
+        SetAlpha, SetCompositeOperation};
 
     DOM::HTMLElementImpl *_element;
     unsigned int _needsFlushRasterCache;
diff --git a/WebCore/khtml/ecma/kjs_html.lut.h b/WebCore/khtml/ecma/kjs_html.lut.h
index f4d95cb..216bfc5 100644
--- a/WebCore/khtml/ecma/kjs_html.lut.h
+++ b/WebCore/khtml/ecma/kjs_html.lut.h
@@ -1060,7 +1060,7 @@ const struct HashEntry Context2DTableEntries[] = {
    { 0, 0, 0, 0, 0 },
    { "addArcToPoint", Context2D::AddArcToPoint, DontDelete|Function, 5, &Context2DTableEntries[36] },
    { 0, 0, 0, 0, 0 },
-   { "setMiterLimit", Context2D::SetMiterLimit, DontDelete|Function, 1, 0 },
+   { "setMiterLimit", Context2D::SetMiterLimit, DontDelete|Function, 1, &Context2DTableEntries[42] },
    { "scale", Context2D::Scale, DontDelete|Function, 2, 0 },
    { "setFillColor", Context2D::SetFillColor, DontDelete|Function, 1, 0 },
    { 0, 0, 0, 0, 0 },
@@ -1078,9 +1078,10 @@ const struct HashEntry Context2DTableEntries[] = {
    { "fillRect", Context2D::FillRect, DontDelete|Function, 4, 0 },
    { "strokeRect", Context2D::StrokeRect, DontDelete|Function, 4, 0 },
    { "drawImage", Context2D::DrawImage, DontDelete|Function, 6, 0 },
-   { "clearShadow", Context2D::ClearShadow, DontDelete|Function, 0, 0 }
+   { "clearShadow", Context2D::ClearShadow, DontDelete|Function, 0, 0 },
+   { "setCompositeOperation", Context2D::SetCompositeOperation, DontDelete|Function, 1, 0 }
 };
 
-const struct HashTable Context2DTable = { 2, 42, Context2DTableEntries, 31 };
+const struct HashTable Context2DTable = { 2, 43, Context2DTableEntries, 31 };
 
 } // namespace
diff --git a/WebCore/kwq/KWQPainter.h b/WebCore/kwq/KWQPainter.h
index 094b592..dbbab1b 100644
--- a/WebCore/kwq/KWQPainter.h
+++ b/WebCore/kwq/KWQPainter.h
@@ -129,6 +129,7 @@ public:
     
     CGContextRef currentContext();
     
+    static int compositeOperatorFromString (QString aString);
     static int getCompositeOperation(CGContextRef context);
     static void setCompositeOperation (CGContextRef context, QString operation);
     static void setCompositeOperation (CGContextRef context, int operation);
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index 5acf4a1..a0b4128 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -477,8 +477,10 @@ void QPainter::setCompositeOperation (CGContextRef context, int op)
     [[WebCoreImageRendererFactory sharedFactory] setCGCompositeOperation:op inContext:context];
 }
 
-static NSCompositingOperation compositeOperatorFromString (QString aString)
+int QPainter::compositeOperatorFromString (QString aString)
 {
+    NSCompositingOperation op = NSCompositeSourceOver;
+    
     if (aString.length()) {
         const char *operatorString = aString.ascii();
         int i;
@@ -489,12 +491,12 @@ static NSCompositingOperation compositeOperatorFromString (QString aString)
             }
         }
     }
-    return NSCompositeSourceOver;
+    return (int)op;
 }
 
 void QPainter::drawPixmap(const QPoint &p, const QPixmap &pix, const QRect &r, const QString &compositeOperator)
 {
-    drawPixmap(p.x(), p.y(), pix, r.x(), r.y(), r.width(), r.height(), (int)compositeOperatorFromString(compositeOperator));
+    drawPixmap(p.x(), p.y(), pix, r.x(), r.y(), r.width(), r.height(), compositeOperatorFromString(compositeOperator));
 }
 
 void QPainter::drawPixmap( int x, int y, const QPixmap &pixmap,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list