Title: [134359] trunk/Tools
Revision
134359
Author
[email protected]
Date
2012-11-12 21:53:43 -0800 (Mon, 12 Nov 2012)

Log Message

[BlackBerry] DRT - Update Pixel Dump Support for OpenGL renderer
https://bugs.webkit.org/show_bug.cgi?id=101894

Patch by Xiaobo Wang <[email protected]> on 2012-11-12
Reviewed by Rob Buis.

RIM PR 241686
Also remove an un-needed pixel lock, and fix a klocwork error in SKIA
code path.

* DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp:
(readPixelsUserInterfaceThread):
(createBitmapContextFromWebView):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (134358 => 134359)


--- trunk/Tools/ChangeLog	2012-11-13 05:51:48 UTC (rev 134358)
+++ trunk/Tools/ChangeLog	2012-11-13 05:53:43 UTC (rev 134359)
@@ -1,3 +1,18 @@
+2012-11-12  Xiaobo Wang  <[email protected]>
+
+        [BlackBerry] DRT - Update Pixel Dump Support for OpenGL renderer
+        https://bugs.webkit.org/show_bug.cgi?id=101894
+
+        Reviewed by Rob Buis.
+
+        RIM PR 241686
+        Also remove an un-needed pixel lock, and fix a klocwork error in SKIA
+        code path.
+
+        * DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp:
+        (readPixelsUserInterfaceThread):
+        (createBitmapContextFromWebView):
+
 2012-11-12  Daniel Bates  <[email protected]>
 
         Perl errors from Tools/Scripts/copy-webkitlibraries-to-product-directory

Modified: trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp (134358 => 134359)


--- trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp	2012-11-13 05:51:48 UTC (rev 134358)
+++ trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp	2012-11-13 05:53:43 UTC (rev 134359)
@@ -20,6 +20,11 @@
 #include "PixelDumpSupportBlackBerry.h"
 
 #include "BackingStore.h"
+#include "BlackBerryPlatformExecutableMessage.h"
+#include "BlackBerryPlatformGraphics.h"
+#include "BlackBerryPlatformGraphicsContext.h"
+#include "BlackBerryPlatformGraphicsImpl.h"
+#include "BlackBerryPlatformMessageClient.h"
 #include "DumpRenderTreeBlackBerry.h"
 #include "PNGImageEncoder.h"
 #include "PixelDumpSupport.h"
@@ -37,6 +42,11 @@
 using namespace BlackBerry;
 using namespace WTF;
 
+void readPixelsUserInterfaceThread(BlackBerry::Platform::Graphics::PlatformGraphicsContext* context, const BlackBerry::Platform::IntRect& srcRect, unsigned char* pixels)
+{
+    context->readPixels(srcRect, pixels, false, false);
+}
+
 PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool /*onscreen*/, bool /*incrementalRepaint*/, bool /*sweepHorizontally*/, bool /*drawSelectionRect*/)
 {
     Platform::Graphics::Window* window = DumpRenderTree::currentInstance()->page()->client()->window();
@@ -71,14 +81,21 @@
 
     const unsigned char* windowPixels = 0;
     if (!contentsBitmap.empty()) {
-        SkAutoLockPixels lock(contentsBitmap);
         windowPixels = static_cast<const unsigned char*>(contentsBitmap.getPixels());
+        if (windowPixels)
+            memcpy(data, windowPixels, windowSize.width() * windowSize.height() * 4);
     }
 #else
-    const unsigned char* windowPixels = lockBufferBackingImage(window->buffer(), Platform::Graphics::ReadAccess);
+    BlackBerry::Platform::Graphics::Buffer* buffer = BlackBerry::Platform::Graphics::createBuffer(windowSize, BlackBerry::Platform::Graphics::TemporaryBuffer);
+    BlackBerry::Platform::Graphics::Drawable* drawable = BlackBerry::Platform::Graphics::lockBufferDrawable(buffer);
+    if (drawable) {
+        backingStore->drawContents(drawable, windowRect, windowSize);
+        BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage(
+            BlackBerry::Platform::createFunctionCallMessage(&readPixelsUserInterfaceThread, drawable, windowRect, data));
+        BlackBerry::Platform::Graphics::releaseBufferDrawable(buffer);
+    }
+    BlackBerry::Platform::Graphics::destroyBuffer(buffer);
 #endif
-    memcpy(data, windowPixels, windowSize.width() * windowSize.height() * 4);
-    Platform::Graphics::releaseBufferBackingImage(window->buffer());
     return BitmapContext::createByAdoptingData(data, windowSize.width(), windowSize.height());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to