Merge services-central with mozilla-central. a=fennec-blockers
authorPhilipp von Weitershausen <philipp@weitershausen.de>
Mon, 07 Mar 2011 18:16:57 -0800
changeset 63348 5666cb06e51971d2f9ca2e66ca148b40b1fe1b9a
parent 63347 a90c3a81835f9a1716758da9b745397c1dccb28a (current diff)
parent 63336 c4bd627b9dcef395bc1a18f265e4b8279374a5b1 (diff)
child 63349 51bdf0bca017febcacaf39e7ab36561a8de13f1c
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersfennec-blockers
milestone2.0b13pre
Merge services-central with mozilla-central. a=fennec-blockers
--- a/gfx/cairo/README
+++ b/gfx/cairo/README
@@ -161,16 +161,18 @@ disable-subpixel-antialiasing.patch: Add
 tee-surfaces-pointwise.patch: Composite tee subsurfaces pointwise if possible
 
 pattern_get_surface-no-error.patch: Don't put a pattern into error if cairo_pattern_get_surface fails
 
 missing-cairo-clip-init.diff: Missing cairo_clip_init call in cairo_gstate_show_text_glyphs lead to crash
 
 fix-cairo-win32-print-gdi-error.diff: Don't use fwprintf with char* format.  Flush stderr so that all error messages appears before exit.
 
+pixman-image-transform.patch: Reset the transform on pixman images when using them as destinations.
+
 ==== pixman patches ====
 
 pixman-android-cpu-detect.patch: Add CPU detection support for Android, where we can't reliably access /proc/self/auxv.
 
 pixman-rename-and-endian.patch: include cairo-platform.h for renaming of external symbols and endian macros
 
 NOTE: we previously supported ARM assembler on MSVC, this has been removed because of the maintenance burden
 
--- a/gfx/cairo/cairo/src/cairo-image-surface.c
+++ b/gfx/cairo/cairo/src/cairo-image-surface.c
@@ -1138,16 +1138,27 @@ static cairo_int_status_t
 	return status;
 
     status = _cairo_image_surface_set_attributes (src, &src_attr,
 						  dst_x + width / 2.,
 						  dst_y + height / 2.);
     if (unlikely (status))
 	goto CLEANUP_SURFACES;
 
