Excised nsIDOMRenderingContext

This commit is contained in:
kipp%netscape.com 1999-09-01 01:03:10 +00:00
Родитель 7fe2679e86
Коммит a824a98378
18 изменённых файлов: 53 добавлений и 871 удалений

Просмотреть файл

@ -1,24 +0,0 @@
// -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
//
// The contents of this file are subject to the Netscape Public License
// Version 1.0 (the "NPL"); you may not use this file except in
// compliance with the NPL. You may obtain a copy of the NPL at
// http://www.mozilla.org/NPL/
//
// Software distributed under the NPL is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
// for the specific language governing rights and limitations under the
// NPL.
//
// The Initial Developer of this code under the NPL is Netscape
// Communications Corporation. Portions created by Netscape are
// Copyright (C) 1998 Netscape Communications Corporation. All Rights
// Reserved.
//
interface RenderingContext {
// Set/get the color.
attribute wstring color;
// Draw a line. Duh.
void drawLine2(in long x0, in long y0, in long x1, in long y1);
};

Просмотреть файл

@ -2,7 +2,6 @@
# This is a list of local files which get copied to the mozilla:dist:widget directory
#
nsIDOMRenderingContext.h
nsColor.h
nsColorNames.h
nsColorNameList.h

Просмотреть файл

@ -23,33 +23,32 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
EXPORTS = \
nsIDOMRenderingContext.h \
nsColor.h \
nsColorNames.h \
nsColorNameList.h \
nsCoord.h \
nsFont.h \
nsRect.h \
nsPoint.h \
nsSize.h \
nsMargin.h \
nsTransform2D.h \
nsIRenderingContext.h \
nsIFontMetrics.h \
nsIImageManager.h \
nsIImageGroup.h \
nsIImageRequest.h \
nsIImageObserver.h \
nsIDeviceContext.h \
nsIImage.h \
nsIBlender.h \
nsGfxCIID.h \
nsIRegion.h \
nsDeviceContext.h \
nsIDeviceContextSpec.h \
nsIDeviceContextSpecFactory.h \
nsIDrawingSurface.h \
$(NULL)
nsColor.h \
nsColorNames.h \
nsColorNameList.h \
nsCoord.h \
nsFont.h \
nsRect.h \
nsPoint.h \
nsSize.h \
nsMargin.h \
nsTransform2D.h \
nsIRenderingContext.h \
nsIFontMetrics.h \
nsIImageManager.h \
nsIImageGroup.h \
nsIImageRequest.h \
nsIImageObserver.h \
nsIDeviceContext.h \
nsIImage.h \
nsIBlender.h \
nsGfxCIID.h \
nsIRegion.h \
nsDeviceContext.h \
nsIDeviceContextSpec.h \
nsIDeviceContextSpecFactory.h \
nsIDrawingSurface.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))

Просмотреть файл

