Exemple #1
0
static void RIPCALL SysFreeFnCallback(void * ptr)
{
#ifdef PMS_OIL_MERGE_DISABLE_MEM
  OIL_free(OILMemoryPoolJob, ptr);
#else
  free(ptr);
#endif
}
void DeletePMSPage(PMS_TyPage *ptPMSPage)
{
  OIL_ProbeLog(SW_TRACE_OIL_DELETEPMSPAGE, SW_TRACETYPE_ENTER, (intptr_t)0);
  /* remove any raster data created in PMS for j 2 and j 3 mode*/
  if (g_ConfigurableFeatures.eBandDeliveryType == OIL_PUSH_BAND ||
      g_ConfigurableFeatures.eBandDeliveryType == OIL_PUSH_BAND_DIRECT_SINGLE)
  {
      PMS_DeletePrintedPage (ptPMSPage);
  }
  OIL_free(OILMemoryPoolJob, ptPMSPage); /*free the PMS page memory*/
  ptPMSPage = NULL;
  OIL_ProbeLog(SW_TRACE_OIL_DELETEPMSPAGE, SW_TRACETYPE_EXIT, (intptr_t)0);
}
Exemple #3
0
/**
 * \brief OIL system exit function.
 *
 * This function is called to exit the OIL and shut down the RIP, freeing
 * all resources claimed by the RIP.   The function first checks to ensure
 * that the OIL is not in the \c OIL_Sys_JobActive or \c OIL_Sys_Uninitialised
 * If the current system state is \c OIL_Sys_Active and the requested state is
 * \c OIL_Sys_Inactive, this function:
 * \arg unregisters streams;
 * \arg attempts to stop the RIP, and reports an error message if it is unsuccessful, and
 * \arg sets places the system into the \c OIL_Sys_Inactive state.
 * \param[in]   eNextState  The system state that is required by the end of the call; expected
 *              to be \c OIL_Sys_Inactive.
 * \return      Returns TRUE if the OIL is successfully exited and placed in the
 *              requested state, FALSE otherwise.
 */
int SysExit(OIL_eTySystemState eNextState)
{
  HQASSERT(OIL_Sys_JobActive != g_SystemState.eCurrentState,
           "sys_exit entered in state: OIL_Sys_JobActive");
  HQASSERT(OIL_Sys_Uninitialised != g_SystemState.eCurrentState,
           "sys_exit entered in state: OIL_Sys_Uninitialised");

  GG_SHOW(GG_SHOW_OIL, "SysExit:\n");
  if ((g_SystemState.eCurrentState == OIL_Sys_Active) && (eNextState == OIL_Sys_Inactive))
  {
    int val;

    libjpegturbo_deregister();
    libjpeg_deregister();
    Stream_Unregister();
    val=SwLeStop();
    HQASSERT(val==0, "sys_exit : RIP is not shutting down successfully");
    oil_progress_finish();
    oil_events_finish();

    SwLeSDKEnd(val);

    /* shutdown the RIP, free systems resources */
    SwLeShutdown(); /* does nothing in ebd, but called for consistency with start up*/
#ifdef PMS_OIL_MERGE_DISABLE_MEM
    OIL_free(OILMemoryPoolSys, g_SystemState.pRIPMemory);
#else
    mfree(g_SystemState.pRIPMemory);
#endif

    g_SystemState.eCurrentState = eNextState;
  }

  /* return TRUE if now in requested state */
  return (g_SystemState.eCurrentState == eNextState);
}
/**
 * \brief Get the media source and media size from the PMS.
 *
 * This routine copies the media attributes being requested by the job into a PMS_TyMedia 
 * structure and passes it to the PMS.  This gives the PMS the opportunity to 
 * compare the requested media attributes with those that are actually available, and
 * to update the job attributes accordingly.
 * \param[in, out]  stEBDDeviceParams   A pointer to an OIL_TyEBDDeviceParameters structure holding the
 *                                      media details from the current job. It will be updated if the PMS
 *                                      changes the media size or input tray.
 */
