[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
eric at webkit.org
eric at webkit.org
Wed Mar 17 18:38:06 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit b3e210f2c0ee6e13319f8a27e71be07355055f43
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Mar 13 09:04:43 2010 +0000
2010-03-13 Leandro Pereira <leandro at profusion.mobi>
Reviewed by Kenneth Rohde Christiansen.
Add EFL port files to efl/ewk.
http://webkit.org/b/35929
* efl/ewk/ewk_util.cpp: Added.
* efl/ewk/ewk_util.h: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55954 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 6418e69..fc62c6e 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -3,6 +3,16 @@
Reviewed by Kenneth Rohde Christiansen.
Add EFL port files to efl/ewk.
+ http://webkit.org/b/35929
+
+ * efl/ewk/ewk_util.cpp: Added.
+ * efl/ewk/ewk_util.h: Added.
+
+2010-03-13 Leandro Pereira <leandro at profusion.mobi>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add EFL port files to efl/ewk.
http://webkit.org/b/35934
* efl/ewk/EWebKit.h: Added.
diff --git a/WebKit/efl/ewk/ewk_util.cpp b/WebKit/efl/ewk/ewk_util.cpp
new file mode 100644
index 0000000..bf82695
--- /dev/null
+++ b/WebKit/efl/ewk/ewk_util.cpp
@@ -0,0 +1,98 @@
+/*
+ Copyright (C) 2009-2010 ProFUSION embedded systems
+ Copyright (C) 2009-2010 Samsung Electronics
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "ewk_util.h"
+
+#include "ewk_private.h"
+#include <eina_safety_checks.h>
+
+Evas_Object* ewk_util_image_from_cairo_surface_add(Evas* canvas, cairo_surface_t* surface)
+{
+ cairo_status_t status;
+ cairo_surface_type_t type;
+ cairo_format_t format;
+ int w, h, stride;
+ Evas_Object* image;
+ const void* src;
+ void* dst;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(surface, 0);
+
+ status = cairo_surface_status(surface);
+ if (status != CAIRO_STATUS_SUCCESS) {
+ ERR("cairo surface is invalid: %s", cairo_status_to_string(status));
+ return 0;
+ }
+
+ type = cairo_surface_get_type(surface);
+ if (type != CAIRO_SURFACE_TYPE_IMAGE) {
+ ERR("unknown surface type %d, required %d (CAIRO_SURFACE_TYPE_IMAGE).",
+ type, CAIRO_SURFACE_TYPE_IMAGE);
+ return 0;
+ }
+
+ format = cairo_image_surface_get_format(surface);
+ if (format != CAIRO_FORMAT_ARGB32 && format != CAIRO_FORMAT_RGB24) {
+ ERR("unknown surface format %d, expected %d or %d.",
+ format, CAIRO_FORMAT_ARGB32, CAIRO_FORMAT_RGB24);
+ return 0;
+ }
+
+ w = cairo_image_surface_get_width(surface);
+ h = cairo_image_surface_get_height(surface);
+ stride = cairo_image_surface_get_stride(surface);
+ if (w <= 0 || h <= 0 || stride <= 0) {
+ ERR("invalid image size %dx%d, stride=%d", w, h, stride);
+ return 0;
+ }
+
+ src = cairo_image_surface_get_data(surface);
+ if (!src) {
+ ERR("could not get source data.");
+ return 0;
+ }
+
+ image = evas_object_image_filled_add(canvas);
+ if (!image) {
+ ERR("could not add image to canvas.");
+ return 0;
+ }
+
+ evas_object_image_colorspace_set(image, EVAS_COLORSPACE_ARGB8888);
+ evas_object_image_size_set(image, w, h);
+ evas_object_image_alpha_set(image, format == CAIRO_FORMAT_ARGB32);
+
+ if (evas_object_image_stride_get(image) * 4 != stride) {
+ ERR("evas' stride %d diverges from cairo's %d.",
+ evas_object_image_stride_get(image) * 4, stride);
+ evas_object_del(image);
+ return 0;
+ }
+
+ dst = evas_object_image_data_get(image, EINA_TRUE);
+ memcpy(dst, src, h * stride);
+ evas_object_image_data_set(image, dst);
+
+ evas_object_resize(image, w, h); // helpful but not really required
+
+ return image;
+}
diff --git a/WebKit/efl/ewk/ewk_util.h b/WebKit/efl/ewk/ewk_util.h
new file mode 100644
index 0000000..d9c8f9c
--- /dev/null
+++ b/WebKit/efl/ewk/ewk_util.h
@@ -0,0 +1,29 @@
+/*
+ Copyright (C) 2009-2010 ProFUSION embedded systems
+ Copyright (C) 2009-2010 Samsung Electronics
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef ewk_util_h
+#define ewk_util_h
+
+#include <Evas.h>
+#include <cairo.h>
+
+Evas_Object* ewk_util_image_from_cairo_surface_add(Evas* canvas, cairo_surface_t* surface);
+
+#endif // ewk_util_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list