@ -1,60 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMRenderingContext_h__
#define nsIDOMRenderingContext_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#define NS_IDOMRENDERINGCONTEXT_IID \
{ 0x6f7652e0, 0xee43, 0x11d1, \
{ 0x9c, 0xc3, 0x00, 0x60, 0x08, 0x8c, 0xa6, 0xb3 } }
class nsIDOMRenderingContext : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMRENDERINGCONTEXT_IID)
NS_IMETHOD GetColor(nsString& aColor)=0;
NS_IMETHOD SetColor(const nsString& aColor)=0;
NS_IMETHOD DrawLine2(PRInt32 aX0, PRInt32 aY0, PRInt32 aX1, PRInt32 aY1)=0;
};
#define NS_DECL_IDOMRENDERINGCONTEXT \
NS_IMETHOD GetColor(nsString& aColor); \
NS_IMETHOD SetColor(const nsString& aColor); \
NS_IMETHOD DrawLine2(PRInt32 aX0, PRInt32 aY0, PRInt32 aX1, PRInt32 aY1); \
#define NS_FORWARD_IDOMRENDERINGCONTEXT(_to) \
NS_IMETHOD GetColor(nsString& aColor) { return _to##GetColor(aColor); } \
NS_IMETHOD SetColor(const nsString& aColor) { return _to##SetColor(aColor); } \
NS_IMETHOD DrawLine2(PRInt32 aX0, PRInt32 aY0, PRInt32 aX1, PRInt32 aY1) { return _to##DrawLine2(aX0, aY0, aX1, aY1); } \
extern nsresult NS_InitRenderingContextClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_GFX nsresult NS_NewScriptRenderingContext(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMRenderingContext_h__

Просмотреть файл

@ -62,30 +62,30 @@ REQUIRES=util img xpcom raptor netlib dom js
DEFINES += -D_IMPL_NS_GFX
CPPSRCS =\
nsColor.cpp \
nsColorNames.cpp \
nsFont.cpp \
nsImageGroup.cpp \
nsImageManager.cpp \
nsImageNetContextAsync.cpp \
nsImageRenderer.cpp \
nsImageRequest.cpp \
nsImageSystemServices.cpp \
nsImageURL.cpp \
nsRect.cpp \
nsTransform2D.cpp \
nsDeviceContext.cpp \
nsBlender.cpp \
nsImageNetContextSync.cpp \
nsJSRenderingContext.cpp \
# Alphabetical list of source files
CPPSRCS = \
nsBlender.cpp \
nsColor.cpp \
nsColorNames.cpp \
nsDeviceContext.cpp \
nsFont.cpp \
nsImageGroup.cpp \
nsImageManager.cpp \
nsImageNetContextAsync.cpp \
nsImageNetContextSync.cpp \
nsImageRenderer.cpp \
nsImageRequest.cpp \
nsImageSystemServices.cpp \
nsImageURL.cpp \
nsRect.cpp \
nsTransform2D.cpp \
$(NULL)
EXTRA_DSO_LDOPTS =\
-L$(DIST)/lib \
-limg_s \
-lneckoutil_s \
-lmozutil_s \
$(NULL)
EXTRA_DSO_LDOPTS = \
-L$(DIST)/lib \
-limg_s \
-lneckoutil_s \
-lmozutil_s \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -17,7 +17,6 @@
*/
#include "nsRenderingContextBeOS.h"
#include "nsIScriptGlobalObject.h"
#include "nsRegionBeOS.h"
#include "nsGfxCIID.h"
#include <math.h>

Просмотреть файл

@ -33,8 +33,6 @@
#include "nsImageBeOS.h"
#include "nsIDeviceContext.h"
#include "nsVoidArray.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMRenderingContext.h"
#include "nsDrawingSurfaceBeOS.h"
#include "nsRegionBeOS.h"

Просмотреть файл

@ -45,7 +45,6 @@ CPP_OBJS=.\$(OBJDIR)\nsColor.obj .\$(OBJDIR)\nsColorNames.obj \
.\$(OBJDIR)\nsTransform2D.obj \
.\$(OBJDIR)\nsDeviceContext.obj \
.\$(OBJDIR)\nsImageNetContextSync.obj \
.\$(OBJDIR)\nsJSRenderingContext.obj \
.\$(OBJDIR)\nsBlender.obj
LINCS=-I$(PUBLIC)\util -I$(PUBLIC)\img \

Просмотреть файл

@ -1,417 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nscore.h"
#include "nsIScriptContext.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsIPtr.h"
#include "nsString.h"
#include "nsIDOMRenderingContext.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIRenderingContextIID, NS_IDOMRENDERINGCONTEXT_IID);
NS_DEF_PTR(nsIDOMRenderingContext);
//
// RenderingContext property ids
//
enum RenderingContext_slots {
RENDERINGCONTEXT_COLOR = -1
};
/***********************************************************************/
//
// RenderingContext Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetRenderingContextProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMRenderingContext *a = (nsIDOMRenderingContext*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case RENDERINGCONTEXT_COLOR:
{
nsAutoString prop;
if (NS_OK == a->GetColor(prop)) {
JSString *jsstring = JS_NewUCStringCopyN(cx, prop.GetUnicode(), prop.Length());
// set the return value
*vp = STRING_TO_JSVAL(jsstring);
}
else {
return JS_FALSE;
}
break;
}
default:
{
nsIJSScriptObject *object;
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
PRBool rval;
rval = object->GetProperty(cx, id, vp);
NS_RELEASE(object);
return rval;
}
}
}
}
else {
nsIJSScriptObject *object;
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
PRBool rval;
rval = object->GetProperty(cx, id, vp);
NS_RELEASE(object);
return rval;
}
}
return PR_TRUE;
}
/***********************************************************************/
//
// RenderingContext Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetRenderingContextProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMRenderingContext *a = (nsIDOMRenderingContext*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case RENDERINGCONTEXT_COLOR:
{
nsAutoString prop;
JSString *jsstring;
if ((jsstring = JS_ValueToString(cx, *vp)) != nsnull) {
prop.SetString(JS_GetStringChars(jsstring));
}
else {
prop.SetString((const char *)nsnull);
}
a->SetColor(prop);
break;
}
default:
{
nsIJSScriptObject *object;
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
PRBool rval;
rval = object->SetProperty(cx, id, vp);
NS_RELEASE(object);
return rval;
}
}
}
}
else {
nsIJSScriptObject *object;
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
PRBool rval;
rval = object->SetProperty(cx, id, vp);
NS_RELEASE(object);
return rval;
}
}
return PR_TRUE;
}
//
// RenderingContext finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeRenderingContext(JSContext *cx, JSObject *obj)
{
nsIDOMRenderingContext *a = (nsIDOMRenderingContext*)JS_GetPrivate(cx, obj);
if (nsnull != a) {
// get the js object
nsIScriptObjectOwner *owner = nsnull;
if (NS_OK == a->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
owner->SetScriptObject(nsnull);
NS_RELEASE(owner);
}
NS_RELEASE(a);
}
}
//
// RenderingContext enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateRenderingContext(JSContext *cx, JSObject *obj)
{
nsIDOMRenderingContext *a = (nsIDOMRenderingContext*)JS_GetPrivate(cx, obj);
if (nsnull != a) {
// get the js object
nsIJSScriptObject *object;
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
object->EnumerateProperty(cx);
NS_RELEASE(object);
}
}
return JS_TRUE;
}
//
// RenderingContext resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveRenderingContext(JSContext *cx, JSObject *obj, jsval id)
{
nsIDOMRenderingContext *a = (nsIDOMRenderingContext*)JS_GetPrivate(cx, obj);
if (nsnull != a) {
// get the js object
nsIJSScriptObject *object;
if (NS_OK == a->QueryInterface(kIJSScriptObjectIID, (void**)&object)) {
object->Resolve(cx, id);
NS_RELEASE(object);
}
}
return JS_TRUE;
}
//
// Native method DrawLine2
//
PR_STATIC_CALLBACK(JSBool)
RenderingContextDrawLine2(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMRenderingContext *nativeThis = (nsIDOMRenderingContext*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
PRInt32 b0;
PRInt32 b1;
PRInt32 b2;
PRInt32 b3;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 4) {
if (!JS_ValueToInt32(cx, argv[0], (int32 *)&b0)) {
JS_ReportError(cx, "Parameter must be a number");
return JS_FALSE;
}
if (!JS_ValueToInt32(cx, argv[1], (int32 *)&b1)) {
JS_ReportError(cx, "Parameter must be a number");
return JS_FALSE;
}
if (!JS_ValueToInt32(cx, argv[2], (int32 *)&b2)) {
JS_ReportError(cx, "Parameter must be a number");
return JS_FALSE;
}
if (!JS_ValueToInt32(cx, argv[3], (int32 *)&b3)) {
JS_ReportError(cx, "Parameter must be a number");
return JS_FALSE;
}
if (NS_OK != nativeThis->DrawLine2(b0, b1, b2, b3)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function drawLine2 requires 4 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
/***********************************************************************/
//
// class for RenderingContext
//
JSClass RenderingContextClass = {
"RenderingContext",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
GetRenderingContextProperty,
SetRenderingContextProperty,
EnumerateRenderingContext,
ResolveRenderingContext,
JS_ConvertStub,
FinalizeRenderingContext
};
//
// RenderingContext class properties
//
static JSPropertySpec RenderingContextProperties[] =
{
{"color", RENDERINGCONTEXT_COLOR, JSPROP_ENUMERATE},
{0}
};
//
// RenderingContext class methods
//
static JSFunctionSpec RenderingContextMethods[] =
{
{"drawLine2", RenderingContextDrawLine2, 4},
{0}
};
//
// RenderingContext constructor
//
PR_STATIC_CALLBACK(JSBool)
RenderingContext(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// RenderingContext class initialization
//
nsresult NS_InitRenderingContextClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "RenderingContext", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&RenderingContextClass, // JSClass
RenderingContext, // JSNative ctor
0, // ctor args
RenderingContextProperties, // proto props
RenderingContextMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new RenderingContext JavaScript object
//
extern "C" NS_GFX nsresult NS_NewScriptRenderingContext(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptRenderingContext");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMRenderingContext *aRenderingContext;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitRenderingContextClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIRenderingContextIID, (void **)&aRenderingContext);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &RenderingContextClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aRenderingContext);
}
else {
NS_RELEASE(aRenderingContext);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

Просмотреть файл

@ -39,8 +39,6 @@
#include "libimg.h"
#include "prprf.h"
#include "nsIScriptGlobalObject.h"
// helper clip region functions - defined at the bottom of this file.
LONG GpiCombineClipRegion( HPS hps, HRGN hrgnCombine, LONG lOp);
HRGN GpiCopyClipRegion( HPS hps);
@ -172,7 +170,6 @@ class GraphicsStateCache
} GStateCache; // XXX make this less static, I suppose
// Rendering context -------------------------------------------------------
static NS_DEFINE_IID(kIDOMRenderingContextIID, NS_IDOMRENDERINGCONTEXT_IID);
NS_IMPL_ADDREF(nsRenderingContextOS2)
NS_IMPL_RELEASE(nsRenderingContextOS2)
@ -185,10 +182,6 @@ nsRenderingContextOS2::QueryInterface( REFNSIID aIID, void **aInstancePtr)
if( aIID.Equals( nsIRenderingContext::GetIID()))
*aInstancePtr = (void *) (nsIRenderingContext*) this;
else if( aIID.Equals( nsIScriptObjectOwner::GetIID()))
*aInstancePtr = (void *) (nsIScriptObjectOwner*) this;
else if( aIID.Equals( kIDOMRenderingContextIID))
*aInstancePtr = (void *) (nsIDOMRenderingContext*) this;
else if( aIID.Equals( ((nsISupports*)(nsIRenderingContext*)this)->GetIID()))
*aInstancePtr = (void *) (nsISupports*)(nsIRenderingContext*)this;
@ -210,7 +203,6 @@ nsRenderingContextOS2::nsRenderingContextOS2()
mPalette = nsnull;
mSurface = nsnull;
mFrontSurface = nsnull;
mScriptObject = nsnull;
mColor = NS_RGB( 0, 0, 0);
mP2T = 1.0f;
mStateStack = nsnull;
@ -787,54 +779,6 @@ nsresult nsRenderingContextOS2::GetCurrentTransform( nsTransform2D *&aTransform)
return NS_OK;
}
// this is voodoo...
NS_IMETHODIMP
nsRenderingContextOS2::GetScriptObject( nsIScriptContext* aContext,
void** aScriptObject)
{
nsresult res = NS_OK;
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
if( !mScriptObject)
{
res = NS_NewScriptRenderingContext( aContext,
(nsISupports *)(nsIRenderingContext*)this,
global, (void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
NS_RELEASE(global);
return res;
}
NS_IMETHODIMP
nsRenderingContextOS2::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
// More daft nsIDOMRenderingContext methods
NS_IMETHODIMP nsRenderingContextOS2::GetColor( nsString &aColor)
{
char cbuf[40];
PR_snprintf( cbuf, sizeof(cbuf), "#%02x%02x%02x",
NS_GET_R(mColor),
NS_GET_G(mColor),
NS_GET_B(mColor));
aColor = cbuf;
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextOS2::SetColor(const nsString& aColor)
{
nscolor rgb;
if( NS_ColorNameToRGB(aColor, &rgb))
SetColor(rgb);
else if( NS_HexToRGB(aColor, &rgb))
SetColor(rgb);
return NS_OK;
}
// Drawing methods ---------------------------------------------------------
@ -901,14 +845,6 @@ nsresult nsRenderingContextOS2::DrawLine( nscoord aX0, nscoord aY0, nscoord aX1,
return NS_OK;
}
// Stupid DOM method
nsresult nsRenderingContextOS2::DrawLine2( PRInt32 aX0, PRInt32 aY0,
PRInt32 aX1, PRInt32 aY1)
{
DrawLine(aX0, aY0, aX1, aY1);
return NS_OK;
}
nsresult nsRenderingContextOS2::DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
{
PMDrawPoly( aPoints, aNumPoints, PR_FALSE);

Просмотреть файл

@ -23,8 +23,6 @@
#define _nsRenderingContextOS2_h
#include "nsIRenderingContext.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMRenderingContext.h"
#include "nsTransform2D.h"
#include "nscoord.h"
#include "nscolor.h"
@ -43,9 +41,7 @@ struct GraphicsState;
#include "nsDrawingSurfaceOS2.h"
class nsRenderingContextOS2 : public nsIRenderingContext,
public nsIDOMRenderingContext,
public nsIScriptObjectOwner
class nsRenderingContextOS2 : public nsIRenderingContext
{
public:
nsRenderingContextOS2();
@ -168,13 +164,6 @@ class nsRenderingContextOS2 : public nsIRenderingContext,
NS_IMETHOD GetHints( PRUint32 &aResult);
// nsIScriptObjectOwner
NS_IMETHOD GetScriptObject( nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD SetScriptObject( void* aScriptObject);
// nsIDOMRenderingContext
NS_DECL_IDOMRENDERINGCONTEXT
// Convert XP-rects to OS/2 space.
// World coordinates given & required, double inclusive rcl wanted.
void NS2PM_ININ( const nsRect &in, RECTL &rcl);
@ -217,7 +206,6 @@ class nsRenderingContextOS2 : public nsIRenderingContext,
nscolor mCurrDrawingColor;// currently selected drawing color
nscolor mCurrTextColor; // currently selected text color
nsLineStyle mCurrLineStyle; // currently selected line style
void *mScriptObject; // crazy script object thing.
};
inline void nsRenderingContextOS2::GetTargetHeight( PRUint32 &ht)

Просмотреть файл

@ -21,7 +21,6 @@
#include <math.h>
#include "libimg.h"
#include "nsDeviceContextPh.h"
#include "nsIScriptGlobalObject.h"
#include "prprf.h"
#include "nsDrawingSurfacePh.h"
#include "nsGfxCIID.h"
@ -43,10 +42,8 @@
#define VERIFY(exp) (exp)
#endif // !_DEBUG
static NS_DEFINE_IID(kIDOMRenderingContextIID, NS_IDOMRENDERINGCONTEXT_IID);
static NS_DEFINE_IID(kIRenderingContextIID, NS_IRENDERING_CONTEXT_IID);
static NS_DEFINE_IID(kIRenderingContextPhIID, NS_IRENDERING_CONTEXT_PH_IID);
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIDrawingSurfaceIID, NS_IDRAWING_SURFACE_IID);
static NS_DEFINE_IID(kDrawingSurfaceCID, NS_DRAWING_SURFACE_CID);
@ -150,7 +147,6 @@ nsRenderingContextPh :: nsRenderingContextPh()
mStates = nsnull;
mStateCache = new nsVoidArray();
mGammaTable = nsnull;
mScriptObject = nsnull;
if( mPtGC == nsnull )
mPtGC = PgGetGC();
@ -256,22 +252,6 @@ nsresult nsRenderingContextPh :: QueryInterface(REFNSIID aIID, void** aInstanceP
return NS_OK;
}
if (aIID.Equals(kIScriptObjectOwnerIID))
{
nsIScriptObjectOwner* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIDOMRenderingContextIID))
{
nsIDOMRenderingContext* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kISupportsIID))
@ -1667,41 +1647,6 @@ printf ("unimp pushclipstate\n");
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::PushClipState - Not implemented.\n"));
}
NS_IMETHODIMP nsRenderingContextPh::GetScriptObject(nsIScriptContext* aContext,
void** aScriptObject)
{
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::GetScriptObject - Not implemented.\n"));
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPh::SetScriptObject(void* aScriptObject)
{
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::SetScriptObject - Not implemented.\n"));
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPh::GetColor(nsString& aColor)
{
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::GetColor - Not implemented.\n"));
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPh::SetColor(const nsString& aColor)
{
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::SetColor - Not implemented.\n"));
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPh::DrawLine2(PRInt32 aX0, PRInt32 aY0,
PRInt32 aX1, PRInt32 aY1)
{
PR_LOG(PhGfxLog, PR_LOG_DEBUG, ("nsRenderingContextPh::DrawLine2.\n"));
DrawLine( (nscoord)aX0, (nscoord)aY0, (nscoord)aX1, (nscoord)aY1 );
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextPh :: CreateDrawingSurface( PhGC_t *aGC, nsDrawingSurface &aSurface)
{
printf ("unimp createdrawingsurface\n");

Просмотреть файл

@ -33,8 +33,6 @@
//#include "nsImagePh.h"
#include "nsIDeviceContext.h"
#include "nsVoidArray.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMRenderingContext.h"
#include "nsIRenderingContextPh.h"
#include "nsDrawingSurfacePh.h"
@ -46,9 +44,7 @@ class nsImagePh;
class nsRegionPh;
class nsRenderingContextPh : public nsIRenderingContext,
nsIRenderingContextPh,
nsIDOMRenderingContext,
nsIScriptObjectOwner
nsIRenderingContextPh
{
public:
nsRenderingContextPh();
@ -161,13 +157,6 @@ public:
const nsRect &aDestBounds, PRUint32 aCopyFlags);
NS_IMETHOD RetrieveCurrentNativeGraphicData(PRUint32 * ngd);
// nsIScriptObjectOwner
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD SetScriptObject(void* aScriptObject);
// nsIDOMRenderingContext
NS_DECL_IDOMRENDERINGCONTEXT
// nsIRenderingContextPh
NS_IMETHOD CreateDrawingSurface(PhGC_t *aGC, nsDrawingSurface &aSurface);
@ -212,8 +201,6 @@ protected:
#ifdef NS_DEBUG
PRBool mInitialized;
#endif
void* mScriptObject;
};
#endif /* nsRenderingContextPh_h___ */

Просмотреть файл

@ -21,7 +21,6 @@
#include <math.h>
#include "libimg.h"
#include "nsDeviceContextPS.h"
#include "nsIScriptGlobalObject.h"
#include "nsPostScriptObj.h"
#include "nsIRegion.h"

Просмотреть файл

@ -22,7 +22,6 @@
#include <math.h>
#include "libimg.h"
#include "nsDeviceContextWin.h"
#include "nsIScriptGlobalObject.h"
#include "prprf.h"
#include "nsDrawingSurfaceWin.h"
#include "nsGfxCIID.h"
@ -41,10 +40,8 @@
#define VERIFY(exp) (exp)
#endif // !_DEBUG
static NS_DEFINE_IID(kIDOMRenderingContextIID, NS_IDOMRENDERINGCONTEXT_IID);
static NS_DEFINE_IID(kIRenderingContextIID, NS_IRENDERING_CONTEXT_IID);
static NS_DEFINE_IID(kIRenderingContextWinIID, NS_IRENDERING_CONTEXT_WIN_IID);
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIDrawingSurfaceIID, NS_IDRAWING_SURFACE_IID);
static NS_DEFINE_IID(kDrawingSurfaceCID, NS_DRAWING_SURFACE_CID);
@ -339,22 +336,6 @@ nsRenderingContextWin :: QueryInterface(REFNSIID aIID, void** aInstancePtr)
return NS_OK;
}
if (aIID.Equals(kIScriptObjectOwnerIID))
{
nsIScriptObjectOwner* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIDOMRenderingContextIID))
{
nsIDOMRenderingContext* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kISupportsIID))
@ -1979,63 +1960,6 @@ void nsRenderingContextWin :: PushClipState(void)
}
}
NS_IMETHODIMP
nsRenderingContextWin::GetScriptObject(nsIScriptContext* aContext,
void** aScriptObject)
{
nsresult res = NS_OK;
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
if (nsnull == mScriptObject) {
res = NS_NewScriptRenderingContext(aContext,
(nsISupports *)(nsIRenderingContext*)this,
global, (void**)&mScriptObject);
}
*aScriptObject = mScriptObject;
NS_RELEASE(global);
return res;
}
NS_IMETHODIMP
nsRenderingContextWin::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextWin::GetColor(nsString& aColor)
{
char cbuf[40];
PR_snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x",
NS_GET_R(mCurrentColor),
NS_GET_G(mCurrentColor),
NS_GET_B(mCurrentColor));
aColor = cbuf;
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextWin::SetColor(const nsString& aColor)
{
nscolor rgb;
if (NS_ColorNameToRGB(aColor, &rgb)) {
SetColor(rgb);
}
else if (NS_HexToRGB(aColor, &rgb)) {
SetColor(rgb);
}
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextWin::DrawLine2(PRInt32 aX0, PRInt32 aY0,
PRInt32 aX1, PRInt32 aY1)
{
DrawLine(aX0, aY0, aX1, aY1);
return NS_OK;
}
NS_IMETHODIMP nsRenderingContextWin :: CreateDrawingSurface(HDC aDC, nsDrawingSurface &aSurface)
{
nsDrawingSurfaceWin *surf = new nsDrawingSurfaceWin();

Просмотреть файл

@ -33,8 +33,6 @@
#include "nsImageWin.h"
#include "nsIDeviceContext.h"
#include "nsVoidArray.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMRenderingContext.h"
#include "nsIRenderingContextWin.h"
#include "nsDrawingSurfaceWin.h"
@ -42,9 +40,7 @@ class GraphicsState;
class nsDrawingSurfaceWin;
class nsRenderingContextWin : public nsIRenderingContext,
nsIRenderingContextWin,
nsIDOMRenderingContext,
nsIScriptObjectOwner
nsIRenderingContextWin
{
public:
nsRenderingContextWin();
@ -158,13 +154,6 @@ public:
//~~~
NS_IMETHOD RetrieveCurrentNativeGraphicData(PRUint32 * ngd);
// nsIScriptObjectOwner
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD SetScriptObject(void* aScriptObject);
// nsIDOMRenderingContext
NS_DECL_IDOMRENDERINGCONTEXT
// nsIRenderingContextWin
NS_IMETHOD CreateDrawingSurface(HDC aDC, nsDrawingSurface &aSurface);
@ -225,8 +214,6 @@ protected:
#ifdef NS_DEBUG
PRBool mInitialized;
#endif
void* mScriptObject;
};

Просмотреть файл

@ -23,9 +23,7 @@
#include "prprf.h"
#include "prmem.h"
static NS_DEFINE_IID(kIDOMRenderingContextIID, NS_IDOMRENDERINGCONTEXT_IID);
static NS_DEFINE_IID(kIRenderingContextIID, NS_IRENDERING_CONTEXT_IID);
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static PRLogModuleInfo * RenderingContextXlibLM = PR_NewLogModule("RenderingContextXlib");
@ -67,7 +65,6 @@ nsRenderingContextXlib::nsRenderingContextXlib()
mFontMetrics = nsnull;
mTMatrix = nsnull;
mP2T = 1.0f;
mScriptObject = nsnull;
mStateCache = new nsVoidArray();
mCurrentFont = nsnull;
mCurrentLineStyle = nsLineStyle_kSolid;
@ -116,20 +113,6 @@ nsRenderingContextXlib::QueryInterface(const nsIID& aIID, void** aInstancePtr)
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIScriptObjectOwnerIID))
{
nsIScriptObjectOwner* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIDOMRenderingContextIID))
{
nsIDOMRenderingContext* tmp = this;
*aInstancePtr = (void*) tmp;
NS_ADDREF_THIS();
return NS_OK;
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
if (aIID.Equals(kISupportsIID))
@ -550,18 +533,6 @@ nsRenderingContextXlib::SetColor(nscolor aColor)
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextXlib::SetColor(const nsString &aColor)
{
nscolor rgb;
if (NS_ColorNameToRGB(aColor, &rgb)) {
SetColor(rgb);
}
else if (NS_HexToRGB(aColor, &rgb)) {
SetColor(rgb);
}
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextXlib::GetColor(nscolor &aColor) const
@ -571,18 +542,6 @@ nsRenderingContextXlib::GetColor(nscolor &aColor) const
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextXlib::GetColor(nsString &aColor)
{
char cbuf[40];
PR_snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x",
NS_GET_R(mCurrentColor),
NS_GET_G(mCurrentColor),
NS_GET_B(mCurrentColor));
aColor = cbuf;
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextXlib::SetFont(const nsFont& aFont)
{
@ -700,14 +659,6 @@ nsRenderingContextXlib::DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord
}
NS_IMETHODIMP
nsRenderingContextXlib::DrawLine2(PRInt32 aX0, PRInt32 aY0,
PRInt32 aX1, PRInt32 aY1)
{
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::DrawLine2()\n"));
return DrawLine(aX0, aY0, aX1, aY1);
}
NS_IMETHODIMP
nsRenderingContextXlib::DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
@ -1452,18 +1403,3 @@ NS_IMETHODIMP nsRenderingContextXlib::RetrieveCurrentNativeGraphicData(PRUint32
{
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextXlib::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
{
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::GetScriptObject()\n"));
return NS_OK;
}
NS_IMETHODIMP
nsRenderingContextXlib::SetScriptObject(void* aScriptObject)
{
PR_LOG(RenderingContextXlibLM, PR_LOG_DEBUG, ("nsRenderingContextXlib::SetScriptObject()\n"));
return NS_OK;
}

Просмотреть файл

@ -33,16 +33,12 @@
#include "nsImageXlib.h"
#include "nsIDeviceContext.h"
#include "nsVoidArray.h"
#include "nsIScriptObjectOwner.h"
#include "nsIDOMRenderingContext.h"
#include "nsDrawingSurfaceXlib.h"
#include "nsRegionXlib.h"
class GraphicsState;
class nsRenderingContextXlib : public nsIRenderingContext,
nsIDOMRenderingContext,
nsIScriptObjectOwner
class nsRenderingContextXlib : public nsIRenderingContext
{
public:
nsRenderingContextXlib();
@ -156,14 +152,6 @@ class nsRenderingContextXlib : public nsIRenderingContext,
const nsRect &aDestBounds, PRUint32 aCopyFlags);
NS_IMETHOD RetrieveCurrentNativeGraphicData(PRUint32 * ngd);
// nsIScriptObjectOwner
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
NS_IMETHOD SetScriptObject(void* aScriptObject);
// nsIDOMRenderingContext
// XXX uncomment this...
NS_DECL_IDOMRENDERINGCONTEXT
// this is a common init function for both of the init functions.
nsresult CommonInit(void);
@ -175,7 +163,6 @@ private:
nsRegionXlib *mClipRegion;
nsTransform2D *mTMatrix;
float mP2T;
void *mScriptObject;
nscolor mCurrentColor;
Display * mDisplay;
Screen * mScreen;