зеркало из https://github.com/mozilla/gecko-dev.git
r=pocemit, sr=darin Checkin for Roland.Mainz@informatik.med.uni-giessen.de - rename of class
This commit is contained in:
Родитель
17ee52513f
Коммит
958b057933
|
@ -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
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef nsGCCache_h___
|
||||
#define nsGCCache_h___
|
||||
#ifndef nsGCCacheXlib_h___
|
||||
#define nsGCCacheXlib_h___
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
@ -35,9 +35,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "nsVoidArray.h"
|
||||
#include "nsRegionXlib.h"
|
||||
|
||||
#include "nsImageXlib.h" // nsGCCache.h wants this
|
||||
#include "nsGCCache.h"
|
||||
|
||||
class nsXPrintContext;
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "nsString.h"
|
||||
#include "nsIImage.h"
|
||||
|
||||
#include "nsImageXlib.h" // nsGCCache.h wants this
|
||||
#include "nsGCCache.h"
|
||||
|
||||
#include "nsIDeviceContextSpecXPrint.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче