Title: [132582] trunk
Revision
132582
Author
[email protected]
Date
2012-10-26 01:11:34 -0700 (Fri, 26 Oct 2012)

Log Message

[BlackBerry] Support pixel tests for BlackBerry DRT
https://bugs.webkit.org/show_bug.cgi?id=100210

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

Source/WebKit:

Adds a step to build ImageDiff from Qt for DRT. Most of the works are
accomplished by Christopher Wells.

* PlatformBlackBerry.cmake:

Tools:

The implementation is based on the patch from Christopher Wells.

* DumpRenderTree/blackberry/DumpRenderTree.cpp:
(BlackBerry::WebKit::DumpRenderTree::DumpRenderTree):
(BlackBerry::WebKit::DumpRenderTree::runTest):
(BlackBerry::WebKit::DumpRenderTree::runCurrentTest):
(BlackBerry::WebKit::DumpRenderTree::resetToConsistentStateBeforeTesting):
(BlackBerry::WebKit::DumpRenderTree::runTests):
(BlackBerry::WebKit::DumpRenderTree::dump):
* DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h:
(DumpRenderTree):

* DumpRenderTree/blackberry/PNGImageEncoder.cpp:
(BGRAtoRGBA):
(encodeBitmapToPNG):
* DumpRenderTree/blackberry/PNGImageEncoder.h:
The changes to PNGImageEncoder files are from master_40, patched by Tyler
Abbott and Rob Buis.

* DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp:
(createBitmapContextFromWebView):
(computeMD5HashStringForBitmapContext):
(printPNG):
(dumpBitmap):
* DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h:
(BitmapContext::createByAdoptingData):
(BitmapContext::~BitmapContext):
(BitmapContext):
(BitmapContext::BitmapContext):

* DumpRenderTree/blackberry/build: Added.
* DumpRenderTree/blackberry/src.pro: Added.
Adds 2 files for building ImageDiff, by Christopher Wells.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (132581 => 132582)


--- trunk/Source/WebKit/ChangeLog	2012-10-26 08:10:52 UTC (rev 132581)
+++ trunk/Source/WebKit/ChangeLog	2012-10-26 08:11:34 UTC (rev 132582)
@@ -1,3 +1,15 @@
+2012-10-26  Xiaobo Wang  <[email protected]>
+
+        [BlackBerry] Support pixel tests for BlackBerry DRT
+        https://bugs.webkit.org/show_bug.cgi?id=100210
+
+        Reviewed by Rob Buis.
+
+        Adds a step to build ImageDiff from Qt for DRT. Most of the works are
+        accomplished by Christopher Wells.
+
+        * PlatformBlackBerry.cmake:
+
 2012-10-24  Alexey Proskuryakov  <[email protected]>
 
         Add a strategy for shared workers

Modified: trunk/Source/WebKit/PlatformBlackBerry.cmake (132581 => 132582)


--- trunk/Source/WebKit/PlatformBlackBerry.cmake	2012-10-26 08:10:52 UTC (rev 132581)
+++ trunk/Source/WebKit/PlatformBlackBerry.cmake	2012-10-26 08:11:34 UTC (rev 132582)
@@ -270,6 +270,18 @@
               ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendCommands.js
         DESTINATION ../../usr/share/webkit/inspector/)
 