void GetMediaFromPMS(OIL_TyEBDDeviceParameters *stEBDDeviceParams)
{
  PMS_TyTrayInfo *ptTrayInfo;
  PMS_TyPaperInfo *pPaperInfo;
#ifdef PMS_OIL_MERGE_DISABLE
  PMS_TyJob *pCurrentJob;
  PMS_TyMedia *pstPMSMedia;
#else
  OIL_TyMedia *pstPMSMedia;
#endif
  int rotate;
  float ClipLeft, ClipTop, ClipWidth, ClipHeight;

  OIL_ProbeLog(SW_TRACE_OIL_GETMEDIAFROMPMS, SW_TRACETYPE_ENTER, (intptr_t)0);

#ifdef PMS_OIL_MERGE_DISABLE
  pstPMSMedia = OIL_malloc(OILMemoryPoolJob, OIL_MemNonBlock, sizeof(PMS_TyMedia));
  HQASSERTV(pstPMSMedia!=NULL,
            ("GetMediaFromPMS: Failed to allocate %lu bytes", (unsigned long) sizeof(PMS_TyMedia)));

  /* Clear the structure to avoid confusion when debugging */
  memset(pstPMSMedia, 0x00, sizeof(PMS_TyMedia));
#else
  pstPMSMedia = OIL_malloc(OILMemoryPoolJob, OIL_MemNonBlock, sizeof(OIL_TyMedia));
  HQASSERTV(pstPMSMedia!=NULL,
	        ("GetMediaFromPMS: Failed to allocate %lu bytes", (unsigned long) sizeof(OIL_TyMedia)));

  /* Clear the structure to avoid confusion when debugging */
  memset(pstPMSMedia, 0x00, sizeof(OIL_TyMedia));
#endif
  /* The parameters in stEBDDeviceParams configured in the (%embedded%) device. 
     see \HqnEbd_SensePageDevice in SW\procsets\HqnEmbedded.
     see ebd_devparams_array in src\oil_ebddev.c  */
  strcpy((char*)pstPMSMedia->szMediaType, (char*)stEBDDeviceParams->MediaTypeFromJob);
  strcpy((char*)pstPMSMedia->szMediaColor, (char*)stEBDDeviceParams->MediaColorFromJob);
  pstPMSMedia->uMediaWeight = stEBDDeviceParams->MediaWeightFromJob;
  pstPMSMedia->uInputTray = stEBDDeviceParams->MediaSourceFromJob;
  pstPMSMedia->dWidth = stEBDDeviceParams->PageWidthFromJob;
  pstPMSMedia->dHeight = stEBDDeviceParams->PageHeightFromJob;

  /* Access default job settings */
#ifdef PMS_OIL_MERGE_DISABLE
  PMS_GetJobSettings(&pCurrentJob);
  HQASSERT(pCurrentJob, "GetMediaFromPMS, pCurrentJob is NULL");
  pstPMSMedia->ePaperSize = pCurrentJob->tDefaultJobMedia.ePaperSize;
#else
  pstPMSMedia->ePaperSize = g_tJob.tCurrentJobMedia.ePaperSize;
#endif

  /* \todo Populate pstPMSMedia with other parameters that influence tray selection */

  /* call PMS function to allow PMS to select a tray/media. */
  if(PMS_MediaSelect(pstPMSMedia, &ptTrayInfo, &rotate)) {
    HQASSERT(ptTrayInfo,
             "GetMediaFromPMS, tray/media selected, but ptTrayInfo is NULL");

    if(PMS_GetPaperInfo(ptTrayInfo->ePaperSize, &pPaperInfo)) {
      HQASSERT(pPaperInfo, "GetMediaFromPMS, pPaperInfo is NULL");

      stEBDDeviceParams->PageWidthFromPMS = (float)pPaperInfo->dWidth;
      stEBDDeviceParams->PageHeightFromPMS = (float)pPaperInfo->dHeight;
      stEBDDeviceParams->PCL5PageSizeFromPMS = pPaperInfo->ePCL5size;
      stEBDDeviceParams->PCLXLPageSizeFromPMS = pPaperInfo->ePCLXLsize;

      ClipLeft = (float)(pPaperInfo->nLeftUnprintable * 0.000072);
      ClipTop = (float)(pPaperInfo->nTopUnprintable * 0.000072);
      ClipWidth = (float)(pPaperInfo->dWidth - ClipLeft - (pPaperInfo->nRightUnprintable * 0.000072));
      ClipHeight = (float)(pPaperInfo->dHeight - ClipTop - (pPaperInfo->nBottomUnprintable * 0.000072));

      if(rotate)
      {
        stEBDDeviceParams->MediaClipTopFromPMS = ClipLeft;
        stEBDDeviceParams->MediaClipLeftFromPMS = ClipTop;
        stEBDDeviceParams->MediaClipHeightFromPMS = ClipWidth;
        stEBDDeviceParams->MediaClipWidthFromPMS = ClipHeight;
      }
      else
      {
        stEBDDeviceParams->MediaClipLeftFromPMS = ClipLeft;
        stEBDDeviceParams->MediaClipTopFromPMS = ClipTop;
        stEBDDeviceParams->MediaClipWidthFromPMS = ClipWidth;
        stEBDDeviceParams->MediaClipHeightFromPMS = ClipHeight;
      }

      if(g_ConfigurableFeatures.ePrintableMode == OIL_RIPRemovesUnprintableArea)
      {
        /* calculate the logical page or get engine raster dimensions if defined */

        stEBDDeviceParams->ImagingBoxLeftFromPMS = ClipLeft;
        stEBDDeviceParams->ImagingBoxTopFromPMS = ClipTop;
        stEBDDeviceParams->ImagingBoxRightFromPMS = ClipLeft +
          PADDED_ALIGNEMENT(ClipWidth, g_pstCurrentJob->uRIPDepth, g_pstCurrentJob->uXResolution);
        stEBDDeviceParams->ImagingBoxBottomFromPMS = ClipTop + ClipHeight;
      }
      else
      {
        stEBDDeviceParams->ImagingBoxLeftFromPMS = 0;
        stEBDDeviceParams->ImagingBoxTopFromPMS = 0;
        stEBDDeviceParams->ImagingBoxRightFromPMS = 
          PADDED_ALIGNEMENT(pPaperInfo->dWidth, g_pstCurrentJob->uRIPDepth, g_pstCurrentJob->uXResolution);
        stEBDDeviceParams->ImagingBoxBottomFromPMS = (float)pPaperInfo->dHeight;
      }

      stEBDDeviceParams->MediaSourceFromPMS = ptTrayInfo->eMediaSource;

    } else {
      HQFAIL("GetMediaFromPMS, Call to PMS_GetPaperInfo failed.");
    }
  }

  OIL_free(OILMemoryPoolJob, pstPMSMedia);
  OIL_ProbeLog(SW_TRACE_OIL_GETMEDIAFROMPMS, SW_TRACETYPE_EXIT, (intptr_t)0);
}