From 958b05793342d6fa82cf6a9c63b0ea0529c8dfc1 Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Tue, 26 Jun 2001 00:11:17 +0000 Subject: [PATCH] #87468 r=pocemit, sr=darin Checkin for Roland.Mainz@informatik.med.uni-giessen.de - rename of class --- gfx/src/xlib/nsGCCache.cpp | 34 ++++++++++++------------- gfx/src/xlib/nsGCCache.h | 27 ++++++++------------ gfx/src/xlib/nsRenderingContextXlib.cpp | 4 +-- gfx/src/xprint/nsRenderingContextXP.cpp | 4 +-- gfx/src/xprint/nsRenderingContextXP.h | 1 - gfx/src/xprint/nsXPrintContext.h | 1 - 6 files changed, 31 insertions(+), 40 deletions(-) diff --git a/gfx/src/xlib/nsGCCache.cpp b/gfx/src/xlib/nsGCCache.cpp index 933fecbacff0..38d7872cedff 100644 --- a/gfx/src/xlib/nsGCCache.cpp +++ b/gfx/src/xlib/nsGCCache.cpp @@ -32,14 +32,14 @@ /* The GC cache is shared among all windows, since it doesn't hog any scarce resources (like colormap entries.) */ -Region nsGCCache::copyRegion = 0; +Region nsGCCacheXlib::copyRegion = 0; -nsGCCache::nsGCCache() +nsGCCacheXlib::nsGCCacheXlib() { PR_INIT_CLIST(&GCCache); PR_INIT_CLIST(&GCFreeList); for (int i = 0; i < GC_CACHE_SIZE; i++) { - GCCacheEntry *entry = new GCCacheEntry(); + GCCacheEntryXlib *entry = new GCCacheEntryXlib(); entry->gc=NULL; PR_INSERT_LINK(&entry->clist, &GCFreeList); } @@ -47,7 +47,7 @@ nsGCCache::nsGCCache() } void -nsGCCache::move_cache_entry(PRCList *clist) +nsGCCacheXlib::move_cache_entry(PRCList *clist) { /* thread on the freelist, at the front */ PR_REMOVE_LINK(clist); @@ -55,9 +55,9 @@ nsGCCache::move_cache_entry(PRCList *clist) } void -nsGCCache::free_cache_entry(PRCList *clist) +nsGCCacheXlib::free_cache_entry(PRCList *clist) { - GCCacheEntry *entry = (GCCacheEntry *)clist; + GCCacheEntryXlib *entry = (GCCacheEntryXlib *)clist; entry->gc->Release(); if (entry->clipRegion) ::XDestroyRegion(entry->clipRegion); @@ -68,7 +68,7 @@ nsGCCache::free_cache_entry(PRCList *clist) PR_INSERT_LINK(clist, &GCFreeList); } -nsGCCache::~nsGCCache() +nsGCCacheXlib::~nsGCCacheXlib() { PRCList *head; @@ -86,12 +86,12 @@ nsGCCache::~nsGCCache() if (head == &GCFreeList) break; PR_REMOVE_LINK(head); - delete (GCCacheEntry *)head; + delete (GCCacheEntryXlib *)head; } } void -nsGCCache::ReportStats() { +nsGCCacheXlib::ReportStats() { DEBUG_METER( fprintf(stderr, "GC Cache:\n\thits:"); int hits = 0; @@ -109,35 +109,35 @@ nsGCCache::ReportStats() { void -nsGCCache::XCopyRegion(Region srca, Region dr_return) +nsGCCacheXlib::XCopyRegion(Region srca, Region dr_return) { if (!copyRegion) copyRegion = ::XCreateRegion(); ::XUnionRegion(srca, copyRegion, dr_return); } /* Dispose of entries matching the given flags, compressing the GC cache */ -void nsGCCache::Flush(unsigned long flags) +void nsGCCacheXlib::Flush(unsigned long flags) { while (!PR_CLIST_IS_EMPTY(&GCCache)) { PRCList *head = PR_LIST_HEAD(&GCCache); if (head == &GCCache) break; - GCCacheEntry *entry = (GCCacheEntry *)head; + GCCacheEntryXlib *entry = (GCCacheEntryXlib *)head; if (entry->flags & flags) free_cache_entry(head); } } -xGC *nsGCCache::GetGC(Display *display, Drawable drawable, unsigned long flags, XGCValues *gcv, Region clipRegion) +xGC *nsGCCacheXlib::GetGC(Display *display, Drawable drawable, unsigned long flags, XGCValues *gcv, Region clipRegion) { PRCList *iter; - GCCacheEntry *entry; + GCCacheEntryXlib *entry; DEBUG_METER(int i = 0;) for (iter = PR_LIST_HEAD(&GCCache); iter != &GCCache; iter = PR_NEXT_LINK(iter)) { - entry = (GCCacheEntry *)iter; + entry = (GCCacheEntryXlib *)iter; if (flags == entry->flags && !memcmp (gcv, &entry->gcv, sizeof (*gcv))) { /* if there's a clipRegion, we have to match */ @@ -172,7 +172,7 @@ xGC *nsGCCache::GetGC(Display *display, Drawable drawable, unsigned long flags, iter = PR_LIST_HEAD(&GCFreeList); PR_REMOVE_LINK(iter); PR_INSERT_LINK(iter, &GCCache); - entry = (GCCacheEntry *)iter; + entry = (GCCacheEntryXlib *)iter; if (!entry->gc) { // No old GC, greate new @@ -209,7 +209,7 @@ xGC *nsGCCache::GetGC(Display *display, Drawable drawable, unsigned long flags, return entry->gc; } -void nsGCCache::ReuseGC(GCCacheEntry *entry, unsigned long flags, XGCValues *gcv) +void nsGCCacheXlib::ReuseGC(GCCacheEntryXlib *entry, unsigned long flags, XGCValues *gcv) { // We have old GC, reuse it and check what // we have to change diff --git a/gfx/src/xlib/nsGCCache.h b/gfx/src/xlib/nsGCCache.h index 9dcee08c2e83..32999d808f8e 100644 --- a/gfx/src/xlib/nsGCCache.h +++ b/gfx/src/xlib/nsGCCache.h @@ -23,8 +23,8 @@ */ -#ifndef nsGCCache_h___ -#define nsGCCache_h___ +#ifndef nsGCCacheXlib_h___ +#define nsGCCacheXlib_h___ #include #include @@ -35,9 +35,7 @@ #include #define countof(x) ((int)(sizeof(x) / sizeof (*x))) -#define GC_CACHE_SIZE 10 - -#define DEBUG 1 +#define GC_CACHE_SIZE 16 #ifdef DEBUG #define DEBUG_METER(x) x @@ -45,15 +43,10 @@ #define DEBUG_METER(x) #endif -#ifdef _IMPL_NS_XPRINT -#define nsGCCache nsGCCacheXlib -#define GCCacheEntry GCCacheEntryXlib -#endif - -class nsGCCache; +class nsGCCacheXlib; class xGC { - friend class nsGCCache; + friend class nsGCCacheXlib; public: xGC(Display *display, Drawable d, unsigned long valuemask, XGCValues *values) @@ -94,7 +87,7 @@ private: }; -struct GCCacheEntry +struct GCCacheEntryXlib { PRCList clist; unsigned long flags; @@ -103,18 +96,18 @@ struct GCCacheEntry xGC *gc; }; -class nsGCCache +class nsGCCacheXlib { public: - nsGCCache(); - virtual ~nsGCCache(); + nsGCCacheXlib(); + virtual ~nsGCCacheXlib(); void Flush(unsigned long flags); xGC *GetGC(Display *display, Window window, unsigned long flags, XGCValues *gcv, Region clipRegion); private: - void ReuseGC(GCCacheEntry *entry, unsigned long flags, XGCValues *gcv); + void ReuseGC(GCCacheEntryXlib *entry, unsigned long flags, XGCValues *gcv); PRCList GCCache; PRCList GCFreeList; void free_cache_entry(PRCList *clist); diff --git a/gfx/src/xlib/nsRenderingContextXlib.cpp b/gfx/src/xlib/nsRenderingContextXlib.cpp index 1f80088499b9..0d790456b8b4 100644 --- a/gfx/src/xlib/nsRenderingContextXlib.cpp +++ b/gfx/src/xlib/nsRenderingContextXlib.cpp @@ -37,7 +37,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsRenderingContextXlib, nsIRenderingContext) static PRLogModuleInfo * RenderingContextXlibLM = PR_NewLogModule("RenderingContextXlib"); -static nsGCCache *gcCache = nsnull; +static nsGCCacheXlib *gcCache = nsnull; class GraphicsState { @@ -401,7 +401,7 @@ void nsRenderingContextXlib::UpdateGC() } if (!gcCache) { - gcCache = new nsGCCache(); + gcCache = new nsGCCacheXlib(); if (!gcCache) return; } diff --git a/gfx/src/xprint/nsRenderingContextXP.cpp b/gfx/src/xprint/nsRenderingContextXP.cpp index 959c9022c1e1..0066e02e73fd 100644 --- a/gfx/src/xprint/nsRenderingContextXP.cpp +++ b/gfx/src/xprint/nsRenderingContextXP.cpp @@ -40,7 +40,7 @@ static NS_DEFINE_IID(kIRenderingContextIID, NS_IRENDERING_CONTEXT_IID); static PRLogModuleInfo *RenderingContextXpLM = PR_NewLogModule("nsRenderingContextXp"); #endif /* PR_LOGGING */ -static nsGCCache *gcCache = nsnull; +static nsGCCacheXlib *gcCache = nsnull; class GraphicsState { @@ -417,7 +417,7 @@ void nsRenderingContextXp::UpdateGC() } if (!gcCache) { - gcCache = new nsGCCache(); + gcCache = new nsGCCacheXlib(); if (!gcCache) return; } diff --git a/gfx/src/xprint/nsRenderingContextXP.h b/gfx/src/xprint/nsRenderingContextXP.h index cef99c1afc48..f5e5dcb87b48 100644 --- a/gfx/src/xprint/nsRenderingContextXP.h +++ b/gfx/src/xprint/nsRenderingContextXP.h @@ -38,7 +38,6 @@ #include "nsVoidArray.h" #include "nsRegionXlib.h" -#include "nsImageXlib.h" // nsGCCache.h wants this #include "nsGCCache.h" class nsXPrintContext; diff --git a/gfx/src/xprint/nsXPrintContext.h b/gfx/src/xprint/nsXPrintContext.h index 99596bb762a0..0303dfb0f2b2 100644 --- a/gfx/src/xprint/nsXPrintContext.h +++ b/gfx/src/xprint/nsXPrintContext.h @@ -35,7 +35,6 @@ #include "nsString.h" #include "nsIImage.h" -#include "nsImageXlib.h" // nsGCCache.h wants this #include "nsGCCache.h" #include "nsIDeviceContextSpecXPrint.h"