Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsDeviceContextXP.cpp File Reference
#include "prlog.h"
#include "nsDeviceContextXP.h"
#include "nsRenderingContextXp.h"
#include "nsFontMetricsXlib.h"
#include "nsIDeviceContext.h"
#include "nsIDeviceContextSpecXPrint.h"
#include "nspr.h"
#include "nsXPrintContext.h"

Go to the source code of this file.


class  nsFontCacheXp


 NS_IMPL_ISUPPORTS_INHERITED1 (nsDeviceContextXp, DeviceContextImpl, nsIDeviceContextXp) NS_IMETHODIMP nsDeviceContextXp
See documentation in nsDeviceContextXp.h

Function Documentation

See documentation in nsDeviceContextXp.h

This method is called after SetSpec

Definition at line 109 of file nsDeviceContextXP.cpp.

  nsresult rv;

  // Initialization moved to SetSpec to be done after creating the Print Context
  float origscale, newscale;
  float t2d, a2d;
  int   print_x_resolution,

  mPrintContext->GetPrintResolution(print_x_resolution, print_y_resolution);
  if (print_x_resolution != print_y_resolution) {
    PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("print_x_resolution != print_y_resolution not yet supported by Mozilla's layout engine\n"));
    return NS_ERROR_NOT_IMPLEMENTED; /* this error code should be more detailed */

  mPixelsToTwips = (float)NSIntPointsToTwips(72) / (float)print_x_resolution;
  mTwipsToPixels = 1.0f / mPixelsToTwips;

  newscale = TwipsToDevUnits();
  origscale = aParentContext->TwipsToDevUnits();

  mCPixelScale = newscale / origscale;

  t2d = aParentContext->TwipsToDevUnits();
  a2d = aParentContext->AppUnitsToDevUnits();

  mAppUnitsToDevUnits = (a2d / t2d) * mTwipsToPixels;
  mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;

  NS_ASSERTION(aParentContext, "aCreatingDeviceContext cannot be NULL!!!");
  mParentDeviceContext = aParentContext;

  /* be sure we've cleaned-up old rubbish - new values will re-populate nsFontMetricsXlib soon... */
  mRCContext          = nsnull;
  mFontMetricsContext = nsnull;
  rv = CreateFontMetricsXlibContext(this, PR_TRUE, &mFontMetricsContext);
  if (NS_FAILED(rv))
    return rv;

  rv = CreateRenderingContextXlibContext(this, &mRCContext);
  if (NS_FAILED(rv))
    return rv;
  return NS_OK;

Here is the call graph for this function: