Cleanup names of painting and repainting functions.
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2007 21:16:04 +0000 (21:16 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2007 21:16:04 +0000 (21:16 +0000)
        Reviewed by Adam Roben.

        * DumpRenderTree/cg/PixelDumpSupportCG.cpp:
        (drawSelectionRect): was drawSelectionRectIntoContext.
        (dumpWebViewAsPixelsAndCompareWithExpected):
        * DumpRenderTree/cg/PixelDumpSupportCG.h:
        * DumpRenderTree/mac/PixelDumpSupportMac.mm:
        (paintWebView): was drawWebViewIntoContext.
        (repaintWebView): was repaintWithVerticalSweep and repaintWithHorizontalSweep.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28047 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.cpp
WebKitTools/DumpRenderTree/cg/PixelDumpSupportCG.h
WebKitTools/DumpRenderTree/mac/PixelDumpSupportMac.mm

index e64ad3024e78448f48e8687297112356c1d779a5..14cfd28ccedd6079129dbdf8d1c543489b589f43 100644 (file)
@@ -1,3 +1,17 @@
+2007-11-26  Sam Weinig  <sam@webkit.org>
+
+        Cleanup names of painting and repainting functions.
+
+        Reviewed by Adam Roben.
+
+        * DumpRenderTree/cg/PixelDumpSupportCG.cpp:
+        (drawSelectionRect): was drawSelectionRectIntoContext.
+        (dumpWebViewAsPixelsAndCompareWithExpected):
+        * DumpRenderTree/cg/PixelDumpSupportCG.h:
+        * DumpRenderTree/mac/PixelDumpSupportMac.mm:
+        (paintWebView): was drawWebViewIntoContext.
+        (repaintWebView): was repaintWithVerticalSweep and repaintWithHorizontalSweep.
+
 2007-11-26  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Dan Bernstein.
index a132b04a0a70f78b7fd182c31ef9c06649ecec80..6e3db58ce10fa408d87146eecdbd014dc37ac01c 100644 (file)
@@ -85,7 +85,7 @@ static void getMD5HashStringForBitmap(CGContextRef bitmap, char string[33])
         snprintf(string, 33, "%s%02x", string, hash[i]);
 }
 
-void drawSelectionRectIntoContext(CGContextRef context, CGRect rect)
+void drawSelectionRect(CGContextRef context, const CGRect& rect)
 {
     const CGFloat redColor[4] = { 1.0, 0.0, 0.0, 0.0 };
 
@@ -100,15 +100,13 @@ void dumpWebViewAsPixelsAndCompareWithExpected(const char* /*currentTest*/, bool
     RetainPtr<CGContextRef> context = getBitmapContextFromWebView();
 
 #if PLATFORM(MAC)
-    if (!layoutTestController->testRepaint())
-        drawWebViewIntoContext(context.get());
-    else if (!layoutTestController->testRepaintSweepHorizontally())
-        repaintWithVerticalSweep(context.get());
-    else
-        repaintWithHorizontalSweep(context.get());
+    if (layoutTestController->testRepaint())
+        repaintWebView(context.get(), layoutTestController->testRepaintSweepHorizontally());
+    else 
+        paintWebView(context.get());
 
     if (layoutTestController->dumpSelectionRect())
-        drawSelectionRectIntoContext(context.get(), getSelectionRect());
+        drawSelectionRect(context.get(), getSelectionRect());
 #endif
 
     // Compute the actual hash to compare to the expected image's hash.
index a3e0e08ea0c6577f7f59903e75eede03e968998f..0abdea6a9bcbe1ad3a497d58f0c7ad52be1a55a5 100644 (file)
@@ -48,9 +48,8 @@ struct CGRect;
 RetainPtr<CGContextRef> getBitmapContextFromWebView();
 CGRect getSelectionRect();
 
-void drawWebViewIntoContext(CGContextRef);
-void repaintWithVerticalSweep(CGContextRef);
-void repaintWithHorizontalSweep(CGContextRef);
-void drawSelectionRectIntoContext(CGContextRef, CGRect);
+void paintWebView(CGContextRef);
+void repaintWebView(CGContextRef context, bool horizontal);
+void drawSelectionRect(CGContextRef, const CGRect&);
 
 #endif // PixelDumpSupportCG_h
index 80bb1679c57ead0240209ed76aee92f33b0bf129..5a191643fc394dda4be5137aabc02147a412a956 100644 (file)
@@ -110,7 +110,7 @@ RetainPtr<CGContextRef> getBitmapContextFromWebView()
     return RetainPtr<CGContextRef>(AdoptCF, CGBitmapContextCreate(screenCaptureBuffer, static_cast<size_t>(webViewSize.width), static_cast<size_t>(webViewSize.height), 8, static_cast<size_t>(webViewSize.width) * 4, sharedColorSpace, kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedLast));
 }
 
-void drawWebViewIntoContext(CGContextRef context)
+void paintWebView(CGContextRef context)
 {
     RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext];
 
@@ -128,7 +128,7 @@ void drawWebViewIntoContext(CGContextRef context)
     [NSGraphicsContext setCurrentContext:savedContext.get()];
 }
 
-void repaintWithVerticalSweep(CGContextRef context)
+void repaintWebView(CGContextRef context, bool horizontal)
 {
     RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext];
 
@@ -137,23 +137,14 @@ void repaintWithVerticalSweep(CGContextRef context)
 
     WebView *view = [mainFrame webView];
     NSSize webViewSize = [view frame].size;
-    for (NSRect line = NSMakeRect(0, 0, webViewSize.width, 1); line.origin.y < webViewSize.height; line.origin.y++)
-        [view displayRectIgnoringOpacity:line inContext:nsContext];
 
-    [NSGraphicsContext setCurrentContext:savedContext.get()];
-}
-
-void repaintWithHorizontalSweep(CGContextRef context)
-{
-    RetainPtr<NSGraphicsContext> savedContext = [NSGraphicsContext currentContext];
-
-    NSGraphicsContext* nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO];
-    [NSGraphicsContext setCurrentContext:nsContext];
-
-    WebView *view = [mainFrame webView];
-    NSSize webViewSize = [view frame].size;
-    for (NSRect column = NSMakeRect(0, 0, 1, webViewSize.height); column.origin.x < webViewSize.width; column.origin.x++)
-        [view displayRectIgnoringOpacity:column inContext:nsContext];
+    if (horizontal) {
+        for (NSRect column = NSMakeRect(0, 0, 1, webViewSize.height); column.origin.x < webViewSize.width; column.origin.x++)
+            [view displayRectIgnoringOpacity:column inContext:nsContext];
+    } else {
+        for (NSRect line = NSMakeRect(0, 0, webViewSize.width, 1); line.origin.y < webViewSize.height; line.origin.y++)
+            [view displayRectIgnoringOpacity:line inContext:nsContext];
+    }
 
     [NSGraphicsContext setCurrentContext:savedContext.get()];
 }