Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Types | Private Attributes
nsCairoSurfaceManager Class Reference

#include <nsCairoSurfaceManager.h>

Collaboration diagram for nsCairoSurfaceManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsCairoSurfaceManager ()
 ~nsCairoSurfaceManager ()
NS_IMETHOD GetDrawingSurfaceForWidget (nsCairoDeviceContext *aDC, nsIWidget *aWidget, nsIDrawingSurface **aSurface)
NS_IMETHOD GetDrawingSurfaceForNativeWidget (nsCairoDeviceContext *aDC, nsNativeWidget aWidget, nsIDrawingSurface **aSurface)
NS_IMETHOD ReleaseSurface (nsIDrawingSurface *aSurface)
NS_IMETHOD FlushCachedSurfaces ()

Private Types

typedef std::map
< nsNativeWidget,
nsCairoDrawingSurface * > 
WidgetToSurfaceMap

Private Attributes

WidgetToSurfaceMap mSurfaceMap

Detailed Description

Definition at line 55 of file nsCairoSurfaceManager.h.


Member Typedef Documentation

Definition at line 70 of file nsCairoSurfaceManager.h.


Constructor & Destructor Documentation

Definition at line 45 of file nsCairoSurfaceManager.cpp.

{
}

Definition at line 49 of file nsCairoSurfaceManager.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 55 of file nsCairoSurfaceManager.cpp.

{
    for (WidgetToSurfaceMap::iterator iter = mSurfaceMap.begin();
         iter != mSurfaceMap.end();
         iter++)
    {
        nsCairoDrawingSurface *surf = (iter->second);
        NS_RELEASE(surf);
    }

    mSurfaceMap.clear();

    return NS_OK;
}

Here is the caller graph for this function:

Definition at line 81 of file nsCairoSurfaceManager.cpp.

{
    nsCairoDrawingSurface *surf = nsnull;
    WidgetToSurfaceMap::iterator iter = mSurfaceMap.find(aWidget);

    /* cached? */
    if (PR_TRUE || iter == mSurfaceMap.end()) {
        /* nope. */
        surf = new nsCairoDrawingSurface();
        NS_ADDREF(surf);         // our own reference for map
        surf->Init (aDC, aWidget);

        mSurfaceMap.insert(WidgetToSurfaceMap::value_type (aWidget, surf));
    } else {
        surf = (iter->second);
    }

    *aSurface = surf;
    NS_ADDREF(*aSurface);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 71 of file nsCairoSurfaceManager.cpp.

{
    nsNativeWidget nativeWidget = aWidget->GetNativeData(NS_NATIVE_WIDGET);

    return GetDrawingSurfaceForNativeWidget (aDC, nativeWidget, aSurface);
}

Here is the call graph for this function:

Definition at line 106 of file nsCairoSurfaceManager.cpp.

{
    nsCairoDrawingSurface *cds = NS_STATIC_CAST(nsCairoDrawingSurface*, aSurface);
    nsNativeWidget nw = cds->GetNativeWidget();

    WidgetToSurfaceMap::iterator iter = mSurfaceMap.find(nw);
    if (iter == mSurfaceMap.end()) {
        // ?!
        return NS_OK;
    }

    PRUint32 refcnt;
    NS_RELEASE2(cds, refcnt);

    if (refcnt == 0) {
        mSurfaceMap.erase (iter);
    }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 71 of file nsCairoSurfaceManager.h.


The documentation for this class was generated from the following files: