Modified: trunk/Source/WebCore/ChangeLog (108773 => 108774)
--- trunk/Source/WebCore/ChangeLog 2012-02-24 12:34:35 UTC (rev 108773)
+++ trunk/Source/WebCore/ChangeLog 2012-02-24 12:39:07 UTC (rev 108774)
@@ -1,3 +1,17 @@
+2012-02-24 Robin Cao <robin....@torchmobile.com.cn>
+
+ [BlackBerry] Upstream ImageBlackBerry in platform/graphics/blackberry
+ https://bugs.webkit.org/show_bug.cgi?id=79212
+
+ Reviewed by Antonio Gomes.
+
+ Initial upstreaming, no new tests.
+
+ * PlatformBlackBerry.cmake:
+ * platform/graphics/blackberry/ImageBlackBerry.cpp: Added.
+ (WebCore):
+ (WebCore::Image::loadPlatformResource):
+
2012-02-24 Leo Yang <leo.y...@torchmobile.com.cn>
[BlackBerry] Upstream the BlackBerry change to platform/graphics/IntSize.h
Modified: trunk/Source/WebCore/PlatformBlackBerry.cmake (108773 => 108774)
--- trunk/Source/WebCore/PlatformBlackBerry.cmake 2012-02-24 12:34:35 UTC (rev 108773)
+++ trunk/Source/WebCore/PlatformBlackBerry.cmake 2012-02-24 12:39:07 UTC (rev 108774)
@@ -165,12 +165,12 @@
platform/graphics/blackberry/FloatRectBlackBerry.cpp
platform/graphics/blackberry/FloatSizeBlackBerry.cpp
platform/graphics/blackberry/IconBlackBerry.cpp
+ platform/graphics/blackberry/ImageBlackBerry.cpp
platform/graphics/blackberry/IntPointBlackBerry.cpp
platform/graphics/blackberry/IntRectBlackBerry.cpp
platform/graphics/blackberry/IntSizeBlackBerry.cpp
platform/graphics/blackberry/MMrenderer.cpp
platform/graphics/blackberry/MediaPlayerPrivateMMrenderer.cpp
- platform/graphics/blackberry/ResourceBlackBerry.cpp
platform/text/blackberry/StringBlackBerry.cpp
)
Added: trunk/Source/WebCore/platform/graphics/blackberry/ImageBlackBerry.cpp (0 => 108774)
--- trunk/Source/WebCore/platform/graphics/blackberry/ImageBlackBerry.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/blackberry/ImageBlackBerry.cpp 2012-02-24 12:39:07 UTC (rev 108774)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2010, 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
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "Image.h"
+
+#include "BitmapImage.h"
+#include "ImageBuffer.h"
+#include "SharedBuffer.h"
+
+namespace WebCore {
+
+PassRefPtr<Image> Image::loadPlatformResource(const char *name)
+{
+ if (!strcmp(name, "searchCancel") || !strcmp(name, "searchCancelPressed")) {
+ OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(IntSize(16, 16));
+ if (!imageBuffer)
+ return 0;
+
+ // Draw a more subtle, gray x-shaped icon.
+ GraphicsContext* context = imageBuffer->context();
+ context->save();
+
+ context->fillRect(FloatRect(0, 0, 16, 16), Color::white, ColorSpaceDeviceRGB);
+
+ if (!strcmp(name, "searchCancel"))
+ context->setFillColor(Color(128, 128, 128), ColorSpaceDeviceRGB);
+ else
+ context->setFillColor(Color(64, 64, 64), ColorSpaceDeviceRGB);
+
+ context->translate(8, 8);
+
+ context->rotate(piDouble / 4.0);
+ context->fillRect(FloatRect(-1, -7, 2, 14));
+
+ context->rotate(-piDouble / 2.0);
+ context->fillRect(FloatRect(-1, -7, 2, 14));
+
+ context->restore();
+ return imageBuffer->copyImage();
+ }
+
+ // RESOURCE_PATH is set by CMake in OptionsBlackBerry.cmake
+ String fullPath(RESOURCE_PATH);
+ String extension(".png");
+
+ fullPath += name;
+ fullPath += extension;
+
+ RefPtr<SharedBuffer> buffer = SharedBuffer::createWithContentsOfFile(fullPath);
+ if (!buffer)
+ return BitmapImage::nullImage();
+
+ RefPtr<BitmapImage> img = BitmapImage::create();
+ img->setData(buffer.release(), true /* allDataReceived */);
+ return img.release();
+}
+
+} // namespace WebCore