/* Unmount the OS ZIP device if its been used. */ void zip_unmount_os(void) { DEVICELIST *dev; DEVICEPARAM p_close = { STRING_AND_LENGTH("Close"), ParamBoolean, NULL }; if (swzipreaddevice != NULL) { HQASSERT(osdevice != NULL, "osdevice is NULL"); /* Do our best to unmount the os device. */ ClearUndismountableDevice(osdevice); theDevParamBoolean(p_close) = TRUE; if ( (theISetParam(osdevice))(osdevice, &p_close) != ParamAccepted ) { HQFAIL("Unable to set Close parameter on zipped SW folder."); } /* Call the device dismount directly as PS semantics no longer apply. */ if ((dev = find_device((uint8*)"os")) != NULL) { if ((*theIDevDismount( dev ))( dev ) == -1) { HQFAIL("Unable to dismount os device on zipped SW folder."); } } swzipreaddevice = NULL; } }
static Bool try_roam_named_colors(GS_COLORinfo *colorInfo, NAMECACHE *sepname, EQUIVCOLOR equivs, Bool *foundEquivs, EXTRADATA *extraData) { OBJECT namedColorIntercept; Bool foundResource; /* Find out if the Roam NamedColor resource exists; it is an optional resource. * If it doesn't exist, just return success with foundEquivs unset. */ if (!run_ps_string((uint8*)"/Roam /NamedColorOrder resourcestatus")) { HQFAIL("Internal resourcestatus failed for Roam NamedColorOrder"); /* If this fails then the tidyup is handled by the client. */ return FALSE; } foundResource = oBool(*theTop(operandstack)); pop(&operandstack); if (!foundResource) return TRUE; /* pop the other 2 items left by a successful resourcestatus */ npop(2, &operandstack); /* The Roam resource exists so and set it in the gstate. Then attempt to * get equivalent colors using the named color interception. * NB1. The NamedColor databases used in this method can be quite different * to the ones used in the standard method. * NB2. The resource can be obtained via a PS callout and placed into a dict * ready for passing to setinterceptcolorspace, but it must be installed * into the correct colorInfo. */ if (!run_ps_string((uint8*)"<< /NamedColor /Roam /NamedColorOrder findresource >>")) { HQFAIL("Internal findresource failed for Roam NamedColorOrder"); /* If this fails then the tidyup is handled by the client. */ return FALSE; } Copy(&namedColorIntercept, theTop(operandstack)); pop(&operandstack); if (!gsc_setinterceptcolorspace(colorInfo, &namedColorIntercept)) return FALSE; return named_colors_common(colorInfo, sepname, equivs, foundEquivs, extraData->outputSpaceId, extraData->equivColorType); }
static Bool try_rcb_named_colors(GS_COLORinfo *colorInfo, NAMECACHE *sepname, EQUIVCOLOR equivs, Bool *foundEquivs, EXTRADATA *extraData) { OBJECT namedColorIntercept; /* Get the Recombine NamedColor resource and set it in the gstate. Then * attempt to get equivalent colors using the same methods as for non-recombine. * This is a low priority method if all else fails. NB. The NamedColor * databases used in this method can be quite different to the ones used in * the standard method above, often a superset just to allow the job to output. * NB. The resource can be obtained via a PS callout, but it must be installed * into the correct colorInfo. */ if (!run_ps_string((uint8*)"<< /NamedColor /Recombine /NamedColorOrder findresource >>")) { HQFAIL("Internal setting of Recombine NamedColorOrder resource failed"); return error_handler(UNDEFINED); } Copy(&namedColorIntercept, theTop(operandstack)); pop(&operandstack); if (!gsc_setinterceptcolorspace(colorInfo, &namedColorIntercept)) return FALSE; return named_colors_common(colorInfo, sepname, equivs, foundEquivs, extraData->outputSpaceId, extraData->equivColorType); }
void bd_blockCheck(BackdropBlock *block) { #if defined( ASSERT_BUILD ) switch ( block->storage ) { case STORAGE_DISK: HQASSERT(block->file && block->foffset != -1, "File and file offset not set up for STORAGE_DISK block"); if ( !block->resource ) { HQASSERT(!block->data && !block->lines, "For a block on disk, shouldn't have data and lines if no resource"); break; } /* fall through */ case STORAGE_MEMORY: { BackdropLine *lines = bd_blockLine(block, 0); uint32 offset = 0, yi; HQASSERT(block->data, "Backdrop block data is missing"); HQASSERT(block->lines, "Backdrop block lines is missing"); HQASSERT(!lines[0].repeat, "First line can never be a repeat"); if ( bd_isComplete(block) ) { for ( yi = 0; yi < block->height; ++yi ) { if ( !lines[yi].repeat ) { HQASSERT(offset == lines[yi].offset, "Bad offset in backdrop block"); if ( bd_isRLE(&lines[yi]) ) { HQASSERT(lines[yi].nRuns > 0, "nRuns cannot be zero for RLE"); offset += 2 * lines[yi].nRuns; } else { HQASSERT(lines[yi].nRuns == 0, "nRuns must be zero for non-RLE"); offset += block->width; } } } HQASSERT(offset == block->dataBytes, "Unexpected data allocation size"); } else { HQASSERT(block->resource, "All insertable blocks should be using a resource"); for ( yi = 0; yi < block->height; ++yi ) { HQASSERT(offset == lines[yi].offset, "Bad offset in backdrop block"); if ( bd_isRLE(&lines[yi]) ) HQASSERT(lines[yi].nRuns == 1, "nRuns can only be one in insert mode"); else HQASSERT(lines[yi].nRuns == 0, "nRuns must be zero for non-RLE"); offset += block->width; } HQASSERT(offset <= block->dataBytes, "Unexpected data allocation size"); } break; } case STORAGE_UNIFORM: HQASSERT(bdt_getNUsedSlots(bd_uniformTable(block)) == 1, "Expected only one used slot for uniform table"); break; default: HQFAIL("Unrecognised backdrop block storage type"); } #else UNUSED_PARAM(BackdropBlock*, block); #endif /* ASSERT_BUILD */ }
void bd_blockDebug(CompositeContext *context, Backdrop *backdrop, BackdropBlock *block) { UNUSED_PARAM(CompositeContext*, context); UNUSED_PARAM(Backdrop*, backdrop); UNUSED_PARAM(BackdropBlock*, block); #if defined( DEBUG_BUILD ) { /* If you want to see what's in a specific block call bd_blockPrint on it. */ static Bool printBlocks = FALSE; if ( printBlocks ) bd_blockPrint(block, backdrop->inComps); } #endif #if defined( METRICS_BUILD ) { /* Gather stats on the block. Gathering pixel or run data is slow and therefore restricted to debug metric builds.*/ CompositeMetrics *metrics = &context->metrics; switch ( block->storage ) { case STORAGE_DISK: if ( !block->resource ) break; /* fall through */ case STORAGE_MEMORY: { BackdropLine *lines = bd_blockLine(block, 0); BackdropTable *prevTable = NULL; uint32 yi; for ( yi = 0; yi < block->height; ++yi ) { if ( !lines[yi].repeat ) { BackdropTable *table = lines[yi].table; if ( table && table != prevTable ) { metrics->nDuplicateEntries += bd_debugCountDuplicates(table, backdrop->inComps); prevTable = table; } if ( backdrop->compositeToPage ) { if ( bd_isRLE(&lines[yi]) ) { ++metrics->nRLELines; metrics->nRuns += lines[yi].nRuns; } else { ++metrics->nMapLines; metrics->nPixels += bd_blockWidth(block); } } } } break; } case STORAGE_UNIFORM: ++metrics->nUniformBlocks; break; default: HQFAIL("Unrecognised backdrop block storage type"); } } #endif }
/** Free the memory allocated for the parameter dictionary of a filter */ static void pdf_freeparamdict( PDFXCONTEXT *pdfxc , FILELIST *flptr ) { OBJECT *theDict ; HQASSERT( flptr, "flptr NULL in pdf_freeparamdict" ) ; theDict = & theIParamDict( flptr ) ; switch ( oType(*theDict) ) { case ODICTIONARY: { OBJECT theCopy = OBJECT_NOTVM_NOTHING ; /* Tag the parameter dictionary as NULL so that it * is NOT recusively freed by the calling routine. */ Copy( & theCopy, theDict ) ; theTags(*theDict) = ONULL | LITERAL ; pdf_freeobject_from_xc( pdfxc , & theCopy ) ; break ; } case ONULL : /* The dictionary is being recursively freed so do nothing */ break ; default: HQFAIL("theDict is not a dictionary or NULL in pdf_freeparamdict") ; break ; } }
void pdf_xrefcache_dumppage( PDFCONTEXT *pdfc, int32 page ) { int32 i ; PDFXCONTEXT *pdfxc ; PDF_CHECK_MC( pdfc ) ; PDF_GET_XC( pdfxc ) ; /* Each entry in the cache array is a linked list. */ for ( i = 0 ; i < XREF_CACHE_SIZE ; i++ ) { XREFCACHE **cacheLink = & pdfxc->xrefcache[ i ] ; while ( *cacheLink != NULL ) { XREFCACHE *cache = *cacheLink; if ( cache->lastAccessId == page ) { FILELIST *flptr = theIStderr( workingsave ) ; monitorf(( uint8 * ) "%d %d obj\n" , cache->objnum , cache->objgen ) ; debug_print_object( &cache->pdfobj ) ; if (( *theIMyFlushFile( flptr ))( flptr ) == EOF ) { HQFAIL( "Flush failed" ) ; return ; } monitorf(( uint8 * ) "\n" ) ; } cacheLink = &cache->xrefnxt; } } }
/** Deletes the rtree rooted at (*p_node). */ void rtree_dispose( RTREE_NODE **p_node) { RTREE_NODE *node = *p_node; if (p_node == NULL) { HQFAIL("Disposing NULL rtree!"); return; } node = *p_node; if (node != NULL) {/* just in case */ if ( node->level > 0 ) { uint32 i = node->count; /* non-leaf; delete each branch node. */ while ( i > 0 ) { rtree_dispose( &node->branch[--i].u.child ); --(node->count); } } } rtree_free_node(node); *p_node = NULL; }
void corejob_begin(DL_STATE *page) { corejob_t *job ; job = page->job ; VERIFY_OBJECT(job, CORE_JOB_NAME) ; HQASSERT(job->first_dl == page && job->last_dl == page, "Job tracker out of sync with DL page") ; HQASSERT(job->state == CORE_JOB_NONE, "Unexpected core job state") ; page->pageno = 0 ; mps_telemetry_label(0, jobStart); job->state = CORE_JOB_CONFIG ; job->has_output = FALSE ; job->pages_output = 0 ; job->failed = FALSE ; probe_begin(SW_TRACE_JOB_CONFIG, (intptr_t)job); if ( (page->timeline = timeline_push(&job->timeline, SWTLT_JOB_CONFIG, 0 /*end*/, SW_TL_UNIT_NONE, job, job->name.string, job->name.length)) == SW_TL_REF_INVALID ) { job->failed = TRUE ; /** \todo ajcd 2011-07-20: Decide how to clean up */ HQFAIL("Job config timeline start failed") ; } mps_telemetry_label(0, configStart); }
/** * Remove the specified blist (or all of them if blist == NULL ) * from the given blist chain * * \param[in] blist The blist to remove (NULL means all of them) * \param[in,out] chain The chain of blists's to remove it from */ void blist_unchain(IM_SHARED *im_shared, IM_BLIST *blist, IM_BLIST **chain) { IM_BLIST *bl, *next; for ( bl = *chain; bl != NULL && bl->prev != NULL; bl = bl->prev) EMPTY_STATEMENT(); /* walk to the head of the chain */ for ( ; bl != NULL; bl = next ) { next = bl->next; if ( blist == NULL || bl == blist ) { if ( bl->prev != NULL) bl->prev->next = bl->next; if ( bl->next != NULL) bl->next->prev = bl->prev; if (bl == (*chain)) *chain = bl->next; bl->next = NULL; bl->prev = NULL; if ( blist != NULL ) return; else blist_destroy(im_shared, bl, FALSE); } } if ( blist != NULL ) HQFAIL("failed to find blist in list"); }
/** * \brief Callback to enable the PMS to retrieve a band from the OIL. * * The PMS calls this function to retrieve a band of data from the OIL. The PMS * must specify the job, page, colorant and band number to identify the required * band. It must also pass in an initialized pointer to a PMS_TyBand structure * to receive the data from the OIL. * \param[in] uJobID The job ID which partially identifies the required band. * \param[in] uPageID The page ID which partially identifies the required band. * \param[in] nColorant The colorant identifier which partially identifies the required band. * \param[in] nBandNo The band number of the required band. * \param[in, out] ptBand An initialized pointer to a PMS band structure. The retrieved data will * be written to this structure. * \return Returns TRUE if the requested band is successfully retrieved, FALSE otherwise. */ int OIL_GetBandData(unsigned int uJobID, unsigned int uPageID, int nColorant, int nBandNo, PMS_TyBand *ptBand) { OIL_TyPage *ptCurrentPage; OIL_TyJob *ptJob; int retVal = FALSE; OIL_ProbeLog(SW_TRACE_OIL_GETBANDDATA, SW_TRACETYPE_ENTER, (intptr_t)nBandNo); if(ptBand == NULL) { HQFAIL("OIL_GetBandData: Invalid Band Pointer"); return retVal; } ptJob = GetJobByJobID(uJobID); if(ptJob == NULL) { HQFAIL("OIL_GetBandData: Job for which band data is being requested is not present in job queue"); return retVal; } /* start from the head of the page list */ ptCurrentPage = ptJob->pPage; /* iterate over pages to find the page for which bands are requested */ while(ptCurrentPage !=NULL) { if(ptCurrentPage->uPageNo == uPageID) { /* page found. fill the structure with band data */ ptBand->uBandHeight = ptCurrentPage->atPlane[nColorant].atBand[nBandNo].uBandHeight; ptBand->uBandNumber = ptCurrentPage->atPlane[nColorant].atBand[nBandNo].uBandNumber; ptBand->cbBandSize = ptCurrentPage->atPlane[nColorant].atBand[nBandNo].cbBandSize; ptBand->pBandRaster = ptCurrentPage->atPlane[nColorant].atBand[nBandNo].pBandRaster; retVal = TRUE; break; } ptCurrentPage = (OIL_TyPage *)ptCurrentPage->pNext; } HQASSERT(ptCurrentPage != NULL, "OIL_GetBandData: Page for which band data is being requested is not present"); OIL_ProbeLog(SW_TRACE_OIL_GETBANDDATA, SW_TRACETYPE_EXIT, (intptr_t)nBandNo); return retVal; }
Bool pdf_getxrefobj( PDFCONTEXT *pdfc , int32 objnum , uint16 objgen , XREFOBJ **rxrefobj ) { PDFXCONTEXT *pdfxc ; XREFSEC *xrefsec ; XREFTAB *xreftab ; XREFOBJ *xrefobj ; PDF_CHECK_MC( pdfc ) ; PDF_GET_XC( pdfxc ) ; xrefsec = pdfxc->xrefsec ; xrefobj = NULL ; *rxrefobj = NULL ; HQASSERT( xrefsec , "Must have just one xrefsec in pdf_getxrefobj" ) ; HQASSERT( xrefsec->xrefnxt == NULL , "Must have just one xrefsec in pdf_getxrefobj" ) ; for ( xreftab = xrefsec->xreftab ; xreftab ; xreftab = xreftab->xrefnxt ) if ( objnum >= xreftab->objnum && objnum < xreftab->objnum + xreftab->number ) { xrefobj = xreftab->xrefobj ; xrefobj += ( objnum - xreftab->objnum ) ; if ( xrefobj->objuse != XREF_Uninitialised && xrefobj->d.n.objgen > objgen ) { HQFAIL ( "Strange job, uses later object defs with earlier generation" " numbers, in pdf_getxrefobj" ) ; return error_handler( UNDEFINED ) ; } *rxrefobj = xrefobj ; return TRUE ; } HQASSERT( xrefobj == NULL , "Somehow xrefobj is not null in pdf_getxrefobj" ) ; /* Not found in the xref tables, so allocate a new xref table for * it and a block of xref objects. pdf_allocxreftable adds the * table to the end of the list of tables. */ xreftab = pdf_allocxreftab( pdfc , xrefsec , /* blocks go from 0..BLOCK_SIZE, etc. */ (( objnum / XREFOBJ_BLOCK_SIZE ) * XREFOBJ_BLOCK_SIZE ), XREFOBJ_BLOCK_SIZE ) ; if ( ! xreftab ) return error_handler( VMERROR ) ; xrefobj = pdf_allocxrefobj( pdfc , xreftab , XREFOBJ_BLOCK_SIZE ) ; if ( ! xrefobj ) return error_handler( VMERROR ) ; xrefobj += ( objnum - xreftab->objnum ) ; *rxrefobj = xrefobj ; return TRUE ; }
/* ============================================================================ * Recognition filter. * ============================================================================ */ static int32 namespace_cb( xmlGFilter *filter, const xmlGIStr *prefix, const xmlGIStr *uri) { xmlGFilterChain *filter_chain ; XMLExecContext* xmlexec_ctxt ; Recognition_fltr_ctxt *filter_ctxt ; struct NSRecognitionEntry *entry ; UNUSED_PARAM( const xmlGIStr *, prefix ) ; HQASSERT(filter != NULL, "filter is NULL") ; filter_ctxt = xmlg_get_user_data(filter) ; filter_chain = xmlg_get_fc(filter) ; HQASSERT(filter_chain != NULL, "filter_chain is NULL") ; xmlexec_ctxt = SLL_GET_HEAD(&xml_context.sls_contexts, XMLExecContext, sll) ; HQASSERT((xmlexec_ctxt != NULL), "xmlexec_ctxt is NULL") ; /* Do we know about this XML namespace? */ entry = namespace_recognition_get(filter_ctxt, uri) ; if (entry != NULL) { if (xmlexec_ctxt->doc_context == NULL) { /* Create the appropriate context for this doc type. */ if (entry->f_create_context != NULL && ! entry->f_create_context(xmlexec_ctxt->xmlexec_params, xmlexec_ctxt->xml_flptr, &(xmlexec_ctxt->doc_context), filter_chain)) { return FALSE ; } xmlexec_ctxt->f_destroy = entry->f_destroy_context ; /* Since we have recognised a namespace, remove the namespace callback from the recognition filter as we are not interested in any further namespace declarations. Also remove the temporary start element callback. Validation will now be done via the PDL processor from now on. */ (void)xmlg_deregister_start_element_cb(filter, NULL, NULL) ; (void)xmlg_remove_namespace_cb(filter) ; /* TBD: look into removing the filter from this chain. Its not too bad for XPS because only the .rels part has this recognition filter in place. */ } else { HQFAIL("namespace recognition has occured more than once on an xmlexec context") ; } } /* If we do not recognize the namespace, we keep on processing. */ return TRUE ; }
uint32 Hq32x2AssertToUint32( Hq32x2 * p32x2 ) { if ( p32x2->high == 0 ) return p32x2->low; HQFAIL( "Hq32x2 out of range for uint32" ); /* Force to unsigned 32 bit value */ return ( p32x2->high > 0 ) ? BITS_ALL : 0; }
uint32 HqU32x2AssertToUint32( HqU32x2 * pU32x2 ) { if ( pU32x2->high == 0 ) return pU32x2->low; HQFAIL( "HqU32x2 out of range for uint32" ); return BITS_ALL; }
int32 HqU32x2AssertToInt32( HqU32x2 * pU32x2 ) { if ( U_CAN_FIT_IN_INT32( pU32x2 ) ) return (int32)pU32x2->low; HQFAIL( "HqU32x2 out of range for int32" ); return MAXINT; }
int8 unicode_char_type(UTF32 c, HqBool *error_occured ) { HQASSERT(error_occured != NULL, "error_occured is NULL") ; UNUSED_PARAM(UTF32, c) ; *error_occured = TRUE ; HQFAIL("Cannot determine Unicode character type without ICU") ; return 0 ; }
void corejob_running(DL_STATE *page) { corejob_t *job = page->job ; VERIFY_OBJECT(job, CORE_JOB_NAME) ; HQASSERT(job->first_dl == page && job->last_dl == page, "Job tracker out of sync with DL page") ; HQASSERT(job->state == CORE_JOB_CONFIG, "Unexpected core job state") ; mps_telemetry_label(0, configEnd); timeline_pop(&job->timeline, SWTLT_JOB_CONFIG, !job->failed) ; probe_end(SW_TRACE_JOB_CONFIG, (intptr_t)job); job->state = CORE_JOB_RUNNING ; probe_begin(SW_TRACE_JOB, (intptr_t)job); if ( (page->timeline = timeline_push(&job->timeline, SWTLT_JOB, SW_TL_EXTENT_INDETERMINATE /*end*/, SW_TL_UNIT_PAGES, job, job->name.string, job->name.length)) == SW_TL_REF_INVALID ) { job->failed = TRUE ; /** \todo ajcd 2011-07-20: Decide how to clean up */ HQFAIL("Job timeline start failed") ; } /* Register user and timeout interrupt handlers for this job */ job->interrupt_handler.context = job; if (SwRegisterHandler(SWEVT_INTERRUPT_USER, &job->interrupt_handler, SW_EVENT_NORMAL) != SW_RDR_SUCCESS || SwRegisterHandler(SWEVT_INTERRUPT_TIMEOUT, &job->interrupt_handler, SW_EVENT_NORMAL) != SW_RDR_SUCCESS) { job->failed = TRUE; /* Deregister user interrupt event handler in case it succeeded. */ (void)SwSafeDeregisterHandler(SWEVT_INTERRUPT_USER, &job->interrupt_handler); /** \todo mrw 2011-08-19: needs clean up along lines of what happens with * timeline. */ HQFAIL("Job start interrupt handler register failed") ; job->interrupt_handler.context = NULL; } mps_telemetry_label(0, jobStart); }
HqBool unicode_has_binary_property(UTF32 c, UTF32_Property which, HqBool *error_occured ) { HQASSERT(error_occured != NULL, "error_occured is NULL") ; UNUSED_PARAM(UTF32, c) ; UNUSED_PARAM(UTF32_Property, which) ; *error_occured = TRUE ; HQFAIL("Cannot determine Unicode character property without ICU") ; return FALSE ; }
int32 Hq32x2AssertToInt32( Hq32x2 * p32x2 ) { /* Force to signed 32 bit value */ if ( CAN_FIT_IN_INT32( p32x2 ) ) return (int32) p32x2->low; HQFAIL( "Hq32x2 out of range for int32" ); return ( p32x2->high >= 0 ) ? MAXINT : MININT; }
static Bool rtree_insert_rect_internal( RTREE_RECT *r , void *data , RTREE_NODE *n, /*@out@*/ RTREE_NODE **new_node, uint32 level ) { uint32 i; RTREE_BRANCH b; RTREE_NODE *n2; HQASSERT( r != NULL && n != NULL && new_node != NULL , "Unexpected NULL pointer" ) ; HQASSERT( level <= n->level , "level out of range" ) ; /* Still above level for insertion, go down tree recursively */ if ( n->level > level ) { i = rtree_pick_branch( r, n ); HQASSERT( n->branch[ i ].u.child != NULL , "Should have picked a viable branch" ) ; if ( !rtree_insert_rect_internal( r , data , n->branch[ i ].u.child , & n2 , level )) { /* Child was not split */ rtree_union_rect( r , &( n->branch[ i ].rect ) , &n->branch[ i ].rect ) ; *new_node = NULL ; return FALSE; } else { /* Child was split */ n->branch[ i ].rect = rtree_node_cover( n->branch[ i ].u.child ); b.u.child = n2; b.rect = rtree_node_cover( n2 ); return rtree_add_branch( &b, n, new_node ); } } else if ( n->level == level ) { /* We've reached level for insertion. Add the rect, splitting if necessary. */ b.rect = *r ; b.u.data = data ; return rtree_add_branch( &b, n, new_node ) ; } else { /* Not supposed to happen */ HQFAIL( "This branch shouldn't be reached" ) ; *new_node = NULL ; return FALSE; } }
Bool psdevuri_swstart(struct SWSTART *params) { UNUSED_PARAM(struct SWSTART *, params) ; /* Create root last so we force cleanup on success. */ if (mps_root_create(&xml_file_root, mm_arena, mps_rank_exact(), 0, xml_file_root_scan, NULL, 0) != MPS_RES_OK) { HQFAIL("Failed to register psdevuri file root.") ; return FAILURE(FALSE) ; } return TRUE ; }
/* CID Type 0 does not support SEAC */ static Bool cid0_begin_seac(void *data, int32 stdindex, uint8 **subrstr, uint32 *subrlen) { UNUSED_PARAM(void *, data) ; UNUSED_PARAM(int32, stdindex) ; UNUSED_PARAM(uint8 **, subrstr) ; UNUSED_PARAM(uint32 *, subrlen) ; HQFAIL("SEAC should not appear in a Type 0 CID font") ; return error_handler(INVALIDFONT) ; }
/** * DL first region function for use with region iterator */ static Bool first_region(DL_STATE *page, surface_handle_t handle, CompositeContext *context, dbbox_t *region, int32 currentbackdrops, int32 regionTypes, DLRegionIterator *iterator, dbbox_t *bounds, Bool *backdropRender) { BGMultiState state; int32 regionWidth, regionHeight ; state = page->regionMap != NULL ? bitGridGetBoxMapped(page->regionMap, region) : BGAllClear; switch (state) { case BGAllClear: /* Every region in the band is clear */ *bounds = *region ; *backdropRender = FALSE; return FALSE; /* no more regions */ default: HQFAIL("Unrecognised bitGrid state"); /*@fallthrough@*/ case BGAllSet: /* Every region in the band is set, but may still need to break band up into regions to avoid requiring excessive amounts of memory */ if ( (regionTypes & RENDER_REGIONS_BACKDROP) == 0 ) { /* If we're not being asked to backdrop render, and all of the regions are set, we can bail out quickly. The caller will not render any of these regions. */ *bounds = *region ; *backdropRender = TRUE ; return FALSE ; } /*@fallthrough@*/ case BGMixed: /* Got a mixed band, consider region by region. Set the initial iterator position to the block including the top-left corner of the region, and call the iterator recursively to extend the region as far as possible. */ regionWidth = page->region_width; regionHeight = page->region_height; *iterator = (region->y1 / regionHeight) * ((page->page_w + regionWidth - 1) / regionWidth) + (region->x1 / regionWidth) ; HQASSERT(*iterator != DL_REGION_ITERATOR_INIT, "Region iterator still initial value after rounding start") ; return dlregion_iterator(page, handle, context, region, currentbackdrops, regionTypes, iterator, bounds, backdropRender); } }
static void swcore_finish(void) { if ( SwTimelineEnd(core_tl_ref) != SW_TL_SUCCESS ) { /* Probably some child holding it open. That would almost certainly be a bug. On the other hand, there's no context associated with the root timeline, so maybe we could allow it? */ CHECK_TL_SUCCESS(SwTimelineAbort(core_tl_ref, 0)) ; HQFAIL("Core timeline refused to end") ; } core_tl_ref = SW_TL_REF_INVALID ; probe_end(SW_TRACE_CORE, 0) ; }
RTREE_NODE *rtree_new_index( /*@in@*/ sw_memory_instance *mem ) { RTREE_NODE *x; HQASSERT( mem != NULL, "Need a memory api"); if ( mem->implementation->info.version < SW_MEMORY_API_VERSION_20071110 ) { HQFAIL("Rtree needs version 20071110 or later of SW_MEMORY_API"); return NULL; } x = rtree_new_node( mem ); x->level = 0; /* leaf */ return x; }
/** * Is the specified point inside/outisde/on-the-border of the given edge * of the clipbox ? * \param[in] pt point to test * \param[in] wc window clip context * \return -1 if outside, 0 if on-the border, +1 if inside */ static int wc_inside(FPOINT *pt, WCLIP *wc) { switch ( wc->edge ) { case 0: /* top */ return wc_pcmp(wc->clipbox->y2 - pt->y); case 1: /* right */ return wc_pcmp(wc->clipbox->x2 - pt->x); case 2: /* bottom */ return wc_pcmp(pt->y - wc->clipbox->y1); case 3: /* left */ return wc_pcmp(pt->x - wc->clipbox->x1); default: HQFAIL("wc_inside() : Illegal edge value"); return 0; } }
static mps_addr_t MPS_CALL ps_typed_skip( mps_addr_t object ) { TypeTag tag; size_t size; tag = ( (struct generic_typed_object *)object )->typetag; HQASSERT( DWORD_IS_ALIGNED( object ), "unaligned object" ); switch (tag) { case tag_NCACHE: { size = sizeof(NAMECACHE) + ((NAMECACHE *)object)->len; } break; default: HQFAIL("Invalid tag in skip"); size = 4; /* No value correct here; this to silence the compiler. */ } return ADDR_ADD( object, SIZE_ALIGN_UP( size, MM_PS_TYPED_ALIGNMENT )); }
static void debug_show_equiv_(NAMECACHE *sepname, int32 level, EQUIVCOLOR equivs) { int32 i; char *det_str; if ( ! gsc_equiv_debug ) return; switch (level) { case GSC_EQUIV_LVL_PROCESS: det_str = "Process Color"; break; case GSC_EQUIV_LVL_STD_NAMEDCOLOR: det_str = "STD Named Color"; break; case GSC_EQUIV_LVL_COLORANTS_DICT: det_str = "Colorants dict"; break; case GSC_EQUIV_LVL_TINT: det_str = "Tint transform"; break; case GSC_EQUIV_LVL_CUSTOMCOLOR: det_str = "CMYKCustomColor"; break; case GSC_EQUIV_LVL_FREEHANDSPOTS: det_str = "Spots Array"; break; case GSC_EQUIV_LVL_RCB_NAMEDCOLOR: det_str = "RCB Named Color"; break; case GSC_EQUIV_LVL_NONEKNOWN: det_str = "Not Found"; break; default: HQFAIL("Unknown recombine detection method (ignorable)"); det_str = "Unknown"; break; } monitorf((uint8*)"Equiv Detection Method %d: %-15s CMYK: ", level, det_str); /* vswcopyf ignores precision format specifiers for floats, so jump through some hoops to make it look nice. Not very efficient though. */ for ( i = 0; i < 4; ++i ) { USERVALUE val = equivs[i]; if ( val == 0.0f ) monitorf((uint8*)"0.000 "); else if ( val == 1.0f ) monitorf((uint8*)"1.000 "); else { int32 sf; monitorf((uint8*)"0."); for ( sf = 0; sf < 3 ; ++sf ) { val = (val - (int32)val) * 10; monitorf((uint8*)"%d", (int32)val); } monitorf((uint8*)" "); } } monitorf((uint8*)"PlateColor: '%.*s'\n", sepname->len, sepname->clist); }
/** Get the DL's representation of the current soft mask settings. */ static Bool getSoftMaskState(SoftMask* mask, DlSSSet* stores, SoftMaskAttrib** result) { SoftMaskAttrib maskAttrib; HQASSERT(mask != NULL && stores != NULL && result != NULL, "getSoftMaskState - parameters cannot be NULL"); /* Initialise result in case of early return. */ *result = NULL; if (mask->type == EmptySoftMask) return TRUE; /* Note that this is not an error. */ /* Initialize the SoftMaskAttrib structure and get a stored instance. */ maskAttrib.type = mask->type; maskAttrib.group = NULL ; /* Find the HDL stored for this softmask */ if ( mask->groupId != HDL_ID_INVALID ) { HDL *maskhdl = hdlStoreLookup(stores->hdl, mask->groupId); if ( maskhdl == NULL ) { HQFAIL("No softmask in store for group ID") ; return FALSE ; } maskAttrib.group = hdlGroup(maskhdl); HQASSERT(maskAttrib.group != NULL, "Softmask ID is not for a group") ; } /* Get the stored version. */ *result = (SoftMaskAttrib*)dlSSInsert(stores->softMask, &maskAttrib.storeEntry, TRUE); /* The store insert returning NULL means there was an error. */ if (*result == NULL) return FALSE; return TRUE; }