--- a/gfx/public/Makefile.in
+++ b/gfx/public/Makefile.in
@@ -59,15 +59,14 @@ EXPORTS = \
nsTransform2D.h \
nsIRenderingContext.h \
nsIFontMetrics.h \
nsIDeviceContext.h \
nsIImage.h \
nsGfxCIID.h \
nsIRegion.h \
nsDeviceContext.h \
- nsIDrawingSurface.h \
nsITheme.h \
nsThemeConstants.h \
$(NULL)
include $(topsrcdir)/config/rules.mk
--- a/gfx/public/nsDeviceContext.h
+++ b/gfx/public/nsDeviceContext.h
@@ -92,17 +92,16 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
NS_IMETHOD Init(nsNativeWidget aWidget);
NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext);
NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext);
NS_IMETHOD CreateRenderingContext(nsIRenderingContext *&aContext){return NS_ERROR_NOT_IMPLEMENTED;}
- NS_IMETHOD CreateRenderingContext(nsIDrawingSurface* aSurface, nsIRenderingContext *&aContext);
NS_IMETHOD CreateRenderingContextInstance(nsIRenderingContext *&aContext);
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIAtom* aLangGroup,
nsIFontMetrics*& aMetrics);
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics*& aMetrics);
NS_IMETHOD FirstExistingFont(const nsFont& aFont, nsString& aFaceName);
@@ -122,17 +121,16 @@ public:
NS_IMETHOD AbortDocument(void) { return NS_OK; }
NS_IMETHOD PrepareNativeWidget(nsIWidget *aWidget, void **aOut);
NS_IMETHOD ClearCachedSystemFonts();
private:
/* Helper methods for |CreateRenderingContext|&co. */
nsresult InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWindow);
- nsresult InitRenderingContext(nsIRenderingContext *aContext, nsIDrawingSurface* aSurface);
protected:
virtual ~DeviceContextImpl();
void CommonInit(void);
nsresult CreateIconILGroupContext();
virtual nsresult CreateFontAliasTable();
nsresult AliasFont(const nsString& aFont,
--- a/gfx/public/nsIDeviceContext.h
+++ b/gfx/public/nsIDeviceContext.h
@@ -227,24 +227,16 @@ public:
* Create a rendering context and initialize it from an nsIView
* @param aView view to initialize context from
* @param aContext out parameter for new rendering context
* @return error status
*/
NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext) = 0;
/**
- * Create a rendering context and initialize it from an nsIDrawingSurface*
- * @param nsIDrawingSurface* widget to initialize context from
- * @param aContext out parameter for new rendering context
- * @return error status
- */
- NS_IMETHOD CreateRenderingContext(nsIDrawingSurface* aSurface, nsIRenderingContext *&aContext) = 0;
-
- /**
* Create a rendering context and initialize it from an nsIWidget
* @param aWidget widget to initialize context from
* @param aContext out parameter for new rendering context
* @return error status
*/
NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext) = 0;
/**
deleted file mode 100644
--- a/gfx/public/nsIDrawingSurface.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsIDrawingSurface_h___
-#define nsIDrawingSurface_h___
-
-#include "nscore.h"
-#include "nsISupports.h"
-
-// a memory area that can be rendered to
-
-typedef struct
-{
- PRUint32 mRedZeroMask; //red color mask in zero position
- PRUint32 mGreenZeroMask; //green color mask in zero position
- PRUint32 mBlueZeroMask; //blue color mask in zero position
- PRUint32 mAlphaZeroMask; //alpha data mask in zero position
- PRUint32 mRedMask; //red color mask
- PRUint32 mGreenMask; //green color mask
- PRUint32 mBlueMask; //blue color mask
- PRUint32 mAlphaMask; //alpha data mask
- PRUint8 mRedCount; //number of red color bits
- PRUint8 mGreenCount; //number of green color bits
- PRUint8 mBlueCount; //number of blue color bits
- PRUint8 mAlphaCount; //number of alpha data bits
- PRUint8 mRedShift; //number to shift value into red position
- PRUint8 mGreenShift; //number to shift value into green position
- PRUint8 mBlueShift; //number to shift value into blue position
- PRUint8 mAlphaShift; //number to shift value into alpha position
-} nsPixelFormat;
-
-#define RASWIDTH(width, bpp) ((((width) * (bpp) + 31) >> 5) << 2)
-
-#define NS_IDRAWING_SURFACE_IID \
-{ 0x61cc77e0, 0xcaac, 0x11d2, \
-{ 0xa8, 0x49, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
-
-class nsIDrawingSurface : public nsISupports
-{
-public:
- NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDRAWING_SURFACE_IID)
- /**
- * Lock a rect of a drawing surface and return a
- * pointer to the upper left hand corner of the
- * bitmap.
- * @param aX x position of subrect of bitmap
- * @param aY y position of subrect of bitmap
- * @param aWidth width of subrect of bitmap
- * @param aHeight height of subrect of bitmap
- * @param aBits out parameter for upper left hand
- * corner of bitmap
- * @param aStride out parameter for number of bytes
- * to add to aBits to go from scanline to scanline
- * @param aWidthBytes out parameter for number of
- * bytes per line in aBits to process aWidth pixels
- * @return error status
- *
- **/
- NS_IMETHOD Lock(PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight,
- void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes,
- PRUint32 aFlags) = 0;
-
- /**
- * Unlock a rect of a drawing surface. must be preceded
- * by a call to Lock(). Lock()/Unlock() pairs do not nest.
- * @return error status
- *
- **/
- NS_IMETHOD Unlock(void) = 0;
-
- /**
- * Get the dimensions of a drawing surface
- * @param aWidth out parameter for width of drawing surface
- * @param aHeight out parameter for height of drawing surface
- * @return error status
- *
- **/
- NS_IMETHOD GetDimensions(PRUint32 *aWidth, PRUint32 *aHeight) = 0;
-
- /**
- * Get the offscreen status of the drawing surface
- * @param aOffscreen out parameter for offscreen status of
- * drawing surface. if PR_TRUE, then modifying the
- * drawing surface does not immediately reflect the
- * changes on the output device
- * @return error status
- *
- **/
- NS_IMETHOD IsOffscreen(PRBool *aOffScreen) = 0;
-
- /**
- * Get the pixel addressability status of the drawing surface
- * @param aAddressable out parameter for pixel addressability
- * status of drawing surface. if PR_TRUE, then the
- * drawing surface is optimized for pixel addressability
- * (i.e. the Lock() method has very low overhead). All
- * drawing surfaces support Lock()ing, but doing so on
- * drawing surfaces that do not return PR_TRUE here may
- * impose significant overhead.
- * @return error status
- *
- **/
- NS_IMETHOD IsPixelAddressable(PRBool *aAddressable) = 0;
-
- /**
- * Get the pixel format of a drawing surface
- * @param aOffscreen out parameter filled in with pixel
- * format information.
- * @return error status
- *
- **/
- NS_IMETHOD GetPixelFormat(nsPixelFormat *aFormat) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIDrawingSurface, NS_IDRAWING_SURFACE_IID)
-
-//when creating a drawing surface, you can use this
-//to tell the drawing surface that you anticipate
-//the need to get to the actual bits of the drawing
-//surface at some point during it's lifetime. typically
-//used when creating bitmaps to be operated on by the
-//nsIBlender implementations.
-#define NS_CREATEDRAWINGSURFACE_FOR_PIXEL_ACCESS 0x0001
-
-//flag to say that this drawing surface is shortlived,
-//which may affect how the OS allocates it. Used for
-//tiling, grouting etc.
-#define NS_CREATEDRAWINGSURFACE_SHORTLIVED 0x0002
-
-//when locking a drawing surface, use these flags to
-//control how the data in the surface should be accessed
-#define NS_LOCK_SURFACE_READ_ONLY 0x0001
-#define NS_LOCK_SURFACE_WRITE_ONLY 0x0002
-
-#endif // nsIDrawingSurface_h___
--- a/gfx/public/nsIImage.h
+++ b/gfx/public/nsIImage.h
@@ -199,22 +199,16 @@ public:
* BitBlit the nsIImage to a device, the source and dest can be scaled
* @param aSourceRect source rectangle, in image pixels
* @param aDestRect destination rectangle, in device pixels
*/
NS_IMETHOD Draw(nsIRenderingContext &aContext,
const gfxRect &aSourceRect,
const gfxRect &aDestRect) = 0;
- NS_IMETHOD DrawTile(nsIRenderingContext &aContext,
- nsIDrawingSurface* aSurface,
- PRInt32 aSXOffset, PRInt32 aSYOffset,
- PRInt32 aPadX, PRInt32 aPadY,
- const nsRect &aTileRect) = 0;
-
/**
* BitBlit the entire (no cropping) nsIImage to another nsImage, the source and dest can be scaled
* @update - saari 03/08/01
* @param aDstImage the nsImage to blit to
* @param aDX The destination horizontal location
* @param aDY The destination vertical location
* @param aDWidth The destination width of the pixelmap
* @param aDHeight The destination height of the pixelmap
--- a/gfx/public/nsIRenderingContext.h
+++ b/gfx/public/nsIRenderingContext.h
@@ -43,37 +43,34 @@
#include "nscore.h"
#include "nsISupports.h"
#include "nsColor.h"
#include "nsCoord.h"
#include "nsRect.h"
#include "nsPoint.h"
#include "nsSize.h"
-#include "nsIDrawingSurface.h"
#include <stdio.h>
class nsIWidget;
class nsIFontMetrics;
class nsTransform2D;
class nsString;
class nsIDeviceContext;
class nsIRegion;
class nsIAtom;
struct nsFont;
struct nsTextDimensions;
#ifdef MOZ_MATHML
struct nsBoundingMetrics;
#endif
-#ifdef MOZ_CAIRO_GFX
class gfxASurface;
class gfxContext;
-#endif
/* gfx2 */
class imgIContainer;
//cliprect/region combination methods
typedef enum
{
@@ -120,88 +117,38 @@ public:
* @param aWidget the widget to hook up to
* @result The result of the initialization, NS_Ok if no errors
*/
NS_IMETHOD Init(nsIDeviceContext* aContext, nsIWidget *aWidget) = 0;
/**
* Initialize the RenderingContext
* @param aContext the device context to use for the drawing.
- * @param aSurface the surface to draw into
- * @result The result of the initialization, NS_Ok if no errors
- */
- NS_IMETHOD Init(nsIDeviceContext* aContext, nsIDrawingSurface* aSurface) = 0;
-
-#ifdef MOZ_CAIRO_GFX
- /**
- * Initialize the RenderingContext
- * @param aContext the device context to use for the drawing.
* @param aThebesSurface the Thebes gfxASurface to which to draw
* @result The result of the initialization, NS_Ok if no errors
*/
NS_IMETHOD Init(nsIDeviceContext* aContext, gfxASurface* aThebesSurface) = 0;
/**
* Initialize the RenderingContext
* @param aContext the device context to use for the drawing.
* @param aThebesContext an existing thebes context to use for the drawing
* @result The result of the initialization, NS_Ok if no errors
*/
NS_IMETHOD Init(nsIDeviceContext* aContext, gfxContext* aThebesContext) = 0;
-#endif
-
- /**
- * Reset the rendering context
- */
- NS_IMETHOD Reset(void) = 0;
/**
* Get the DeviceContext that this RenderingContext was initialized
* with. This function addrefs the device context. Though it might
* be better if it just returned it directly, without addrefing.
* @result the device context
*/
NS_IMETHOD GetDeviceContext(nsIDeviceContext *& aDeviceContext) = 0;
/**
- * Lock a rect of the drawing surface associated with the
- * rendering context. do not attempt to use any of the Rendering Context
- * rendering or state management methods until the drawing surface has
- * been Unlock()ed. if a drawing surface is Lock()ed with this method,
- * it must be Unlock()ed by calling UnlockDrawingSurface() rather than
- * just calling the Unlock() method on the drawing surface directly.
- * see nsIDrawingSurface.h for more information
- * @return error status
- **/
- NS_IMETHOD LockDrawingSurface(PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight,
- void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes,
- PRUint32 aFlags) = 0;
-
- /**
- * Unlock a rect of the drawing surface associated with the rendering
- * context. see nsIDrawingSurface.h for more information.
- * @return error status
- **/
- NS_IMETHOD UnlockDrawingSurface(void) = 0;
-
- /**
- * Selects an offscreen drawing surface into the RenderingContext to draw to.
- * @param aSurface is the offscreen surface we are going to draw to.
- * if nsnull, the original drawing surface obtained at initialization
- * should be selected.
- */
- NS_IMETHOD SelectOffScreenDrawingSurface(nsIDrawingSurface* aSurface) = 0;
-
- /**
- * Get the currently selected drawing surface
- * @param aSurface out parameter for the current drawing surface
- */
- NS_IMETHOD GetDrawingSurface(nsIDrawingSurface* *aSurface) = 0;
-
- /**
* Returns in aResult any rendering hints that the context has.
* See below for the hints bits. Always returns NS_OK.
*/
NS_IMETHOD GetHints(PRUint32& aResult) = 0;
/**
* Save a graphical state onto a stack.
*/
@@ -214,98 +161,41 @@ public:
// XXX temporary
NS_IMETHOD PushFilter(const nsRect& aRect, PRBool aAreaIsOpaque, float aOpacity)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD PopFilter()
{ return NS_ERROR_NOT_IMPLEMENTED; }
/**
- * Tells if a given rectangle is visible within the rendering context
- * @param aRect is the rectangle that will be checked for visiblity
- * @result If true, that rectanglular area is visable.
- */
- NS_IMETHOD IsVisibleRect(const nsRect& aRect, PRBool &aIsVisible) = 0;
-
- /**
* Sets the clipping for the RenderingContext to the passed in rectangle.
* The rectangle is in app units!
* @param aRect The rectangle to set the clipping rectangle to
* @param aCombine how to combine this rect with the current clip region.
* see the bottom of nsIRenderingContext.h
*/
NS_IMETHOD SetClipRect(const nsRect& aRect, nsClipCombine aCombine) = 0;
/**
- * Gets the bounds of the clip region of the RenderingContext. The bounds are returned
- * in device units!
- * @param aRect out parameter to contain the clip region bounds
- * for the RenderingContext
- * @return PR_TRUE if the rendering context has a local cliprect set
- * else aRect is undefined
- */
- NS_IMETHOD GetClipRect(nsRect &aRect, PRBool &aHasLocalClip) = 0;
-
- /**
* Sets the line style for the RenderingContext
* @param aLineStyle The line style
* @return NS_OK if the line style is correctly set
*/
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle) = 0;
/**
- * Gets the line style for the RenderingContext
- * @param aLineStyle The line style to be retrieved
- * @return NS_OK if the line style is correctly retrieved
- */
- NS_IMETHOD GetLineStyle(nsLineStyle &aLineStyle) = 0;
-
- /**
- * Gets the Pen Mode for the RenderingContext
- * @param aPenMode The Pen Mode to be retrieved
- * @return NS_OK if the Pen Mode is correctly retrieved
- */
- NS_IMETHOD GetPenMode(nsPenMode &aPenMode) =0;
-
- /**
- * Sets the Pen Mode for the RenderingContext
- * @param aPenMode The Pen Mode
- * @return NS_OK if the Pen Mode is correctly set
- */
- NS_IMETHOD SetPenMode(nsPenMode aPenMode) =0;
-
-
- /**
* Sets the clipping for the RenderingContext to the passed in region.
* The region is in device coordinates!
* @param aRegion The region to set the clipping area to, IN DEVICE COORDINATES
* @param aCombine how to combine this region with the current clip region.
* see the bottom of nsIRenderingContext.h
*/
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine) = 0;
/**
- * Gets a copy of the current clipping region for the RenderingContext
- * The region is in device coordinates!
- * @param aRegion inout parameter representing the clip region.
- * if SetClipRegion() is called, do not assume that GetClipRegion()
- * will return the same object.
- */
- NS_IMETHOD CopyClipRegion(nsIRegion &aRegion) = 0;
-
- /**
- * Gets the current clipping region for the RenderingContext
- * The region is in device coordinates!
- * @param aRegion out parameter representing the clip region.
- * if SetClipRegion() is called, do not assume that GetClipRegion()
- * will return the same object.
- */
- NS_IMETHOD GetClipRegion(nsIRegion **aRegion) = 0;
-
- /**
* Sets the forground color for the RenderingContext
* @param aColor The color to set the RenderingContext to
*/
NS_IMETHOD SetColor(nscolor aColor) = 0;
/**
* Get the forground color for the RenderingContext
* @return The current forground color of the RenderingContext
@@ -376,50 +266,25 @@ public:
/**
* Get the current transformation matrix for the RenderingContext
* @return The transformation matrix for the RenderingContext
*/
NS_IMETHOD GetCurrentTransform(nsTransform2D *&aTransform) = 0;
/**
- * Create an offscreen drawing surface compatible with this RenderingContext.
- * The rect passed in is not affected by any transforms in the rendering
- * context and the values are in device units.
- * @param aBounds A rectangle representing the size for the drawing surface.
- * if nsnull then a bitmap will not be created and associated
- * with the new drawing surface
- * @param aSurfFlags see bottom of nsIRenderingContext.h
- * @return A nsIDrawingSurface*
- */
- NS_IMETHOD CreateDrawingSurface(const nsRect& aBounds, PRUint32 aSurfFlags, nsIDrawingSurface* &aSurface) = 0;
-
- /**
- * Destroy a drawing surface created by CreateDrawingSurface()
- * @param aDS A drawing surface to destroy
- */
- NS_IMETHOD DestroyDrawingSurface(nsIDrawingSurface* aDS) = 0;
-
- /**
* Draw a line
* @param aXO starting horiztonal coord in twips
* @param aY0 starting vertical coord in twips
* @param aX1 end horiztonal coord in twips
* @param aY1 end vertical coord in twips
*/
NS_IMETHOD DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1) = 0;
/**
- * Draw a polyline
- * @param aPoints array of endpoints
- * @param aNumPonts number of points
- */
- NS_IMETHOD DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
-
- /**
* Draw a rectangle
* @param aRect The rectangle to draw
*/
NS_IMETHOD DrawRect(const nsRect& aRect) = 0;
/**
* Draw a rectangle
* @param aX Horizontal left Coordinate in twips
@@ -455,34 +320,16 @@ public:
* @param aX Horizontal left Coordinate in twips
* @param aY Vertical top Coordinate in twips
* @param aWidth Width of rectangle in twips
* @param aHeight Height of rectangle in twips
*/
NS_IMETHOD InvertRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
/**
- * For platforms (e.g., Cocoa) that implicitly double buffer, this call can be used
- * to force a buffer flush following the painting of a rectangle. This
- * call needs to be used any time drawing of rects is being done "on the fly",
- * outside of the normal painting process.
- * Examples include the blinking caret and tabbing through subimages in an
- * image map.
- */
- NS_IMETHOD FlushRect(const nsRect& aRect) = 0;
- NS_IMETHOD FlushRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
-
- /**
- * Draw a poly in the current foreground color
- * @param aPoints points to use for the drawing, last must equal first
- * @param aNumPonts number of points in the polygon
- */
- NS_IMETHOD DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
-
- /**
* Fill a poly in the current foreground color
* @param aPoints points to use for the drawing, last must equal first
* @param aNumPonts number of points in the polygon
*/
NS_IMETHOD FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints) = 0;
/**
* Draw an ellipse in the current foreground color
@@ -510,58 +357,16 @@ public:
* @param aX Horizontal left Coordinate in twips
* @param aY Vertical top Coordinate in twips
* @param aWidth Width of horizontal axis in twips
* @param aHeight Height of vertical axis in twips
*/
NS_IMETHOD FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
/**
- * Draw an arc in the current forground color
- * @param aRect The rectangle define bounds of ellipse to use
- * @param aStartAngle the starting angle of the arc, in degrees
- * @param aEndAngle The ending angle of the arc, in degrees
- */
- NS_IMETHOD DrawArc(const nsRect& aRect,
- float aStartAngle, float aEndAngle) = 0;
-
- /**
- * Draw an arc in the current forground color
- * @param aX Horizontal left Coordinate in twips
- * @param aY Vertical top Coordinate in twips
- * @param aWidth Width of horizontal axis in twips
- * @param aHeight Height of vertical axis in twips
- * @param aStartAngle the starting angle of the arc, in degrees
- * @param aEndAngle The ending angle of the arc, in degrees
- */
- NS_IMETHOD DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
- float aStartAngle, float aEndAngle) = 0;
-
- /**
- * Fill an arc in the current forground color
- * @param aRect The rectangle define bounds of ellipse to use
- * @param aStartAngle the starting angle of the arc, in degrees
- * @param aEndAngle The ending angle of the arc, in degrees
- */
- NS_IMETHOD FillArc(const nsRect& aRect,
- float aStartAngle, float aEndAngle) = 0;
-
- /**
- * Fill an arc in the current forground color
- * @param aX Horizontal left Coordinate in twips
- * @param aY Vertical top Coordinate in twips
- * @param aWidth Width of horizontal axis in twips
- * @param aHeight Height of vertical axis in twips
- * @param aStartAngle the starting angle of the arc, in degrees
- * @param aEndAngle The ending angle of the arc, in degrees
- */
- NS_IMETHOD FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
- float aStartAngle, float aEndAngle) = 0;
-
- /**
* Returns the width (in app units) of an 8-bit character
* If no font has been Set, the results are undefined.
* @param aC character to measure
* @param aWidth out parameter for width
* @return error status
*/
NS_IMETHOD GetWidth(char aC, nscoord &aWidth) = 0;
@@ -725,27 +530,16 @@ public:
* selection for complex unicode strings. the value
* passed is returned by the DrawString() methods.
* @param aSpacing inter-character spacing to apply
*/
NS_IMETHOD DrawString(const nsString& aString, nscoord aX, nscoord aY,
PRInt32 aFontID = -1,
const nscoord* aSpacing = nsnull) = 0;
- /**
- * Copy offscreen pixelmap to this RenderingContext.
- * @param aSrcSurf drawing surface to copy bits from
- * @param aSrcX x offset into source pixelmap to copy from
- * @param aSrcY y offset into source pixelmap to copy from
- * @param aDestBounds Destination rectangle to copy to
- * @param aCopyFlags see below
- */
- NS_IMETHOD CopyOffScreenBits(nsIDrawingSurface* aSrcSurf, PRInt32 aSrcX, PRInt32 aSrcY,
- const nsRect &aDestBounds, PRUint32 aCopyFlags) = 0;
-
enum GraphicDataType {
NATIVE_CAIRO_CONTEXT = 1,
NATIVE_GDK_DRAWABLE = 2,
NATIVE_WINDOWS_DC = 3,
NATIVE_MAC_THING = 4,
NATIVE_THEBES_CONTEXT = 5
};
/**
@@ -789,28 +583,17 @@ public:
* right-to-left base direction
*/
NS_IMETHOD SetRightToLeftText(PRBool aIsRTL) = 0;
/**
* This sets the direction of the text; all characters should be
* overridden to have this direction.
*/
- virtual void SetTextRunRTL(PRBool aIsRTL) {}
-
- /**
- * Draw a portion of an image, scaling it to fit within a specified rect.
- * @param aImage The image to draw
- * @param aSrcRect The rect (in twips) of the image to draw.
- * [x,y] denotes the top left corner of the region.
- * @param aDestRect The device context rect (in twips) that the image
- * portion should occupy. [x,y] denotes the top left corner.
- * [height,width] denotes the desired image size.
- */
- NS_IMETHOD DrawImage(imgIContainer *aImage, const nsRect & aSrcRect, const nsRect & aDestRect) = 0;
+ virtual void SetTextRunRTL(PRBool aIsRTL) = 0;
/*
* Tiles an image over an area
* @param aImage Image to tile
* @param aXImageStart x location where the origin (0,0) of the image starts
* @param aYImageStart y location where the origin (0,0) of the image starts
* @param aTargetRect area to draw to
*/
@@ -911,23 +694,16 @@ public:
* NS_ERROR_NOT_IMPLEMENTED is returned if the rendering context
* doesn't support rendering EPSF,
*/
NS_IMETHOD RenderEPS(const nsRect& aRect, FILE *aDataFile) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIRenderingContext, NS_IRENDERING_CONTEXT_IID)
-//modifiers for text rendering
-
-#define NS_DRAWSTRING_NORMAL 0x0
-#define NS_DRAWSTRING_UNDERLINE 0x1
-#define NS_DRAWSTRING_OVERLINE 0x2
-#define NS_DRAWSTRING_LINE_THROUGH 0x4
-
// Bit values for GetHints
/**
* This bit, when set, indicates that the underlying rendering system
* prefers 8 bit text rendering over PRUnichar text rendering. When this
* bit is <b>not</b> set the opposite is true: the system prefers PRUnichar
* rendering, not 8 bit rendering.
*/
--- a/gfx/src/nsDeviceContext.cpp
+++ b/gfx/src/nsDeviceContext.cpp
@@ -136,34 +136,16 @@ NS_IMETHODIMP DeviceContextImpl::CreateR
aContext = pContext;
NS_ADDREF(aContext);
}
}
return rv;
}
-NS_IMETHODIMP DeviceContextImpl::CreateRenderingContext(nsIDrawingSurface* aSurface, nsIRenderingContext *&aContext)
-{
- nsresult rv;
-
- aContext = nsnull;
- nsCOMPtr<nsIRenderingContext> pContext;
- rv = CreateRenderingContextInstance(*getter_AddRefs(pContext));
- if (NS_SUCCEEDED(rv)) {
- rv = InitRenderingContext(pContext, aSurface);
- if (NS_SUCCEEDED(rv)) {
- aContext = pContext;
- NS_ADDREF(aContext);
- }
- }
-
- return rv;
-}
-
NS_IMETHODIMP DeviceContextImpl::CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext)
{
nsresult rv;
aContext = nsnull;
nsCOMPtr<nsIRenderingContext> pContext;
rv = CreateRenderingContextInstance(*getter_AddRefs(pContext));
if (NS_SUCCEEDED(rv)) {
@@ -190,21 +172,16 @@ NS_IMETHODIMP DeviceContextImpl::CreateR
return rv;
}
nsresult DeviceContextImpl::InitRenderingContext(nsIRenderingContext *aContext, nsIWidget *aWin)
{
return aContext->Init(this, aWin);
}
-nsresult DeviceContextImpl::InitRenderingContext(nsIRenderingContext *aContext, nsIDrawingSurface* aSurface)
-{
- return aContext->Init(this, aSurface);
-}
-
NS_IMETHODIMP DeviceContextImpl::CreateFontCache()
{
mFontCache = new nsFontCache();
if (!mFontCache) {
return NS_ERROR_OUT_OF_MEMORY;
}
return mFontCache->Init(this);
}
--- a/gfx/src/nsRenderingContextImpl.h
+++ b/gfx/src/nsRenderingContextImpl.h
@@ -188,19 +188,14 @@ public:
const nscoord* aSpacing = nsnull)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD DrawStringInternal(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID = -1,
const nscoord* aSpacing = nsnull)
{ return NS_ERROR_NOT_IMPLEMENTED; }
-#ifdef MOZ_CAIRO_GFX
- NS_IMETHOD Init(nsIDeviceContext* aContext, gfxASurface* aThebesSurface) { return NS_ERROR_NOT_IMPLEMENTED; }
- NS_IMETHOD Init(nsIDeviceContext* aContext, gfxContext* aThebesContext) { return NS_ERROR_NOT_IMPLEMENTED; }
-#endif
-
protected:
virtual ~nsRenderingContextImpl();
};
#endif /* nsRenderingContextImpl */
--- a/gfx/src/thebes/Makefile.in
+++ b/gfx/src/thebes/Makefile.in
@@ -74,17 +74,16 @@ REQUIRES = xpcom \
debug \
imglib2 \
widget \
$(ZLIB_REQUIRES) \
$(NULL)
CPPSRCS = \
nsThebesDeviceContext.cpp \
- nsThebesDrawingSurface.cpp \
nsThebesImage.cpp \
nsThebesRegion.cpp \
nsThebesGfxFactory.cpp \
nsThebesRenderingContext.cpp \
nsThebesFontMetrics.cpp \
nsThebesFontEnumerator.cpp \
$(NULL)
@@ -126,17 +125,17 @@ endif
ifneq (,$(filter $(MOZ_WIDGET_TOOLKIT),mac cocoa))
CPPSRCS += nsSystemFontsMac.cpp
ifdef MOZ_ENABLE_GLITZ
REQUIRES += glitzagl
EXTRA_DSO_LDOPTS += -lmozglitzagl -framework OpenGL -framework AGL
endif
endif
-EXPORTS += nsIThebesRenderingContext.h nsIThebesFontMetrics.h
+EXPORTS += nsIThebesFontMetrics.h
LOCAL_INCLUDES = \
-I$(srcdir)/. \
-I$(srcdir)/.. \
-I$(srcdir)/../shared \
$(NULL)
EXTRA_DSO_LDOPTS += \
deleted file mode 100644
--- a/gfx/src/thebes/nsIThebesRenderingContext.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Christopher Blizzard <blizzard@mozilla.org>.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef __nsIThebesRenderingContext_h
-#define __nsIThebesRenderingContext_h
-
-#include "nsIRenderingContext.h"
-
-// IID for the nsIRenderingContext interface
-#define NSI_THEBES_RENDERING_CONTEXT_IID \
-{ 0x8591c4c6, 0x41d4, 0x485a, \
-{ 0xb2, 0x4f, 0x9d, 0xe1, 0x9b, 0x69, 0xce, 0x02 } }
-
-class nsIThebesRenderingContext : public nsISupports
-{
-public:
- NS_DECLARE_STATIC_IID_ACCESSOR(NSI_THEBES_RENDERING_CONTEXT_IID)
-
- NS_IMETHOD CreateDrawingSurface(nsNativeWidget aWidget, nsIDrawingSurface* &aSurface) = 0;
-
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIThebesRenderingContext,
- NSI_THEBES_RENDERING_CONTEXT_IID)
-
-#endif /* __nsIThebesRenderingContext_h */
--- a/gfx/src/thebes/nsThebesDeviceContext.cpp
+++ b/gfx/src/thebes/nsThebesDeviceContext.cpp
@@ -38,17 +38,16 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIServiceManager.h"
#include "nsIPref.h"
#include "nsCRT.h"
#include "nsThebesDeviceContext.h"
#include "nsThebesRenderingContext.h"
-#include "nsThebesDrawingSurface.h"
#include "nsIView.h"
#include "nsILookAndFeel.h"
#ifdef MOZ_ENABLE_GTK2
// for getenv
#include <stdlib.h>
@@ -282,36 +281,16 @@ nsThebesDeviceContext::CreateRenderingCo
nsCOMPtr<nsIWidget> widget;
widget = aView->GetWidget();
return CreateRenderingContext(widget, aContext);
}
NS_IMETHODIMP
-nsThebesDeviceContext::CreateRenderingContext(nsIDrawingSurface *aSurface,
- nsIRenderingContext *&aContext)
-{
- nsresult rv;
-
- aContext = nsnull;
- nsCOMPtr<nsIRenderingContext> pContext;
- rv = CreateRenderingContextInstance(*getter_AddRefs(pContext));
- if (NS_SUCCEEDED(rv)) {
- rv = pContext->Init(this, aSurface);
- if (NS_SUCCEEDED(rv)) {
- aContext = pContext;
- NS_ADDREF(aContext);
- }
- }
-
- return rv;
-}
-
-NS_IMETHODIMP
nsThebesDeviceContext::CreateRenderingContext(nsIWidget *aWidget,
nsIRenderingContext *&aContext)
{
nsresult rv;
aContext = nsnull;
nsCOMPtr<nsIRenderingContext> pContext;
rv = CreateRenderingContextInstance(*getter_AddRefs(pContext));
--- a/gfx/src/thebes/nsThebesDeviceContext.h
+++ b/gfx/src/thebes/nsThebesDeviceContext.h
@@ -70,17 +70,16 @@ public:
static void Shutdown();
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD Init(nsNativeWidget aWidget);
NS_IMETHOD InitForPrinting(nsIDeviceContextSpec *aDevSpec);
NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext);
- NS_IMETHOD CreateRenderingContext(nsIDrawingSurface *aSurface, nsIRenderingContext *&aContext);
NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext);
NS_IMETHOD CreateRenderingContext(nsIRenderingContext *&aContext);
NS_IMETHOD CreateRenderingContextInstance(nsIRenderingContext *&aContext);
NS_IMETHOD SupportsNativeWidgets(PRBool& aSupportsWidgets);
NS_IMETHOD PrepareNativeWidget(nsIWidget *aWidget, void **aOut);
NS_IMETHOD GetSystemFont(nsSystemFontID aID, nsFont *aFont) const;
deleted file mode 100644
--- a/gfx/src/thebes/nsThebesDrawingSurface.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is thebes gfx.
- *
- * The Initial Developer of the Original Code is
- * mozilla.org.
- * Portions created by the Initial Developer are Copyright (C) 2005
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Vladimir Vukicevic <vladimir@pobox.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsThebesDrawingSurface.h"
-#include "nsThebesDeviceContext.h"
-
-#include "nsMemory.h"
-
-#include "gfxPlatform.h"
-
-#include "gfxImageSurface.h"
-
-#ifdef MOZ_ENABLE_GTK2
-#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
-#include "gfxXlibSurface.h"
-#endif
-
-#include <stdlib.h>
-
-NS_IMPL_ISUPPORTS1(nsThebesDrawingSurface, nsIDrawingSurface)
-
-nsThebesDrawingSurface::nsThebesDrawingSurface()
-{
-}
-
-nsThebesDrawingSurface::~nsThebesDrawingSurface()
-{
- // destroy this before any other bits are destroyed,
- // in case they depend on them
- mSurface = nsnull;
-}
-
-nsresult
-nsThebesDrawingSurface::Init(nsThebesDeviceContext *aDC, gfxASurface *aSurface)
-{
- mDC = aDC;
- mSurface = aSurface;
-
- // don't know
- mWidth = 0;
- mHeight = 0;
-
- return NS_OK;
-}
-
-nsresult
-nsThebesDrawingSurface::Init(nsThebesDeviceContext *aDC, PRUint32 aWidth, PRUint32 aHeight, PRBool aFastAccess)
-{
- NS_ASSERTION(mSurface == nsnull, "Surface already initialized!");
- NS_ASSERTION(aWidth > 0 && aHeight > 0, "Invalid surface dimensions!");
-
- PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsThebesDrawingSurface::Init aDC %p w %d h %d fast %d\n", this, aDC, aWidth, aHeight, aFastAccess));
-
- mWidth = aWidth;
- mHeight = aHeight;
- mDC = aDC;
-
- // XXX Performance Problem
- // because we don't pass aDC->GetWidget() (a HWND on Windows) to this function,
- // we get DIBs instead of DDBs.
- mSurface = gfxPlatform::GetPlatform()->CreateOffscreenSurface(gfxIntSize(aWidth, aHeight), gfxImageSurface::ImageFormatARGB32);
-
- return NS_OK;
-}
-
-nsresult
-nsThebesDrawingSurface::Init (nsThebesDeviceContext *aDC, nsIWidget *aWidget)
-{
- NS_ERROR("Should never be called.");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-nsresult
-nsThebesDrawingSurface::Init (nsThebesDeviceContext *aDC, nsNativeWidget aWidget)
-{
- NS_ERROR("Should never be called.");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-#ifdef MOZ_ENABLE_GTK2
-static nsresult ConvertPixmapsGTK(GdkPixmap* aPmBlack, GdkPixmap* aPmWhite,
- const nsIntSize& aSize, PRUint8* aData);
-#endif
-
-nsresult
-nsThebesDrawingSurface::Init (nsThebesDeviceContext *aDC,
- void* aNativePixmapBlack,
- void* aNativePixmapWhite,
- const nsIntSize& aSrcSize)
-{
- PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsThebesDrawingSurface::Init aDC %p nativeBlack %p nativeWhite %p size [%d,%d]\n", this, aDC, aNativePixmapBlack, aNativePixmapWhite, aSrcSize.width, aSrcSize.height));
-
- mWidth = aSrcSize.width;
- mHeight = aSrcSize.height;
-
-#ifdef MOZ_ENABLE_GTK2
- nsresult rv;
- nsRefPtr<gfxImageSurface> imgSurf = new gfxImageSurface(gfxIntSize(mWidth, mHeight), gfxImageSurface::ImageFormatARGB32);
-
- GdkPixmap* pmBlack = NS_STATIC_CAST(GdkPixmap*, aNativePixmapBlack);
- GdkPixmap* pmWhite = NS_STATIC_CAST(GdkPixmap*, aNativePixmapWhite);
-
- rv = ConvertPixmapsGTK(pmBlack, pmWhite, aSrcSize, imgSurf->Data());
- if (NS_FAILED(rv))
- return rv;
-
- mSurface = imgSurf;
-#else
- NS_ERROR ("nsThebesDrawingSurface init from black/white pixmaps; either implement this or fix the caller");
-#endif
-
- return NS_OK;
-}
-
-nsresult
-nsThebesDrawingSurface::PushFilter(const nsIntRect& aRect, PRBool aAreaIsOpaque, float aOpacity)
-{
- return NS_OK;
-}
-
-void
-nsThebesDrawingSurface::PopFilter()
-{
-
-}
-
-NS_IMETHODIMP
-nsThebesDrawingSurface::Lock (PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight,
- void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes,
- PRUint32 aFlags)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesDrawingSurface::Unlock (void)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesDrawingSurface::GetDimensions (PRUint32 *aWidth, PRUint32 *aHeight)
-{
- if (mWidth == 0 && mHeight == 0)
- NS_ERROR("nsThebesDrawingSurface::GetDimensions on a surface for which we don't know width/height!");
- *aWidth = mWidth;
- *aHeight = mHeight;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsThebesDrawingSurface::IsOffscreen(PRBool *aOffScreen)
-{
- /* remove this method */
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesDrawingSurface::IsPixelAddressable(PRBool *aAddressable)
-{
- /* remove this method */
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesDrawingSurface::GetPixelFormat(nsPixelFormat *aFormat)
-{
- /* remove this method, and make canvas and DumpToPPM stop using it */
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/***** Platform specific helpers ****/
-
-/**
- * Builds an ARGB word from channel values. r,g,b must already
- * be premultipled/rendered onto black.
- */
-static PRInt32 BuildARGB(PRUint8 aR, PRUint8 aG, PRUint8 aB, PRUint8 aA)
-{
- return (aA << 24) | (aR << 16) | (aG << 8) | aB;
-}
-
-#ifdef MOZ_ENABLE_GTK2
-static nsresult ConvertPixmapsGTK(GdkPixmap* aPmBlack, GdkPixmap* aPmWhite,
- const nsIntSize& aSize, PRUint8* aData)
-{
- GdkImage *imgBlack = gdk_image_get(aPmBlack, 0, 0,
- aSize.width,
- aSize.height);
- GdkImage *imgWhite = gdk_image_get(aPmWhite, 0, 0,
- aSize.width,
- aSize.height);
-
- if (!imgBlack || !imgWhite)
- return NS_ERROR_OUT_OF_MEMORY;
-
- PRUint8* blackData = (PRUint8*)GDK_IMAGE_XIMAGE(imgBlack)->data;
- PRUint8* whiteData = (PRUint8*)GDK_IMAGE_XIMAGE(imgWhite)->data;
- PRInt32 bpp = GDK_IMAGE_XIMAGE(imgBlack)->bits_per_pixel;
- PRInt32 stride = GDK_IMAGE_XIMAGE(imgBlack)->bytes_per_line;
- PRInt32* argb = (PRInt32*)aData;
-
- if (bpp == 24 || bpp == 32) {
- PRInt32 pixSize = bpp/8;
- for (PRInt32 y = 0; y < aSize.height; ++y) {
- PRUint8* blackRow = blackData + y*stride;
- PRUint8* whiteRow = whiteData + y*stride;
- for (PRInt32 x = 0; x < aSize.width; ++x) {
- PRUint8 alpha = 0;
- if (blackRow[0] == whiteRow[0] &&
- blackRow[1] == whiteRow[1] &&
- blackRow[2] == whiteRow[2]) {
- alpha = 0xFF;
- }
- *argb++ = BuildARGB(blackRow[2], blackRow[1],
- blackRow[0], alpha);
- blackRow += pixSize;
- whiteRow += pixSize;
- }
- }
- } else {
- NS_ERROR("Unhandled bpp!");
- }
-
- gdk_image_unref(imgBlack);
- gdk_image_unref(imgWhite);
-
- return NS_OK;
-}
-#endif
deleted file mode 100644
--- a/gfx/src/thebes/nsThebesDrawingSurface.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is thebes gfx.
- *
- * The Initial Developer of the Original Code is
- * mozilla.org.
- * Portions created by the Initial Developer are Copyright (C) 2005
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Vladimir Vukicevic <vladimir@pobox.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef _NSTHEBESDRAWINGSURFACE_H_
-#define _NSTHEBESDRAWINGSURFACE_H_
-
-#include "nsCOMPtr.h"
-
-#include "nsSize.h"
-#include "nsRect.h"
-#include "nsIDrawingSurface.h"
-#include "nsIWidget.h"
-
-#include "gfxASurface.h"
-
-class nsThebesDeviceContext;
-
-class nsThebesDrawingSurface : public nsIDrawingSurface
-{
-public:
- nsThebesDrawingSurface ();
- virtual ~nsThebesDrawingSurface ();
-
- // create a image surface if aFastAccess == TRUE, otherwise create
- // a fast server pixmap
- nsresult Init (nsThebesDeviceContext *aDC, PRUint32 aWidth, PRUint32 aHeight, PRBool aFastAccess);
-
- // wrap a gfxASurface with a nsThebesDrawingSurface
- nsresult Init (nsThebesDeviceContext *aDC, gfxASurface *aSurface);
-
- // create a fast drawing surface for a native widget
- nsresult Init (nsThebesDeviceContext *aDC, nsIWidget *aWidget);
-
- // create a fast drawing surface for a native widget
- nsresult Init (nsThebesDeviceContext *aDC, nsNativeWidget aWidget);
-
- // create a drawing surface for a native pixmap
- nsresult Init (nsThebesDeviceContext* aDC, void* aNativePixmapBlack,
- void* aNativePixmapWhite,
- const nsIntSize& aSize);
-
- // nsISupports interface
- NS_DECL_ISUPPORTS
-
- // nsIDrawingSurface interface
-
- NS_IMETHOD Lock(PRInt32 aX, PRInt32 aY, PRUint32 aWidth, PRUint32 aHeight,
- void **aBits, PRInt32 *aStride, PRInt32 *aWidthBytes,
- PRUint32 aFlags);
- NS_IMETHOD Unlock(void);
- NS_IMETHOD GetDimensions(PRUint32 *aWidth, PRUint32 *aHeight);
- NS_IMETHOD IsOffscreen(PRBool *aOffScreen);
- NS_IMETHOD IsPixelAddressable(PRBool *aAddressable);
- NS_IMETHOD GetPixelFormat(nsPixelFormat *aFormat);
-
- /* utility functions */
- gfxASurface *GetThebesSurface(void) { return mSurface; }
- PRInt32 GetDepth() { /* XXX */ return 24; }
-
- nsresult PushFilter(const nsIntRect& aRect, PRBool aAreaIsOpaque, float aOpacity);
- void PopFilter();
-private:
- nsRefPtr<gfxASurface> mSurface;
- nsThebesDeviceContext *mDC;
-
- PRUint32 mWidth, mHeight;
-};
-
-#endif /* _NSTHEBESDRAWINGSURFACE_H_ */
--- a/gfx/src/thebes/nsThebesImage.cpp
+++ b/gfx/src/thebes/nsThebesImage.cpp
@@ -578,27 +578,16 @@ nsThebesImage::ThebesDrawTile(gfxContext
thebesContext->SetColor(gfxRGBA(0,0,0,0));
if (doSnap)
thebesContext->SetMatrix(savedCTM);
return NS_OK;
}
-/* This function is going away; it's been replaced by ThebesDrawTile above. */
-NS_IMETHODIMP
-nsThebesImage::DrawTile(nsIRenderingContext &aContext,
- nsIDrawingSurface *aSurface,
- PRInt32 aSXOffset, PRInt32 aSYOffset,
- PRInt32 aPadX, PRInt32 aPadY,
- const nsRect &aTileRect)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
/* This is only used by the GIF decoder, via gfxImageFrame::DrawTo */
NS_IMETHODIMP
nsThebesImage::DrawToImage(nsIImage* aDstImage, PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
{
nsThebesImage *dstThebesImage = NS_STATIC_CAST(nsThebesImage*, aDstImage);
nsRefPtr<gfxContext> dst = new gfxContext(dstThebesImage->ThebesSurface());
--- a/gfx/src/thebes/nsThebesImage.h
+++ b/gfx/src/thebes/nsThebesImage.h
@@ -70,21 +70,16 @@ public:
virtual PRBool GetIsImageComplete();
virtual void ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect);
virtual nsresult Optimize(nsIDeviceContext* aContext);
virtual nsColorMap *GetColorMap();
NS_IMETHOD Draw(nsIRenderingContext &aContext,
const gfxRect &aSourceRect,
const gfxRect &aDestRect);
- NS_IMETHOD DrawTile(nsIRenderingContext &aContext,
- nsIDrawingSurface *aSurface,
- PRInt32 aSXOffset, PRInt32 aSYOffset,
- PRInt32 aPadX, PRInt32 aPadY,
- const nsRect &aTileRect);
NS_IMETHOD DrawToImage(nsIImage* aDstImage,
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight);
nsresult ThebesDrawTile(gfxContext *thebesContext,
nsIDeviceContext* dx,
const gfxPoint& aOffset,
const gfxRect& aTileRect,
const PRInt32 aXPadding,
--- a/gfx/src/thebes/nsThebesRenderingContext.cpp
+++ b/gfx/src/thebes/nsThebesRenderingContext.cpp
@@ -48,17 +48,16 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsGfxCIID.h"
#include "imgIContainer.h"
#include "gfxIImageFrame.h"
#include "nsIImage.h"
#include "nsIThebesFontMetrics.h"
-#include "nsThebesDrawingSurface.h"
#include "nsThebesRegion.h"
#include "nsThebesImage.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "gfxPlatform.h"
@@ -75,17 +74,17 @@ static NS_DEFINE_CID(kRegionCID, NS_REGI
// XXXTodo: rename FORM_TWIPS to FROM_APPUNITS
#define FROM_TWIPS(_x) ((gfxFloat)((_x)/(mP2A)))
#define FROM_TWIPS_INT(_x) (NSToIntRound((gfxFloat)((_x)/(mP2A))))
#define TO_TWIPS(_x) ((nscoord)((_x)*(mP2A)))
#define GFX_RECT_FROM_TWIPS_RECT(_r) (gfxRect(FROM_TWIPS((_r).x), FROM_TWIPS((_r).y), FROM_TWIPS((_r).width), FROM_TWIPS((_r).height)))
//////////////////////////////////////////////////////////////////////
-NS_IMPL_ISUPPORTS2(nsThebesRenderingContext, nsIRenderingContext, nsIThebesRenderingContext)
+NS_IMPL_ISUPPORTS1(nsThebesRenderingContext, nsIRenderingContext)
nsThebesRenderingContext::nsThebesRenderingContext() :
mLineStyle(nsLineStyle_kNone)
{
}
nsThebesRenderingContext::~nsThebesRenderingContext()
{
@@ -99,120 +98,75 @@ nsThebesRenderingContext::Init(nsIDevice
{
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::Init ctx %p thebesSurface %p\n", this, aContext, aThebesSurface));
nsThebesDeviceContext *thebesDC = NS_STATIC_CAST(nsThebesDeviceContext*, aContext);
mDeviceContext = aContext;
mWidget = nsnull;
- mLocalDrawingSurface = new nsThebesDrawingSurface();
- mLocalDrawingSurface->Init(thebesDC, aThebesSurface);
- mDrawingSurface = mLocalDrawingSurface;
-
mThebes = new gfxContext(aThebesSurface);
return (CommonInit());
}
NS_IMETHODIMP
nsThebesRenderingContext::Init(nsIDeviceContext* aContext, gfxContext *aThebesContext)
{
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::Init ctx %p thebesContext %p\n", this, aContext, aThebesContext));
mDeviceContext = aContext;
mWidget = nsnull;
- mLocalDrawingSurface = nsnull;
- mDrawingSurface = nsnull;
-
mThebes = aThebesContext;
return (CommonInit());
}
NS_IMETHODIMP
nsThebesRenderingContext::Init(nsIDeviceContext* aContext, nsIWidget *aWidget)
{
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::Init ctx %p widget %p\n", this, aContext, aWidget));
nsThebesDeviceContext *thebesDC = NS_STATIC_CAST(nsThebesDeviceContext*, aContext);
mDeviceContext = aContext;
mWidget = aWidget;
- mLocalDrawingSurface = new nsThebesDrawingSurface();
-
- nsRefPtr<gfxASurface> surface(aWidget->GetThebesSurface());
- if (surface) {
- mLocalDrawingSurface->Init(thebesDC, surface);
- } else {
- mLocalDrawingSurface->Init(thebesDC, aWidget);
- }
- mDrawingSurface = mLocalDrawingSurface;
-
- mThebes = new gfxContext(mLocalDrawingSurface->GetThebesSurface());
+ mThebes = new gfxContext(aWidget->GetThebesSurface());
//mThebes->SetColor(gfxRGBA(0.9, 0.0, 0.0, 0.3));
//mThebes->Paint();
//mThebes->Translate(gfxPoint(300,0));
//mThebes->Rotate(M_PI/4);
return (CommonInit());
}
NS_IMETHODIMP
-nsThebesRenderingContext::Init(nsIDeviceContext* aContext, nsIDrawingSurface *aSurface)
-{
- NS_ERROR("Should never be called.");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
nsThebesRenderingContext::CommonInit(void)
{
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::CommonInit\n", this));
mThebes->SetLineWidth(1.0);
mP2A = mDeviceContext->AppUnitsPerDevPixel();
return NS_OK;
}
NS_IMETHODIMP
-nsThebesRenderingContext::Reset(void)
-{
- NS_ERROR("nsThebesRenderingContext::Reset called!\n");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
nsThebesRenderingContext::GetDeviceContext(nsIDeviceContext *& aDeviceContext)
{
aDeviceContext = mDeviceContext;
NS_IF_ADDREF(aDeviceContext);
return NS_OK;
}
-NS_IMETHODIMP
-nsThebesRenderingContext::SelectOffScreenDrawingSurface(nsIDrawingSurface *aSurface)
-{
- NS_ERROR("nsThebesRenderingContext::SelectOffScreenDrawingSurface called!");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::GetDrawingSurface(nsIDrawingSurface **aSurface)
-{
- NS_ERROR("nsThebesRenderingContext::GetDrawingSurface called!");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
NS_IMETHODIMP
nsThebesRenderingContext::PushTranslation(PushedTranslation* aState)
{
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::PushTranslation\n", this));
// XXX this is slow!
PushState();
return NS_OK;
@@ -346,39 +300,16 @@ nsThebesRenderingContext::SetClipRegion(
evilPxRegion->FreeRects (rects);
}
mThebes->SetMatrix(mat);
return NS_OK;
}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::GetClipRegion(nsIRegion **aRegion)
-{
- // used in a few misc places (FontMetricsXft, generic RenderingContextImpl for DrawImage,
- // and SVGGDIPlusCanvas
- NS_WARNING("Unimplemented function called");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// only gets called from the caret blinker.
-NS_IMETHODIMP
-nsThebesRenderingContext::FlushRect(const nsRect& aRect)
-{
- return FlushRect(aRect.x, aRect.y, aRect.width, aRect.height);
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::FlushRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
-{
- return NS_OK;
-}
-
//
// other junk
//
NS_IMETHODIMP
nsThebesRenderingContext::SetLineStyle(nsLineStyle aLineStyle)
{
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::SetLineStyle %d\n", this, aLineStyle));
@@ -493,55 +424,16 @@ nsThebesRenderingContext::TransformCoord
pt = mThebes->UserToDevice (pt);
*aX = TO_TWIPS(pt.x);
*aY = TO_TWIPS(pt.y);
}
NS_IMETHODIMP
-nsThebesRenderingContext::CreateDrawingSurface(const nsRect &aBounds,
- PRUint32 aSurfFlags,
- nsIDrawingSurface* &aSurface)
-{
- PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::CreateDrawingSurface [%d,%d,%d,%d] 0x%08x\n", this, aBounds.x, aBounds.y, aBounds.width, aBounds.height, aSurfFlags));
-
- nsThebesDrawingSurface *cds = new nsThebesDrawingSurface();
- nsIDeviceContext *dc = mDeviceContext.get();
- cds->Init (NS_STATIC_CAST(nsThebesDeviceContext *, dc),
- aBounds.width, aBounds.height,
- PR_FALSE);
- aSurface = (nsIDrawingSurface*) cds;
- NS_ADDREF(aSurface);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::CreateDrawingSurface(nsNativeWidget aWidget, nsIDrawingSurface* &aSurface)
-{
- nsThebesDrawingSurface *cds = new nsThebesDrawingSurface();
- nsIDeviceContext *dc = mDeviceContext.get();
- cds->Init (NS_STATIC_CAST(nsThebesDeviceContext *, dc), aWidget);
- aSurface = (nsIDrawingSurface*) cds;
- NS_ADDREF(aSurface);
-
- return NS_OK;
-}
-
-
-NS_IMETHODIMP
-nsThebesRenderingContext::DestroyDrawingSurface(nsIDrawingSurface *aDS)
-{
- NS_RELEASE(aDS);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
nsThebesRenderingContext::DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
{
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::DrawLine %d %d %d %d\n", this, aX0, aY0, aX1, aY1));
gfxPoint p0 = gfxPoint(FROM_TWIPS(aX0), FROM_TWIPS(aY0));
gfxPoint p1 = gfxPoint(FROM_TWIPS(aX1), FROM_TWIPS(aY1));
// we can't draw thick lines with gfx, so we always assume we want pixel-aligned
@@ -799,17 +691,17 @@ nsThebesRenderingContext::FillPolygon(co
}
void*
nsThebesRenderingContext::GetNativeGraphicData(GraphicDataType aType)
{
if (aType == NATIVE_GDK_DRAWABLE &&
!gfxPlatform::GetPlatform()->UseGlitz())
{
- if (mWidget && mDrawingSurface == mLocalDrawingSurface)
+ if (mWidget)
return mWidget->GetNativeData(NS_NATIVE_WIDGET);
}
if (aType == NATIVE_THEBES_CONTEXT)
return mThebes;
if (aType == NATIVE_CAIRO_CONTEXT)
return mThebes->GetCairo();
#ifdef XP_WIN
if (aType == NATIVE_WINDOWS_DC) {
@@ -817,64 +709,16 @@ nsThebesRenderingContext::GetNativeGraph
return NS_STATIC_CAST(gfxWindowsSurface*, NS_STATIC_CAST(gfxASurface*, surf.get()))->GetDC();
}
#endif
return nsnull;
}
NS_IMETHODIMP
-nsThebesRenderingContext::DrawNativeWidgetPixmap(void* aSrcSurfaceBlack,
- void* aSrcSurfaceWhite,
- const nsIntSize& pxSrcSize,
- const nsPoint& twDestPos)
-{
- PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::DrawNativeWidgetPixmap %p %p [%d,%d] [%d,%d]\n", this, aSrcSurfaceBlack, aSrcSurfaceWhite, pxSrcSize.width, pxSrcSize.height, twDestPos.x, twDestPos.y));
-
-#if 0
- // debug
- mThebes->Save();
- mThebes->SetColor(gfxRGBA(0.9, 0.9, 1.0, 1.0));
- mThebes->NewPath();
- mThebes->Rectangle(gfxRect(FROM_TWIPS(twDestPos.x),
- FROM_TWIPS(twDestPos.y),
- pxSrcSize.width,
- pxSrcSize.height),
- PR_TRUE);
- mThebes->Fill();
- mThebes->Restore();
-
- return NS_OK;
-#endif
-
- nsThebesDrawingSurface* tmpSurf = new nsThebesDrawingSurface();
- nsIDeviceContext* dc = mDeviceContext.get();
- nsThebesDeviceContext* cdc = NS_STATIC_CAST(nsThebesDeviceContext*, dc);
-
- tmpSurf->Init(cdc, aSrcSurfaceBlack, aSrcSurfaceWhite, pxSrcSize);
-
- nsRefPtr<gfxPattern> pat = new gfxPattern(tmpSurf->GetThebesSurface());
-
- mThebes->Save();
- mThebes->NewPath();
- // mm, mixed twips and pixels. are we having fun yet?
- mThebes->PixelSnappedRectangleAndSetPattern(gfxRect(FROM_TWIPS(twDestPos.x),
- FROM_TWIPS(twDestPos.y),
- pxSrcSize.width,
- pxSrcSize.height),
- pat);
- mThebes->Fill();
- mThebes->Restore();
-
- delete tmpSurf;
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
nsThebesRenderingContext::PushFilter(const nsRect& twRect, PRBool aAreaIsOpaque, float aOpacity)
{
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG,
("## %p nsTRC::PushFilter [%d,%d,%d,%d] isOpaque: %d opacity: %f\n",
this, twRect.x, twRect.y, twRect.width, twRect.height,
aAreaIsOpaque, aOpacity));
mOpacityArray.AppendElement(aOpacity);
@@ -907,45 +751,16 @@ nsThebesRenderingContext::PopFilter()
mThebes->Restore();
}
return NS_OK;
}
-//
-// Both twSrcRect and twDestRect need to be
-// transformed by the CTM. This is especially odd
-// for the SrcRect!
-//
-
-NS_IMETHODIMP
-nsThebesRenderingContext::DrawImage(imgIContainer *aImage,
- const nsRect &twSrcRect,
- const nsRect &twDestRect)
-{
- PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::DrawImage %p [%d,%d,%d,%d] [%d,%d,%d,%d]\n",
- this, aImage, twSrcRect.x, twSrcRect.y, twSrcRect.width, twSrcRect.height,
- twDestRect.x, twDestRect.y, twDestRect.width, twDestRect.height));
- PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p translation: %f %f\n",
- this,
- mThebes->CurrentMatrix().GetTranslation().x,
- mThebes->CurrentMatrix().GetTranslation().y));
-#if 0
- fprintf (stderr, "DrawImage: src [%f %f %f %f]\n dst [%f %f %f %f]\n x0: %f y0: %f\n",
- FROM_TWIPS(twSrcRect.x), FROM_TWIPS(twSrcRect.y), FROM_TWIPS(twSrcRect.width), FROM_TWIPS(twSrcRect.height),
- FROM_TWIPS(twDestRect.x), FROM_TWIPS(twDestRect.y), FROM_TWIPS(twDestRect.width), FROM_TWIPS(twDestRect.height),
- mThebes->CurrentMatrix().GetTranslation().x, mThebes->CurrentMatrix().GetTranslation().y);
-#endif
-
- NS_NOTREACHED("DrawImage should no longer be called with thebes");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
NS_IMETHODIMP
nsThebesRenderingContext::DrawTile(imgIContainer *aImage,
nscoord twXOffset, nscoord twYOffset,
const nsRect *twTargetRect)
{
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::DrawTile %p %f %f [%f,%f,%f,%f]\n",
this, aImage, FROM_TWIPS(twXOffset), FROM_TWIPS(twYOffset),
FROM_TWIPS(twTargetRect->x), FROM_TWIPS(twTargetRect->y),
@@ -1233,131 +1048,8 @@ nsThebesRenderingContext::GetRangeWidth(
}
NS_IMETHODIMP
nsThebesRenderingContext::RenderEPS(const nsRect& aRect, FILE *aDataFile)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
-////
-//// Unused junk
-////
-
-NS_IMETHODIMP
-nsThebesRenderingContext::IsVisibleRect(const nsRect& aRect, PRBool &aIsVisible)
-{
- NS_ERROR("not used anywhere");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::GetClipRect(nsRect &aRect, PRBool &aHasLocalClip)
-{
- NS_ERROR("not used anywhere");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::LockDrawingSurface(PRInt32 aX, PRInt32 aY,
- PRUint32 aWidth, PRUint32 aHeight,
- void **aBits, PRInt32 *aStride,
- PRInt32 *aWidthBytes,
- PRUint32 aFlags)
-{
- NS_WARNING("Unimplemented function called");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::UnlockDrawingSurface(void)
-{
- NS_WARNING("Unimplemented function called");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::CopyClipRegion(nsIRegion &aRegion)
-{
- NS_WARNING("Unimplemented function called");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::GetLineStyle(nsLineStyle &aLineStyle)
-{
- NS_ERROR("not used anywhere");
- aLineStyle = mLineStyle;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::SetPenMode(nsPenMode aPenMode)
-{
- // aPenMode == nsPenMode_kNone, nsPenMode_kInverted.
- NS_ERROR("not used anywhere");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::GetPenMode(nsPenMode &aPenMode)
-{
- //NS_ERROR("not used anywhere, but used in a debug thing");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-
-NS_IMETHODIMP
-nsThebesRenderingContext::DrawArc(const nsRect& aRect,
- float aStartAngle, float aEndAngle)
-{
- return DrawArc(aRect.x, aRect.y, aRect.width, aRect.height, aStartAngle, aEndAngle);
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
- float aStartAngle, float aEndAngle)
-{
- NS_ERROR("not used");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::FillArc(const nsRect& aRect,
- float aStartAngle, float aEndAngle)
-{
- return FillArc(aRect.x, aRect.y, aRect.width, aRect.height, aStartAngle, aEndAngle);
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
- float aStartAngle, float aEndAngle)
-{
- NS_ERROR("not used");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::DrawPolyline(const nsPoint aPoints[],
- PRInt32 aNumPoints)
-{
- NS_ERROR("DrawPolyline called!");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-nsThebesRenderingContext::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
-{
- NS_ERROR("DrawPolygon called!");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-
-NS_IMETHODIMP
-nsThebesRenderingContext::CopyOffScreenBits(nsIDrawingSurface *aSrcSurf,
- PRInt32 aSrcX, PRInt32 aSrcY,
- const nsRect &aDestBounds,
- PRUint32 aCopyFlags)
-{
- NS_NOTREACHED("CopyOffScreenBits should not be called in cairo builds");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
--- a/gfx/src/thebes/nsThebesRenderingContext.h
+++ b/gfx/src/thebes/nsThebesRenderingContext.h
@@ -49,101 +49,61 @@
#include "nsPoint.h"
#include "nsSize.h"
#include "nsColor.h"
#include "nsRect.h"
#include "nsIRegion.h"
#include "nsTransform2D.h"
#include "nsVoidArray.h"
#include "nsIThebesFontMetrics.h"
-#include "nsIThebesRenderingContext.h"
#include "gfxContext.h"
class nsIImage;
-class nsThebesDrawingSurface;
-
-class nsThebesRenderingContext : public nsIThebesRenderingContext,
- public nsRenderingContextImpl
+class nsThebesRenderingContext : public nsRenderingContextImpl
{
public:
nsThebesRenderingContext();
virtual ~nsThebesRenderingContext();
NS_DECL_ISUPPORTS
NS_IMETHOD Init(nsIDeviceContext* aContext, gfxASurface* aThebesSurface);
NS_IMETHOD Init(nsIDeviceContext* aContext, gfxContext* aThebesContext);
NS_IMETHOD Init(nsIDeviceContext* aContext, nsIWidget *aWidget);
- NS_IMETHOD Init(nsIDeviceContext* aContext, nsIDrawingSurface *aSurface);
NS_IMETHOD CommonInit(void);
- NS_IMETHOD Reset(void);
NS_IMETHOD GetDeviceContext(nsIDeviceContext *& aDeviceContext);
- NS_IMETHOD LockDrawingSurface(PRInt32 aX, PRInt32 aY,
- PRUint32 aWidth, PRUint32 aHeight,
- void **aBits, PRInt32 *aStride,
- PRInt32 *aWidthBytes,
- PRUint32 aFlags);
- NS_IMETHOD UnlockDrawingSurface(void);
- NS_IMETHOD SelectOffScreenDrawingSurface(nsIDrawingSurface *aSurface);
- NS_IMETHOD GetDrawingSurface(nsIDrawingSurface **aSurface);
NS_IMETHOD GetHints(PRUint32& aResult);
- NS_IMETHOD DrawNativeWidgetPixmap(void* aSrcSurfaceBlack,
- void* aSrcSurfaceWhite,
- const nsIntSize& aSrcSize,
- const nsPoint& aDestPos);
NS_IMETHOD PushState(void);
NS_IMETHOD PopState(void);
- NS_IMETHOD IsVisibleRect(const nsRect& aRect, PRBool &aIsVisible);
NS_IMETHOD SetClipRect(const nsRect& aRect, nsClipCombine aCombine);
- NS_IMETHOD GetClipRect(nsRect &aRect, PRBool &aHasLocalClip);
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle);
- NS_IMETHOD GetLineStyle(nsLineStyle &aLineStyle);
- NS_IMETHOD GetPenMode(nsPenMode &aPenMode);
- NS_IMETHOD SetPenMode(nsPenMode aPenMode);
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine);
- NS_IMETHOD CopyClipRegion(nsIRegion &aRegion);
- NS_IMETHOD GetClipRegion(nsIRegion **aRegion);
NS_IMETHOD SetColor(nscolor aColor);
NS_IMETHOD GetColor(nscolor &aColor) const;
NS_IMETHOD SetFont(const nsFont& aFont, nsIAtom* aLangGroup);
NS_IMETHOD SetFont(nsIFontMetrics *aFontMetrics);
NS_IMETHOD GetFontMetrics(nsIFontMetrics *&aFontMetrics);
NS_IMETHOD Translate(nscoord aX, nscoord aY);
NS_IMETHOD Scale(float aSx, float aSy);
NS_IMETHOD GetCurrentTransform(nsTransform2D *&aTransform);
- NS_IMETHOD CreateDrawingSurface(const nsRect &aBounds, PRUint32 aSurfFlags, nsIDrawingSurface* &aSurface);
- NS_IMETHOD CreateDrawingSurface(nsNativeWidget aWidget, nsIDrawingSurface* &aSurface);
- NS_IMETHOD DestroyDrawingSurface(nsIDrawingSurface *aDS);
NS_IMETHOD DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1);
- NS_IMETHOD DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints);
NS_IMETHOD DrawRect(const nsRect& aRect);
NS_IMETHOD DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
NS_IMETHOD FillRect(const nsRect& aRect);
NS_IMETHOD FillRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
NS_IMETHOD InvertRect(const nsRect& aRect);
NS_IMETHOD InvertRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
- NS_IMETHOD FlushRect(const nsRect& aRect);
- NS_IMETHOD FlushRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
- NS_IMETHOD DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
NS_IMETHOD FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints);
NS_IMETHOD DrawEllipse(const nsRect& aRect);
NS_IMETHOD DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
NS_IMETHOD FillEllipse(const nsRect& aRect);
NS_IMETHOD FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
- NS_IMETHOD DrawArc(const nsRect& aRect,
- float aStartAngle, float aEndAngle);
- NS_IMETHOD DrawArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
- float aStartAngle, float aEndAngle);
- NS_IMETHOD FillArc(const nsRect& aRect,
- float aStartAngle, float aEndAngle);
- NS_IMETHOD FillArc(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
- float aStartAngle, float aEndAngle);
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth,
PRInt32 *aFontID = nsnull)
{ return nsRenderingContextImpl::GetWidth(aString, aWidth, aFontID); }
NS_IMETHOD GetWidth(const char* aString, nscoord& aWidth)
{ return nsRenderingContextImpl::GetWidth(aString, aWidth); }
NS_IMETHOD GetWidth(const char* aString, PRUint32 aLength,
nscoord& aWidth)
@@ -213,29 +173,22 @@ public:
#endif /* MOZ_MATHML */
virtual PRInt32 GetMaxStringLength();
NS_IMETHOD PushFilter(const nsRect& aRect, PRBool aAreaIsOpaque, float aOpacity);
NS_IMETHOD PopFilter();
- NS_IMETHOD CopyOffScreenBits(nsIDrawingSurface *aSrcSurf,
- PRInt32 aSrcX, PRInt32 aSrcY,
- const nsRect &aDestBounds,
- PRUint32 aCopyFlags);
virtual void* GetNativeGraphicData(GraphicDataType aType);
NS_IMETHOD PushTranslation(PushedTranslation* aState);
NS_IMETHOD PopTranslation(PushedTranslation* aState);
NS_IMETHOD SetTranslation(nscoord aX, nscoord aY);
- NS_IMETHOD DrawImage(imgIContainer *aImage,
- const nsRect &aSrcRect,
- const nsRect &aDestRect);
NS_IMETHOD DrawTile(imgIContainer *aImage, nscoord aXOffset, nscoord aYOffset,
const nsRect * aTargetRect);
NS_IMETHOD SetRightToLeftText(PRBool aIsRTL);
NS_IMETHOD GetRightToLeftText(PRBool* aIsRTL);
virtual void SetTextRunRTL(PRBool aIsRTL);
NS_IMETHOD GetClusterInfo(const PRUnichar *aText,
PRUint32 aLength,
@@ -273,23 +226,16 @@ protected:
// we need to manage our own clip region (since we can't get at
// the old one from cairo)
nsCOMPtr<nsIThebesFontMetrics> mFontMetrics;
nsLineStyle mLineStyle;
nscolor mColor;
- // this is always the local surface
- nsCOMPtr<nsThebesDrawingSurface> mLocalDrawingSurface;
-
- // this is the current drawing surface; might be same
- // as local, or might be offscreen
- nsCOMPtr<nsThebesDrawingSurface> mDrawingSurface;
-
// the rendering context
nsRefPtr<gfxContext> mThebes;
// for handing out to people
void UpdateTempTransformMatrix();
nsTransform2D mTempTransform;
// keeping track of pushgroup/popgroup opacities
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -47,17 +47,16 @@
#include "nsIFrame.h"
#include "nsPoint.h"
#include "nsRect.h"
#include "nsIViewManager.h"
#include "nsIPresShell.h"
#include "nsFrameManager.h"
#include "nsStyleContext.h"
#include "nsGkAtoms.h"
-#include "nsIDrawingSurface.h"
#include "nsTransform2D.h"
#include "nsIDeviceContext.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIScrollableFrame.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "gfxIImageFrame.h"
@@ -254,23 +253,16 @@ void nsCSSRendering::DrawLine (nsIRender
// Fill a polygon, skipping that portion which crosses aGap. aGap defines a rectangle gap
// This services fieldset legends and only works for points defining a horizontal rectangle
void nsCSSRendering::FillPolygon (nsIRenderingContext& aContext,
const nsPoint aPoints[],
PRInt32 aNumPoints,
nsRect* aGap)
{
-#ifdef DEBUG
- nsPenMode penMode;
- if (NS_SUCCEEDED(aContext.GetPenMode(penMode)) &&
- penMode == nsPenMode_kInvert) {
- NS_WARNING( "Invert mode ignored in FillPolygon" );
- }
-#endif
if (nsnull == aGap) {
aContext.FillPolygon(aPoints, aNumPoints);
} else if (4 == aNumPoints) {
nsPoint gapUpperRight(aGap->x + aGap->width, aGap->y);
nsPoint gapLowerRight(aGap->x + aGap->width, aGap->y + aGap->height);
// sort the 4 points by x
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -97,17 +97,16 @@
//#include <winuser.h>
#include <zmouse.h>
//#include "sysmets.h"
#include "nsGfxCIID.h"
#include "resource.h"
#include <commctrl.h>
#include "prtime.h"
#ifdef MOZ_CAIRO_GFX
-#include "nsIThebesRenderingContext.h"
#include "gfxContext.h"
#include "gfxWindowsSurface.h"
#else
#include "nsIRenderingContextWin.h"
#endif
#include "nsIImage.h"
#ifdef ACCESSIBILITY