Bug 654463 - Remove WinCE code from content/* ; r=sicking
authorEd Morley <bmo@edmorley.co.uk>
Wed, 04 May 2011 09:25:50 +0200
changeset 68934 3bae6630c5aff7f0e4c5449845b084e41a9bcfcf
parent 68933 c3c4c902e9cd9ccf3d0cd2bb470da53630a3066f
child 68935 154900bdac9036228e21b2d9dbcf1e47e3735b56
push id19806
push userdgottwald@mozilla.com
push dateWed, 04 May 2011 07:30:15 +0000
treeherdermozilla-central@e90bdd97d168 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs654463
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 654463 - Remove WinCE code from content/* ; r=sicking
content/canvas/src/nsCanvasRenderingContext2D.cpp
content/svg/content/src/nsSVGFilters.cpp
content/xbl/builtin/Makefile.in
content/xslt/src/xslt/txEXSLTFunctions.cpp
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -3224,115 +3224,16 @@ nsCanvasRenderingContext2D::IsPointInPat
         *retVal = PR_FALSE;
         return NS_OK;
     }
 
     *retVal = mThebes->PointInFill(gfxPoint(x,y));
     return NS_OK;
 }
 
-#ifdef WINCE
-/* A simple bitblt for self copies that ensures that we don't overwrite any
- * area before we've read from it. */
-static void
-bitblt(gfxImageSurface *s, int src_x, int src_y, int width, int height,
-                int dest_x, int dest_y) {
-    unsigned char *data = s->Data();
-    int stride = s->Stride()/4;
-    int x, y;
-    unsigned int *dest = (unsigned int *)data;
-    unsigned int *src  = (unsigned int *)data;
-
-    int surface_width  = s->Width();
-    int surface_height = s->Height();
-
-    /* clip to the surface size */
-    if (src_x < 0) {
-        dest_x += -src_x;
-        width  -= -src_x;
-        src_x = 0;
-    }
-    if (src_y < 0) {
-        dest_y += -src_y;
-        height -= -src_y;
-        src_y = 0;
-    }
-    if (dest_x < 0) {
-        src_x += -dest_x;
-        width -= -dest_x;
-        dest_x = 0;
-    }
-    if (dest_y < 0) {
-        src_y  += -dest_y;
-        height -= -dest_y;
-        dest_y  = 0;
-    }
-
-    /*XXX: we might want to check for overflow? */
-    if (src_x + width > surface_width)
-        width = surface_width - src_x;
-    if (dest_x + width > surface_width)
-        width = surface_width - dest_x;
-    if (src_y + height > surface_height)
-        height = surface_height - src_y;
-    if (dest_y + height > surface_height)
-        height = surface_height - dest_y;
-
-    if (dest_x < src_x) {
-        if (dest_y < src_y) {
-            dest = dest + dest_y*stride + dest_x;
-            src  = src  +  src_y*stride + src_x;
-            /* copy right to left, top to bottom */
-            for (y=0; y<height; y++) {
-                for (x=0; x<width; x++) {
-                    *dest++ = *src++;
-                }
-                dest += stride - width;
-                src  += stride - width;
-            }
-        } else {
-            dest = dest + (dest_y+height-1)*stride + dest_x;
-            src  = src  + (src_y +height-1)*stride + src_x;
-            /* copy right to left, bottom to top */
-            for (y=0; y<height; y++) {
-                for (x=0; x<width; x++) {
-                    *dest++ = *src++;
-                }
-                dest += -stride - width;
-                src  += -stride - width;
-            }
-        }
-    } else {
-        if (dest_y < src_y) {
-            dest = dest + dest_y*stride + (dest_x+width-1);
-            src  = src  +  src_y*stride + (src_x +width-1);
-            /* copy left to right, top to bottom */
-            for (y=0; y<height; y++) {
-                for (x=0; x<width; x++) {
-                    *dest-- = *src--;
-                }
-                dest += stride + width;
-                src  += stride + width;
-            }
-        } else {
-            dest = dest + (dest_y+height-1)*stride + (dest_x+width-1);
-            src  = src  + (src_y +height-1)*stride + (src_x +width-1);
-            /* copy left to right, bottom to top */
-            for (y=0; y<height; y++) {
-                for (x=0; x<width; x++) {
-                    *dest-- = *src--;
-                }
-                dest += -stride + width;
-                src  += -stride + width;
-            }
-        }
-    }
-}
-#endif
-
 //
 // image
 //
 
 // drawImage(in HTMLImageElement image, in float dx, in float dy);
 //   -- render image from 0,0 at dx,dy top-left coords
 // drawImage(in HTMLImageElement image, in float dx, in float dy, in float sw, in float sh);
 //   -- render image from 0,0 at dx,dy top-left coords clipping it to sw,sh