+IF (NOT PUBLIC_BUILD)
+    # Add the custom target to build the host-side ImageDiff binary.
+    # Reuse the Qt version.
+    ADD_CUSTOM_TARGET(
+        ImageDiff ALL
+        WORKING_DIRECTORY ${TOOLS_DIR}/DumpRenderTree/blackberry/
+        COMMAND ./build
+        DEPENDS ${TOOLS_DIR}/DumpRenderTree/qt/ImageDiff.cpp
+        COMMENT "ImageDiff building..."
+    )
+ENDIF ()
+
 ADD_CUSTOM_TARGET (
     inspector ALL
     command cp ${WEBCORE_DIR}/inspector/front-end/inspector.html ${DERIVED_SOURCES_WEBCORE_DIR}/inspectorBB.html && echo '<script src=""  >> ${DERIVED_SOURCES_WEBCORE_DIR}/inspectorBB.html

Modified: trunk/Tools/ChangeLog (132581 => 132582)


--- trunk/Tools/ChangeLog	2012-10-26 08:10:52 UTC (rev 132581)
+++ trunk/Tools/ChangeLog	2012-10-26 08:11:34 UTC (rev 132582)
@@ -1,3 +1,44 @@
+2012-10-26  Xiaobo Wang  <[email protected]>
+
+        [BlackBerry] Support pixel tests for BlackBerry DRT
+        https://bugs.webkit.org/show_bug.cgi?id=100210
+
+        Reviewed by Rob Buis.
+
+        The implementation is based on the patch from Christopher Wells.
+
+        * DumpRenderTree/blackberry/DumpRenderTree.cpp:
+        (BlackBerry::WebKit::DumpRenderTree::DumpRenderTree):
+        (BlackBerry::WebKit::DumpRenderTree::runTest):
+        (BlackBerry::WebKit::DumpRenderTree::runCurrentTest):
+        (BlackBerry::WebKit::DumpRenderTree::resetToConsistentStateBeforeTesting):
+        (BlackBerry::WebKit::DumpRenderTree::runTests):
+        (BlackBerry::WebKit::DumpRenderTree::dump):
+        * DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h:
+        (DumpRenderTree):
+
+        * DumpRenderTree/blackberry/PNGImageEncoder.cpp:
+        (BGRAtoRGBA):
+        (encodeBitmapToPNG):
+        * DumpRenderTree/blackberry/PNGImageEncoder.h:
+        The changes to PNGImageEncoder files are from master_40, patched by Tyler
+        Abbott and Rob Buis.
+
+        * DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp:
+        (createBitmapContextFromWebView):
+        (computeMD5HashStringForBitmapContext):
+        (printPNG):
+        (dumpBitmap):
+        * DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h:
+        (BitmapContext::createByAdoptingData):
+        (BitmapContext::~BitmapContext):
+        (BitmapContext):
+        (BitmapContext::BitmapContext):
+
+        * DumpRenderTree/blackberry/build: Added.
+        * DumpRenderTree/blackberry/src.pro: Added.
+        Adds 2 files for building ImageDiff, by Christopher Wells.
+
 2012-10-25  Min Qin  <[email protected]>
 
         Fix a layout test crash if a TestWebkitPlugin is put inside an iframe

Modified: trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp (132581 => 132582)


--- trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp	2012-10-26 08:10:52 UTC (rev 132581)
+++ trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp	2012-10-26 08:11:34 UTC (rev 132582)
@@ -66,7 +66,6 @@
 #include <wtf/NonCopyingSort.h>
 #include <wtf/OwnArrayPtr.h>
 #include <wtf/Vector.h>
-#include <wtf/text/CString.h>
 
 #define SDCARD_PATH "/developer"
 
@@ -154,7 +153,7 @@
     : m_gcController(0)
     , m_accessibilityController(0)
     , m_page(page)
-    , m_dumpPixels(false)
+    , m_enablePixelTests(getenv("pixelTests"))
     , m_waitToDumpWatchdogTimer(this, &DumpRenderTree::waitToDumpWatchdogTimerFired)
     , m_workTimer(this, &DumpRenderTree::processWork)
     , m_acceptsEditing(true)
@@ -175,10 +174,10 @@
     delete m_accessibilityController;
 }
 