+    /* we sometimes get destinations with transforms.
+     * we're not equiped to deal with this */
+    {
+        static const pixman_transform_t id = {
+           {{ pixman_fixed_1, 0, 0 },
+            { 0, pixman_fixed_1, 0 },
+            { 0, 0, pixman_fixed_1 }}
+        };
+        pixman_image_set_transform (dst->pixman_image, &id);
+    }
+
     if (mask) {
 	status = _cairo_image_surface_set_attributes (mask, &mask_attr,
 						      dst_x + width / 2.,
 						      dst_y + height / 2.);
 	if (unlikely (status))
 	    goto CLEANUP_SURFACES;
 
 	pixman_image_composite (_pixman_operator (op),
new file mode 100644
--- /dev/null
+++ b/gfx/cairo/pixman-image-transform.patch
@@ -0,0 +1,52 @@
+# HG changeset patch
+# User Jeff Muizelaar <jmuizelaar@mozilla.com>
+# Date 1299543337 18000
+# Node ID 57f411f16517fa3abc31b6b081dd31420c4d9b45
+# Parent  e56ecd8b3a68c158025207c5fd081d043e28f5ce
+Bug 637828. Reset the transform on the dest image. r=joe
+
+We can get into a situation where the destination image has a transform
+because we use it as source. The transform set when the image is a source
+sticks around and when we use it as a destination pixman gets confused.
+
+It seems like the code at fault here is really pixman. I think that pixman
+should probably not be using a transformed fetch on the destination image under
+any circumstances.
+
+For example, in this case we're fetching destination pixels from a different
+part of the image than we're storing them to. I can't see any reason for
+wanting this behaviour.
+
+However, reseting the transform seemed like the easiest solution.
+
+diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c
+--- a/gfx/cairo/cairo/src/cairo-image-surface.c
++++ b/gfx/cairo/cairo/src/cairo-image-surface.c
+@@ -1138,16 +1138,27 @@ _cairo_image_surface_composite (cairo_op
+ 	return status;
+ 
+     status = _cairo_image_surface_set_attributes (src, &src_attr,
+ 						  dst_x + width / 2.,
+ 						  dst_y + height / 2.);
+     if (unlikely (status))
+ 	goto CLEANUP_SURFACES;
+ 
++    /* we sometimes get destinations with transforms.
++     * we're not equiped to deal with this */
++    {
++        static const pixman_transform_t id = {
++           {{ pixman_fixed_1, 0, 0 },
++            { 0, pixman_fixed_1, 0 },
++            { 0, 0, pixman_fixed_1 }}
++        };
++        pixman_image_set_transform (dst->pixman_image, &id);
++    }
++
+     if (mask) {
+ 	status = _cairo_image_surface_set_attributes (mask, &mask_attr,
+ 						      dst_x + width / 2.,
+ 						      dst_y + height / 2.);
+ 	if (unlikely (status))
+ 	    goto CLEANUP_SURFACES;
+ 
+ 	pixman_image_composite (_pixman_operator (op),
--- a/gfx/layers/basic/BasicImages.cpp
+++ b/gfx/layers/basic/BasicImages.cpp
@@ -43,16 +43,17 @@
 
 #ifdef XP_MACOSX
 #include "gfxQuartzImageSurface.h"
 #endif
 
 #include "cairo.h"
 
 #include "yuv_convert.h"
+#include "ycbcr_to_rgb565.h"
 
 #include "gfxPlatform.h"
 
 using mozilla::Monitor;
 
 namespace mozilla {
 namespace layers {
 
@@ -141,24 +142,23 @@ BasicPlanarYCbCrImage::SetData(const Dat
   }
 
   gfxASurface::gfxImageFormat format = GetOffscreenFormat();
 
   // 'prescale' is true if the scaling is to be done as part of the
   // YCbCr to RGB conversion rather than on the RGB data when rendered.
   PRBool prescale = mScaleHint.width > 0 && mScaleHint.height > 0;
   if (format == gfxASurface::ImageFormatRGB16_565) {
-#ifndef HAVE_SCALE_YCBCR_TO_RGB565
-    // yuv2rgb16 with scale function not yet available
-    prescale = PR_FALSE;
-#endif
-#ifndef HAVE_YCBCR_TO_RGB565
-    // yuv2rgb16 function not yet available for non-arm
-    format = gfxASurface::ImageFormatRGB24;
-#endif
+    if (have_ycbcr_to_rgb565()) {
+      // yuv2rgb16 with scale function not yet available for NEON
+      prescale = PR_FALSE;
+    } else {
+      // yuv2rgb16 function not yet available for non-NEON
+      format = gfxASurface::ImageFormatRGB24;
+    }
   }
   gfxIntSize size(prescale ? mScaleHint.width : aData.mPicSize.width,
                   prescale ? mScaleHint.height : aData.mPicSize.height);
 
   int bpp = gfxASurface::BytePerPixelFromFormat(format);
   mBuffer = new PRUint8[size.width * size.height * bpp];
   if (!mBuffer) {
     // out of memory
@@ -199,16 +199,17 @@ BasicPlanarYCbCrImage::SetData(const Dat
                              type,
                              gfx::ROTATE_0,
                              gfx::FILTER_BILINEAR);
     } else {
        NS_ERROR("Fail, ScaleYCbCrToRGB format not supported\n");
     }
   } else { // no prescale
     if (format == gfxASurface::ImageFormatRGB16_565) {
+      NS_ASSERTION(have_ycbcr_to_rgb565(), "Cannot convert YCbCr to RGB565");
       gfx::ConvertYCbCrToRGB565(aData.mYChannel,
                                 aData.mCbChannel,
                                 aData.mCrChannel,
                                 mBuffer,
                                 aData.mPicX,
                                 aData.mPicY,
                                 aData.mPicSize.width,
                                 aData.mPicSize.height,
--- a/gfx/ycbcr/Makefile.in
+++ b/gfx/ycbcr/Makefile.in
@@ -10,16 +10,17 @@ LIBRARY_NAME = ycbcr
 LIBXUL_LIBRARY = 1
 EXPORT_LIBRARY = 1
 
 DEFINES += -D_IMPL_NS_GFX
 
 EXPORTS      = chromium_types.h \
                yuv_convert.h \
                yuv_row.h \
+               ycbcr_to_rgb565.h \
                $(NULL)
 
 CPPSRCS = yuv_convert.cpp \
           yuv_row_c.cpp \
           yuv_row_table.cpp \
           ycbcr_to_rgb565.cpp \
           $(NULL)