@@ -3364,26 +3265,24 @@ nsCanvasRenderingContext2D::DrawImage(ns
         PRUint32 sfeFlags = nsLayoutUtils::SFE_WANT_FIRST_FRAME;
         nsLayoutUtils::SurfaceFromElementResult res =
             nsLayoutUtils::SurfaceFromElement(imgElt, sfeFlags);
         if (!res.mSurface) {
             // Spec says to silently do nothing if the element is still loading.
             return res.mIsStillLoading ? NS_OK : NS_ERROR_NOT_AVAILABLE;
         }
 
-#ifndef WINCE
-        // On non-CE, force a copy if we're using drawImage with our destination
+        // Force a copy if we're using drawImage with our destination
         // as a source to work around some Cairo self-copy semantics issues.
         if (res.mSurface == mSurface) {
             sfeFlags |= nsLayoutUtils::SFE_WANT_NEW_SURFACE;
             res = nsLayoutUtils::SurfaceFromElement(imgElt, sfeFlags);
             if (!res.mSurface)
                 return NS_ERROR_NOT_AVAILABLE;
         }
-#endif
 
         imgsurf = res.mSurface.forget();
         imgSize = res.mSize;
 
         if (mCanvasElement) {
             CanvasUtils::DoDrawImageSecurityCheck(HTMLCanvasElement(),
                                                   res.mPrincipal, res.mIsWriteOnly);
         }
@@ -3462,44 +3361,16 @@ nsCanvasRenderingContext2D::DrawImage(ns
     // Checking source image boundaries.
     if (sx < 0 || sx + sw > (double) imgSize.width || 
         sy < 0 || sy + sh > (double) imgSize.height) {
       return NS_ERROR_DOM_INDEX_SIZE_ERR;
     }
 
     matrix.Translate(gfxPoint(sx, sy));
     matrix.Scale(sw/dw, sh/dh);
-#ifdef WINCE
-    /* cairo doesn't have consistent semantics for drawing a surface onto
-     * itself. Specifically, pixman will not preserve the contents when doing
-     * the copy. So to get the desired semantics a temporary copy would be needed.
-     * Instead we optimize opaque self copies here */
-    {
-        nsRefPtr<gfxASurface> csurf = mThebes->CurrentSurface();
-        if (csurf == imgsurf) {
-            if (imgsurf->GetType() == gfxASurface::SurfaceTypeImage) {
-                gfxImageSurface *surf = static_cast<gfxImageSurface*>(imgsurf.get());
-                gfxContext::GraphicsOperator op = mThebes->CurrentOperator();
-                PRBool opaque, unscaled;
-
-                opaque  = surf->Format() == gfxASurface::ImageFormatARGB32 &&
-                    (op == gfxContext::OPERATOR_SOURCE);
-                opaque |= surf->Format() == gfxASurface::ImageFormatRGB24  &&
-                    (op == gfxContext::OPERATOR_SOURCE || op == gfxContext::OPERATOR_OVER);
-
-                unscaled = sw == dw && sh == dh;
-
-                if (opaque && unscaled) {
-                    bitblt(surf, sx, sy, sw, sh, dx, dy);
-                    return NS_OK;
-                }
-            }
-        }
-    }
-#endif
 
     pattern = new gfxPattern(imgsurf);
     pattern->SetMatrix(matrix);
 
     if (CurrentState().imageSmoothingEnabled)
         pattern->SetFilter(gfxPattern::FILTER_GOOD);
     else
         pattern->SetFilter(gfxPattern::FILTER_NEAREST);
--- a/content/svg/content/src/nsSVGFilters.cpp
+++ b/content/svg/content/src/nsSVGFilters.cpp
@@ -67,20 +67,18 @@
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsSVGFilterElement.h"
 #include "nsSVGString.h"
 #include "nsSVGEffects.h"
 #include "gfxUtils.h"
 
 #if defined(XP_WIN) 
 // Prevent Windows redefining LoadImage
-#ifndef WINCE
 #undef LoadImage
 #endif
-#endif
 
 #define NUM_ENTRIES_IN_4x5_MATRIX 20
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 static void
 CopyDataRect(PRUint8 *aDest, const PRUint8 *aSrc, PRUint32 aStride,
--- a/content/xbl/builtin/Makefile.in
+++ b/content/xbl/builtin/Makefile.in
@@ -37,17 +37,17 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH)))
+ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
 DIRS	= win
 else
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 DIRS	= mac
 else
 ifneq (,$(filter qt gtk2,$(MOZ_WIDGET_TOOLKIT)))
 DIRS	= unix
 else
--- a/content/xslt/src/xslt/txEXSLTFunctions.cpp
+++ b/content/xslt/src/xslt/txEXSLTFunctions.cpp
@@ -243,20 +243,16 @@ static txEXSLTFunctionDescriptor descrip
     { 1, 2, Expr::STRING_RESULT,  &txXSLTAtoms::tokenize, 0, kEXSLTStringsNS }, // TOKENIZE
     { 1, 1, Expr::NUMBER_RESULT,  &txXSLTAtoms::max, 0, kEXSLTMathNS }, // MAX
     { 1, 1, Expr::NUMBER_RESULT,  &txXSLTAtoms::min, 0, kEXSLTMathNS }, // MIN
     { 1, 1, Expr::NODESET_RESULT, &txXSLTAtoms::highest, 0, kEXSLTMathNS }, // HIGHEST
     { 1, 1, Expr::NODESET_RESULT, &txXSLTAtoms::lowest, 0, kEXSLTMathNS }, // LOWEST
 
 };
 
-#ifdef WINCE // WINCE defines this.
-#undef DIFFERENCE
-#endif
-
 class txEXSLTFunctionCall : public FunctionCall
 {
 public:
     // The order of this enum must be the same as the descriptTable
     // table above
     enum eType {
         // Set functions
         NODE_SET,