-void DumpRenderTree::runTest(const String& url)
+void DumpRenderTree::runTest(const String& url, const String& imageHash)
 {
     mainFrame->loader()->stopForUserCancel();
-    resetToConsistentStateBeforeTesting();
+    resetToConsistentStateBeforeTesting(url, imageHash);
     if (shouldLogFrameLoadDelegates(url))
         gTestRunner->setDumpFrameLoadCallbacks(true);
     if (!runFromCommandLine) {
@@ -211,12 +210,18 @@
 
 void DumpRenderTree::runCurrentTest()
 {
+    String imageHash = "";
+    int posSplitter = m_currentTest->find('?');
+    if (posSplitter > 1 && (unsigned)posSplitter < m_currentTest->length() - 1) {
+        imageHash = m_currentTest->substring(posSplitter + 1);
+        m_currentTest->truncate(posSplitter);
+    }
     if (isHTTPTest(m_currentTest->utf8().data())) {
         m_currentHttpTest = m_currentTest->utf8().data();
         m_currentHttpTest.remove(0, strlen(httpTestSyntax));
-        runTest(httpPrefixURL + m_currentHttpTest);
+        runTest(httpPrefixURL + m_currentHttpTest, imageHash);
     } else
-        runTest(kSDCLayoutTestsURI + *m_currentTest);
+        runTest(kSDCLayoutTestsURI + *m_currentTest, imageHash);
 }
 
 void DumpRenderTree::runRemainingTests()
@@ -245,12 +250,9 @@
     runCurrentTest();
 }
 
-void DumpRenderTree::resetToConsistentStateBeforeTesting()
+void DumpRenderTree::resetToConsistentStateBeforeTesting(const String& url, const String& imageHash)
 {
-    if (isHTTPTest(m_currentTest->utf8().data()))
-        gTestRunner = TestRunner::create(String(httpPrefixURL + *m_currentTest).utf8().data(), "");
-    else
-        gTestRunner = TestRunner::create(String(kSDCLayoutTestsURI + *m_currentTest).utf8().data(), "");
+    gTestRunner = TestRunner::create(url.utf8().data(), imageHash.utf8().data());
 
     gTestRunner->setIconDatabaseEnabled(false);
 
@@ -335,7 +337,7 @@
 
     mainFrame = DumpRenderTreeSupport::corePage(m_page)->mainFrame();
 
-    if (getenv("drtTestFile")) {
+    if (const char* testFile = getenv("drtTestFile")) {
         runFromCommandLine = true;
         addTest(testFile);
     } else {
@@ -509,10 +511,22 @@
     String result = "Content-Type: " + resultMimeType + "\n" + data;
 
     dumpToFile(result);
-    if (m_dumpPixels && !dumpAsText && gTestRunner->generatePixelResults())
-        dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash());
 
     if (!runFromCommandLine) {
+        // signal end of text block
+        fputs("#EOF\n", stdout);
+
+        // There are two scenarios for dumping pixels:
+        // 1. When the test case explicitly asks for it by calling dumpAsText(true) with that extra true passed as a parameter value, from _javascript_
+        bool explicitPixelResults = gTestRunner->dumpAsText() && gTestRunner->generatePixelResults();
+        // 2. When the test case implicitly allows it by not calling dumpAsText() at all (with no parameters).
+        bool implicitPixelResults = !gTestRunner->dumpAsText();
+
+        // But only if m_enablePixelTests is set, to say that the user wants to run pixel tests at all.
+        bool generatePixelResults = m_enablePixelTests && (explicitPixelResults || implicitPixelResults);
+        if (generatePixelResults)
+            dumpWebViewAsPixelsAndCompareWithExpected(gTestRunner->expectedPixelHash());
+
         String crashFile = dumpFile + ".crash";
         unlink(crashFile.utf8().data());
 

Modified: trunk/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h (132581 => 132582)


--- trunk/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h	2012-10-26 08:10:52 UTC (rev 132581)
+++ trunk/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h	2012-10-26 08:11:34 UTC (rev 132582)
@@ -109,7 +109,7 @@
     // BlackBerry::Platform::BlackBerryPlatformLayoutTestClient method
     virtual void addTest(const char* testFile);
 private:
-    void runTest(const String& url);
+    void runTest(const String& url, const String& imageHash);
     void runTests();
     void runCurrentTest();
 
@@ -124,7 +124,7 @@
     void doneDrt();
     bool isHTTPTest(const String& test);
     String renderTreeDump() const;
-    void resetToConsistentStateBeforeTesting();
+    void resetToConsistentStateBeforeTesting(const String& url, const String& imageHash);
     void runRemainingTests();
     void invalidateAnyPreviousWaitToDumpWatchdog();
     void waitToDumpWatchdogTimerFired(WebCore::Timer<DumpRenderTree>*);
@@ -141,7 +141,7 @@
     GCController* m_gcController;
     AccessibilityController* m_accessibilityController;
     WebPage* m_page;
-    bool m_dumpPixels;
+    bool m_enablePixelTests;
     WebCore::Timer<DumpRenderTree> m_waitToDumpWatchdogTimer;
     WebCore::Timer<DumpRenderTree> m_workTimer;
 

Modified: trunk/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp (132581 => 132582)


--- trunk/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp	2012-10-26 08:10:52 UTC (rev 132581)
+++ trunk/Tools/DumpRenderTree/blackberry/PNGImageEncoder.cpp	2012-10-26 08:11:34 UTC (rev 132582)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
+ * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,6 @@
 #include "config.h"
 #include "PNGImageEncoder.h"
 
-#include "SkBitmap.h"
-#include "SkUnPreMultiply.h"
 
 extern "C" {
 #include "png.h"
@@ -33,20 +31,16 @@
 // This code is almost a mirror of the code in WebCore/platform/image-encoders/skia/PNGImageEncoder.cpp
 // since we can't include this private WebCore file in a WebKit-client application.
 
-// Converts BGRA->RGBA and RGBA->BGRA and undoes alpha premultiplication.
-static void preMultipliedBGRAtoRGBA(const unsigned char* input, int numberOfPixels, unsigned char* output)
+// Keep the premultipied for as it is the most faithful information
+static void BGRAtoRGBA(const unsigned char* input, int numberOfPixels, unsigned char* output)
 {
-    SkBitmap inputBitmap;
-    inputBitmap.setConfig(SkBitmap::kARGB_8888_Config, numberOfPixels, 1);
-    inputBitmap.setPixels(const_cast<unsigned char*>(input));
     for (int x = 0; x < numberOfPixels; x++) {
-        uint32_t srcPixel = *inputBitmap.getAddr32(x, 0);
-        SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(srcPixel);
-        unsigned char* pixelOut = &output[x * 4];
-        pixelOut[0] = SkColorGetR(unmultiplied);
-        pixelOut[1] = SkColorGetG(unmultiplied);
-        pixelOut[2] = SkColorGetB(unmultiplied);
-        pixelOut[3] = SkColorGetA(unmultiplied);
+        output[0] = input[2];
+        output[1] = input[1];
+        output[2] = input[0];
+        output[3] = input[3];
+        input += 4;
+        output += 4;
     }
 }
 
@@ -130,8 +124,8 @@
     png_set_write_fn(pngPtr, &state, encoderWriteCallback, 0);
 
     png_set_IHDR(pngPtr, infoPtr, imageWidth, imageHeight, 8, pngOutputColorType,
-                 PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
-                 PNG_FILTER_TYPE_DEFAULT);
+        PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
+        PNG_FILTER_TYPE_DEFAULT);
     png_write_info(pngPtr, infoPtr);
 
     OwnArrayPtr<unsigned char> rowPixels = adoptArrayPtr(new unsigned char[imageWidth * outputColorComponents]);
@@ -144,13 +138,8 @@
     return true;
 }
 
-bool encodeSkBitmapToPNG(const SkBitmap& image, Vector<unsigned char>* output)
+bool encodeBitmapToPNG(unsigned char* data, int width, int height, Vector<unsigned char>* output)
 {
-    if (image.config() != SkBitmap::kARGB_8888_Config)
-        return false; // Only support ARGB at 8 bpp now.
-
-    image.lockPixels();
-    bool result = encodeImpl(static_cast<unsigned char*>(image.getPixels()), image.width(), image.height(), image.rowBytes(), output, preMultipliedBGRAtoRGBA);
-    image.unlockPixels();
+    bool result = encodeImpl(data, width, height, width * 4, output, BGRAtoRGBA);
     return result;
 }

Modified: trunk/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h (132581 => 132582)


--- trunk/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h	2012-10-26 08:10:52 UTC (rev 132581)
+++ trunk/Tools/DumpRenderTree/blackberry/PNGImageEncoder.h	2012-10-26 08:11:34 UTC (rev 132582)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
+ * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,6 @@
 
 #include <wtf/Vector.h>
 
-class SkBitmap;
+bool encodeBitmapToPNG(unsigned char* data, int width, int height, WTF::Vector<unsigned char>* output);
 
-bool encodeSkBitmapToPNG(const SkBitmap&, WTF::Vector<unsigned char>* output);
-
 #endif // PNGImageEncoder_h

Modified: trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp (132581 => 132582)


--- trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp	2012-10-26 08:10:52 UTC (rev 132581)
+++ trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp	2012-10-26 08:11:34 UTC (rev 132582)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
+ * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,6 +19,7 @@
 #include "config.h"
 #include "PixelDumpSupportBlackBerry.h"
 
+#include "BackingStore.h"
 #include "DumpRenderTreeBlackBerry.h"
 #include "PNGImageEncoder.h"
 #include "PixelDumpSupport.h"
@@ -26,7 +27,9 @@
 #include "WebPageClient.h"
 
 #include <BlackBerryPlatformWindow.h>
-#include <skia/SkDevice.h>
+#if USE(SKIA)
+#include <SkDevice.h>
+#endif
 #include <wtf/MD5.h>
 #include <wtf/Vector.h>
 
@@ -39,35 +42,53 @@
     Platform::Graphics::Window* window = DumpRenderTree::currentInstance()->page()->client()->window();
     ASSERT(window);
 
+    // The BackingStore has a queue of pending jobs, which are run on idle
+    // and which may not have been run yet.
+    BackingStore* backingStore = DumpRenderTree::currentInstance()->page()->backingStore();
+    while (backingStore->hasBlitJobs())
+        backingStore->blitOnIdle();
+
     const Platform::IntRect& windowRect = window->viewportRect();
+    const Platform::IntSize& windowSize = window->viewportSize();
+    unsigned char* data = "" unsigned char[windowSize.width() * windowSize.height() * 4];
 
-    SkBitmap* bitmap = new SkBitmap;
-    bitmap->setConfig(SkBitmap::kARGB_8888_Config, windowRect.width(), windowRect.height()); // We use 32-bit RGBA since that is the pixel format that ImageDiff expects.
-    bitmap->allocPixels();
-
-    SkCanvas* canvas = new SkCanvas;
-    canvas->setBitmapDevice(*bitmap);
-
     // We need to force a synchronous update to the window or we may get an empty bitmap.
     // For example, running DRT with one test case that finishes before the screen is updated.
     window->post(windowRect);
 
-    const SkBitmap* windowBitmap = static_cast<const SkBitmap*>(lockBufferBackingImage(window->buffer(), Platform::Graphics::ReadAccess));
-    canvas->drawBitmap(*windowBitmap, 0, 0); // Draw the bitmap at (0, 0).
+#if USE(SKIA)
+    SkBitmap bitmap;
+    bitmap.setConfig(SkBitmap::kARGB_8888_Config, windowSize.width(), windowSize.height());
+    bitmap.allocPixels();
+    bitmap.eraseARGB(0, 0, 0, 0);
+
+    SkCanvas canvas(bitmap);
+    backingStore->drawContents(&canvas, windowRect, windowSize);
+
+    // Read that SkBitmap rather than change it. So use false on accessBitmap.
+    const SkBitmap& contentsBitmap = canvas.getDevice()->accessBitmap(false/*changePixels*/);
+    contentsBitmap.lockPixels();
+
+    const unsigned char* windowPixels = 0;
+    if (!contentsBitmap.empty()) {
+        SkAutoLockPixels lock(contentsBitmap);
+        windowPixels = static_cast<const unsigned char*>(contentsBitmap.getPixels());
+    }
+#else
+    const unsigned char* windowPixels = lockBufferBackingImage(window->buffer(), Platform::Graphics::ReadAccess);
+#endif
+    memcpy(data, windowPixels, windowSize.width() * windowSize.height() * 4);
     Platform::Graphics::releaseBufferBackingImage(window->buffer());
-    return BitmapContext::createByAdoptingBitmapAndContext(bitmap, canvas);
+    return BitmapContext::createByAdoptingData(data, windowSize.width(), windowSize.height());
 }
 
 void computeMD5HashStringForBitmapContext(BitmapContext* context, char hashString[33])
 {
-    const SkBitmap& bitmap = context->canvas()->getDevice()->accessBitmap(false);
-    ASSERT(bitmap.bytesPerPixel() == 4); // 32-bit RGBA
+    int pixelsWide = context->m_width;
+    int pixelsHigh = context->m_height;
+    int bytesPerRow = context->m_width * 4;
+    unsigned char* pixelData = context->m_data;
 
-    int pixelsWide = bitmap.width();
-    int pixelsHigh = bitmap.height();
-    int bytesPerRow = bitmap.rowBytes();
-    unsigned char* pixelData = (unsigned char*)bitmap.getPixels();
-
     MD5 md5;
     for (int i = 0; i < pixelsHigh; ++i) {
         md5.addBytes(pixelData, 4 * pixelsWide);
@@ -82,14 +103,14 @@
         snprintf(hashString, 33, "%s%02x", hashString, hash[i]);
 }
 
-static void printPNG(SkCanvas* canvas, const char* checksum)
+static void printPNG(BitmapContext* context, const char* checksum)
 {
     Vector<unsigned char> pngData;
-    encodeSkBitmapToPNG(canvas->getDevice()->accessBitmap(false), &pngData);
+    encodeBitmapToPNG(context->m_data, context->m_width, context->m_height, &pngData);
     printPNG(pngData.data(), pngData.size(), checksum);
 }
 
 void dumpBitmap(BitmapContext* context, const char* checksum)
 {
-    printPNG(context->canvas(), checksum);
+    printPNG(context, checksum);
 }

Modified: trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h (132581 => 132582)


--- trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h	2012-10-26 08:10:52 UTC (rev 132581)
+++ trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.h	2012-10-26 08:11:34 UTC (rev 132582)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
+ * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,38 +19,34 @@
 #ifndef PixelDumpSupportBlackBerry_h
 #define PixelDumpSupportBlackBerry_h
 
-#include <skia/SkBitmap.h>
-#include <skia/SkCanvas.h>
+#include <stdio.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
 class BitmapContext : public RefCounted<BitmapContext> {
 public:
 
-    static PassRefPtr<BitmapContext> createByAdoptingBitmapAndContext(SkBitmap* bitmap, SkCanvas* canvas)
+    static PassRefPtr<BitmapContext> createByAdoptingData(unsigned char* data, int width, int height)
     {
-        return adoptRef(new BitmapContext(bitmap, canvas));
+        return adoptRef(new BitmapContext(data, width, height));
     }
 
     ~BitmapContext()
     {
-        delete m_bitmap;
-        delete m_canvas;
+        delete m_data;
     }
 
-    SkCanvas* canvas() { return m_canvas; }
+    unsigned char* m_data;
+    int m_width, m_height;
 
 private:
 
-    BitmapContext(SkBitmap* bitmap, SkCanvas* canvas)
-        : m_bitmap(bitmap)
-        , m_canvas(canvas)
+    BitmapContext(unsigned char* data, int width, int height)
+        : m_data(data)
+        , m_width(width)
+        , m_height(height)
     {
     }
-
-    SkBitmap* m_bitmap;
-    SkCanvas* m_canvas;
-
 };
 
 #endif // PixelDumpSupportBlackBerry_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to