cairo_status_t _cairo_gl_surface_clone_similar (void *abstract_surface, cairo_surface_t *src, int src_x, int src_y, int width, int height, int *clone_offset_x, int *clone_offset_y, cairo_surface_t **clone_out) { cairo_gl_surface_t *surface = abstract_surface; cairo_int_status_t status; /* XXX: Use GLCopyTexImage2D to clone non-texture-surfaces */ if (src->device == surface->base.device && _cairo_gl_surface_is_texture ((cairo_gl_surface_t *) src)) { status = _cairo_gl_surface_deferred_clear ((cairo_gl_surface_t *)src); if (unlikely (status)) return status; *clone_offset_x = 0; *clone_offset_y = 0; *clone_out = cairo_surface_reference (src); return CAIRO_STATUS_SUCCESS; } else if (_cairo_surface_is_image (src)) { cairo_image_surface_t *image_src = (cairo_image_surface_t *)src; cairo_gl_surface_t *clone; clone = (cairo_gl_surface_t *) _cairo_gl_surface_create_similar (&surface->base, src->content, width, height); if (clone == NULL) return UNSUPPORTED ("create_similar failed"); if (clone->base.status) return clone->base.status; status = _cairo_gl_surface_draw_image (clone, image_src, src_x, src_y, width, height, 0, 0); if (status) { cairo_surface_destroy (&clone->base); return status; } *clone_out = &clone->base; *clone_offset_x = src_x; *clone_offset_y = src_y; return CAIRO_STATUS_SUCCESS; } return UNSUPPORTED ("unknown src surface type in clone_similar"); }
cairo_int_status_t _cairo_gl_check_composite_glyphs (const cairo_composite_rectangles_t *extents, cairo_scaled_font_t *scaled_font, cairo_glyph_t *glyphs, int *num_glyphs) { if (! _cairo_gl_operator_is_supported (extents->op)) return UNSUPPORTED ("unsupported operator"); /* XXX use individual masks for large glyphs? */ if (ceil (scaled_font->max_scale) >= GLYPH_CACHE_MAX_SIZE) return UNSUPPORTED ("glyphs too large"); return CAIRO_STATUS_SUCCESS; }
static cairo_int_status_t check_composite (const cairo_composite_rectangles_t *extents) { if (! _cairo_gl_operator_is_supported (extents->op)) return UNSUPPORTED ("unsupported operator"); return CAIRO_STATUS_SUCCESS; }
cairo_status_t _cairo_gl_composite_set_operator (cairo_gl_composite_t *setup, cairo_operator_t op, cairo_bool_t assume_component_alpha) { if (assume_component_alpha) { if (op != CAIRO_OPERATOR_CLEAR && op != CAIRO_OPERATOR_OVER && op != CAIRO_OPERATOR_ADD) return UNSUPPORTED ("unsupported component alpha operator"); } else { if (! _cairo_gl_operator_is_supported (op)) return UNSUPPORTED ("unsupported operator"); } setup->op = op; return CAIRO_STATUS_SUCCESS; }
static cairo_int_status_t _cairo_skia_surface_paint (void *asurface, cairo_operator_t op, const cairo_pattern_t *source, cairo_clip_t *clip) { cairo_skia_surface_t *surface = (cairo_skia_surface_t *) asurface; cairo_image_surface_t *image = NULL; cairo_status_t status; void *image_extra; SkColor color; status = _cairo_surface_clipper_set_clip (&surface->clipper, clip); if (unlikely (status)) return (cairo_int_status_t) status; if (pattern_to_sk_color (source, color)) { surface->canvas->drawColor (color, operator_to_sk (op)); return CAIRO_INT_STATUS_SUCCESS; } SkMatrix bitmapMatrix; SkBitmap *bitmap = pattern_to_sk_bitmap (surface, source, &bitmapMatrix, &image, &image_extra); SkShader *shader = NULL; if (!bitmap) shader = pattern_to_sk_shader (surface, source, &image, &image_extra); if (!bitmap && !shader) return UNSUPPORTED("pattern to bitmap and shader conversion"); SkPaint paint; paint.setFilterBitmap (pattern_filter_to_sk (source)); paint.setXfermodeMode (operator_to_sk (op)); if (shader) { paint.setShader (shader); surface->canvas->drawPaint (paint); } else { surface->canvas->drawBitmapMatrix (*bitmap, bitmapMatrix, &paint); } if (bitmap) delete bitmap; if (shader) shader->unref (); if (image != NULL) { _cairo_surface_release_source_image (&surface->base, image, image_extra); } return CAIRO_INT_STATUS_SUCCESS; }
void CommandContext::ClearUAVFloat( ITextureViewD3D12 *pTexView, const float* Color ) { auto *pTexture = ValidatedCast<TextureD3D12Impl>( pTexView->GetTexture() ); TransitionResource(pTexture, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, true); // After binding a UAV, we can get a GPU handle that is required to clear it as a UAV (because it essentially runs // a shader to set all of the values). UNSUPPORTED("Not yet implemented"); D3D12_GPU_DESCRIPTOR_HANDLE GpuVisibleHandle = {};//m_DynamicDescriptorHeap.UploadDirect(Target.GetUAV()); m_pCommandList->ClearUnorderedAccessViewFloat(GpuVisibleHandle, pTexView->GetCPUDescriptorHandle(), pTexture->GetD3D12Resource(), Color, 0, nullptr); }
virtual IEmbedFunctionContext * createFunctionContextEx(ICodeContext * ctx, unsigned flags, const char *options) { if (flags & EFimport) { UNSUPPORTED("IMPORT"); return nullptr; } else return new CouchbaseEmbedFunctionContext(ctx ? ctx->queryContextLogger() : queryDummyContextLogger(), options, flags); }
void CommandContext::ClearUAVUint( ITextureViewD3D12 *pTexView, const UINT *Color ) { auto *pTexture = ValidatedCast<TextureD3D12Impl>( pTexView->GetTexture() ); TransitionResource(pTexture, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, true); // After binding a UAV, we can get a GPU handle that is required to clear it as a UAV (because it essentially runs // a shader to set all of the values). UNSUPPORTED("Not yet implemented"); D3D12_GPU_DESCRIPTOR_HANDLE GpuVisibleHandle = {};//m_DynamicDescriptorHeap.UploadDirect(Target.GetUAV()); //CD3DX12_RECT ClearRect(0, 0, (LONG)Target.GetWidth(), (LONG)Target.GetHeight()); //TODO: My Nvidia card is not clearing UAVs with either Float or Uint variants. m_pCommandList->ClearUnorderedAccessViewUint(GpuVisibleHandle, pTexView->GetCPUDescriptorHandle(), pTexture->GetD3D12Resource(), Color, 0, nullptr/*1, &ClearRect*/); }
static cairo_int_status_t _cairo_skia_surface_fill (void *asurface, cairo_operator_t op, const cairo_pattern_t *source, cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, double tolerance, cairo_antialias_t antialias, cairo_clip_t *clip) { cairo_skia_surface_t *surface = (cairo_skia_surface_t *) asurface; cairo_image_surface_t *image = NULL; cairo_status_t status; void *image_extra; status = _cairo_surface_clipper_set_clip (&surface->clipper, clip); if (unlikely (status)) return (cairo_int_status_t) status; SkPaint paint; paint.setStyle (SkPaint::kFill_Style); SkColor color; if (pattern_to_sk_color (source, color)) { paint.setColor (color); } else { SkShader *shader = pattern_to_sk_shader (surface, source, &image, &image_extra); if (shader == NULL) return UNSUPPORTED("pattern to shader conversion"); paint.setShader (shader); shader->unref (); paint.setFilterBitmap (pattern_filter_to_sk (source)); } paint.setXfermodeMode (operator_to_sk (op)); paint.setAntiAlias (antialias != CAIRO_ANTIALIAS_NONE); surface->canvas->drawPath (path_to_sk (path, fill_rule), paint); if (image != NULL) { _cairo_surface_release_source_image (&surface->base, image, image_extra); } return CAIRO_INT_STATUS_SUCCESS; }
cairo_status_t _cairo_gl_composite_init (cairo_gl_composite_t *setup, cairo_operator_t op, cairo_gl_surface_t *dst, cairo_bool_t assume_component_alpha) { memset (setup, 0, sizeof (cairo_gl_composite_t)); if (assume_component_alpha) { if (op != CAIRO_OPERATOR_CLEAR && op != CAIRO_OPERATOR_OVER && op != CAIRO_OPERATOR_ADD) return (cairo_status_t)UNSUPPORTED ("unsupported component alpha operator"); } else { if (! _cairo_gl_operator_is_supported (op)) return (cairo_status_t)UNSUPPORTED ("unsupported operator"); } setup->dst = dst; setup->op = op; setup->clip_region = dst->clip_region; return CAIRO_STATUS_SUCCESS; }
cairo_int_status_t _cairo_gl_surface_composite_trapezoids (cairo_operator_t op, const cairo_pattern_t *pattern, void *abstract_dst, cairo_antialias_t antialias, int src_x, int src_y, int dst_x, int dst_y, unsigned int width, unsigned int height, cairo_trapezoid_t *traps, int num_traps, cairo_region_t *clip_region) { cairo_gl_surface_t *dst = abstract_dst; cairo_surface_pattern_t traps_pattern; cairo_int_status_t status; if (! _cairo_gl_operator_is_supported (op)) return UNSUPPORTED ("unsupported operator"); status = _cairo_gl_surface_deferred_clear (dst); if (unlikely (status)) return status; status = _cairo_gl_get_traps_pattern (dst, dst_x, dst_y, width, height, traps, num_traps, antialias, &traps_pattern); if (unlikely (status)) return status; status = _cairo_gl_surface_composite (op, pattern, &traps_pattern.base, dst, src_x, src_y, 0, 0, dst_x, dst_y, width, height, clip_region); _cairo_pattern_fini (&traps_pattern.base); assert (status != CAIRO_INT_STATUS_UNSUPPORTED); return status; }
static int validate_args(args_t * args) { assert(args != NULL); if (args->cmd == c_ERROR) { usage(false); UNEXPECTED("no command specified, please " "see --help for details\n"); return -1; } if (args->poffset == NULL) { UNEXPECTED("--partition-offset is required for all '%s' " "commands", args->short_name); return -1; } if (args->target == NULL) { UNEXPECTED("--target is required for all '%s' commands", args->short_name); return -1; } #define REQUIRED(name,cmd) ({ \ if (args->name == NULL) { \ UNEXPECTED("--%s is required for the --%s command", \ #name, #cmd); \ return -1; \ } \ }) #define UNSUPPORTED(name,cmd) ({ \ if (args->name != NULL) { \ UNEXPECTED("--%s is unsupported for the --%s command", \ #name, #cmd); \ return -1; \ } \ }) if (args->cmd == c_CREATE) { REQUIRED(size, create); REQUIRED(block, create); REQUIRED(target, create); UNSUPPORTED(offset, create); UNSUPPORTED(flags, create); UNSUPPORTED(value, create); UNSUPPORTED(pad, create); } else if (args->cmd == c_ADD) { REQUIRED(name, add); REQUIRED(flags, add); if (args->logical != f_LOGICAL) { REQUIRED(size, add); REQUIRED(offset, add); } UNSUPPORTED(block, add); UNSUPPORTED(value, add); } else if (args->cmd == c_DELETE) { REQUIRED(name, delete); UNSUPPORTED(size, delete); UNSUPPORTED(offset, delete); UNSUPPORTED(block, delete); UNSUPPORTED(flags, delete); UNSUPPORTED(value, delete); UNSUPPORTED(pad, delete); } else if (args->cmd == c_LIST) {
virtual bool processBeginDataset(const RtlFieldInfo * field, unsigned numRows) { UNSUPPORTED("Nested datasets"); return false; }
virtual void bindDatasetParam(const char *name, IOutputMetaData & metaVal, IRowStream * val) { UNSUPPORTED("Dataset parameters"); // Should support... }
virtual void bindSetParam(const char *name, int elemType, size32_t elemSize, bool isAll, size32_t totalBytes, void *setData) { UNSUPPORTED("SET parameters"); }
virtual void getSetResult(bool & __isAllResult, size32_t & __resultBytes, void * & __result, int elemType, size32_t elemSize) { UNSUPPORTED("SET results"); }
virtual void bindRowParam(const char *name, IOutputMetaData & metaVal, byte *val) { UNSUPPORTED("Row parameters"); // Probably SHOULD support - see MySQL plugin }
virtual void processBeginDataset(const RtlFieldInfo * field) { UNSUPPORTED("Nested datasets"); }
cairo_int_status_t _cairo_gl_surface_show_glyphs (void *abstract_dst, cairo_operator_t op, const cairo_pattern_t *source, cairo_glyph_t *glyphs, int num_glyphs, cairo_scaled_font_t *scaled_font, cairo_clip_t *clip, int *remaining_glyphs) { cairo_gl_surface_t *dst = abstract_dst; cairo_rectangle_int_t surface_extents; cairo_rectangle_int_t extents; cairo_region_t *clip_region = NULL; cairo_solid_pattern_t solid_pattern; cairo_bool_t overlap, use_mask = FALSE; cairo_status_t status; if (! GLEW_ARB_vertex_buffer_object) return UNSUPPORTED ("requires ARB_vertex_buffer_object"); if (! _cairo_gl_operator_is_supported (op)) return UNSUPPORTED ("unsupported operator"); if (! _cairo_operator_bounded_by_mask (op)) use_mask |= TRUE; /* For CLEAR, cairo's rendering equation (quoting Owen's description in: * http://lists.cairographics.org/archives/cairo/2005-August/004992.html) * is: * mask IN clip ? src OP dest : dest * or more simply: * mask IN CLIP ? 0 : dest * * where the ternary operator A ? B : C is (A * B) + ((1 - A) * C). * * The model we use in _cairo_gl_set_operator() is Render's: * src IN mask IN clip OP dest * which would boil down to: * 0 (bounded by the extents of the drawing). * * However, we can do a Render operation using an opaque source * and DEST_OUT to produce: * 1 IN mask IN clip DEST_OUT dest * which is * mask IN clip ? 0 : dest */ if (op == CAIRO_OPERATOR_CLEAR) { _cairo_pattern_init_solid (&solid_pattern, CAIRO_COLOR_WHITE, CAIRO_CONTENT_COLOR); source = &solid_pattern.base; op = CAIRO_OPERATOR_DEST_OUT; } /* For SOURCE, cairo's rendering equation is: * (mask IN clip) ? src OP dest : dest * or more simply: * (mask IN clip) ? src : dest. * * If we just used the Render equation, we would get: * (src IN mask IN clip) OP dest * or: * (src IN mask IN clip) bounded by extents of the drawing. * * The trick is that for GL blending, we only get our 4 source values * into the blender, and since we need all 4 components of source, we * can't also get the mask IN clip into the blender. But if we did * two passes we could make it work: * dest = (mask IN clip) DEST_OUT dest * dest = src IN mask IN clip ADD dest * * But for now, composite via an intermediate mask. */ if (op == CAIRO_OPERATOR_SOURCE) use_mask |= TRUE; /* XXX we don't need ownership of the font as we use a global * glyph cache -- but we do need scaled_glyph eviction notification. :-( */ if (! _cairo_gl_surface_owns_font (dst, scaled_font)) return UNSUPPORTED ("do not control font"); /* If the glyphs overlap, we need to build an intermediate mask rather * then perform the compositing directly. */ status = _cairo_scaled_font_glyph_device_extents (scaled_font, glyphs, num_glyphs, &extents, &overlap); if (unlikely (status)) return status; use_mask |= overlap; if (clip != NULL) { status = _cairo_clip_get_region (clip, &clip_region); /* the empty clip should never be propagated this far */ assert (status != CAIRO_INT_STATUS_NOTHING_TO_DO); if (unlikely (_cairo_status_is_error (status))) return status; use_mask |= status == CAIRO_INT_STATUS_UNSUPPORTED; if (! _cairo_rectangle_intersect (&extents, _cairo_clip_get_extents (clip))) goto EMPTY; } surface_extents.x = surface_extents.y = 0; surface_extents.width = dst->width; surface_extents.height = dst->height; if (! _cairo_rectangle_intersect (&extents, &surface_extents)) goto EMPTY; if (use_mask) { return _cairo_gl_surface_show_glyphs_via_mask (dst, op, source, glyphs, num_glyphs, &extents, scaled_font, clip, remaining_glyphs); } return _render_glyphs (dst, extents.x, extents.y, op, source, glyphs, num_glyphs, &extents, scaled_font, clip_region, remaining_glyphs); EMPTY: *remaining_glyphs = 0; if (! _cairo_operator_bounded_by_mask (op)) return _cairo_surface_paint (&dst->base, op, source, clip); else return CAIRO_STATUS_SUCCESS; }
SANE_Status sanei_hp_device_probe_model (enum hp_device_compat_e *compat, HpScsi scsi, int *model_num, const char **model_name) { static struct { HpScl cmd; int model_num; const char * model; enum hp_device_compat_e flag; } probes[] = { { SCL_HP_MODEL_1, 1, "ScanJet Plus", HP_COMPAT_PLUS }, { SCL_HP_MODEL_2, 2, "ScanJet IIc", HP_COMPAT_2C }, { SCL_HP_MODEL_3, 3, "ScanJet IIp", HP_COMPAT_2P }, { SCL_HP_MODEL_4, 4, "ScanJet IIcx", HP_COMPAT_2CX }, { SCL_HP_MODEL_5, 5, "ScanJet 3c/4c/6100C", HP_COMPAT_4C }, { SCL_HP_MODEL_6, 6, "ScanJet 3p", HP_COMPAT_3P }, { SCL_HP_MODEL_8, 8, "ScanJet 4p", HP_COMPAT_4P }, { SCL_HP_MODEL_9, 9, "ScanJet 5p/4100C/5100C", HP_COMPAT_5P }, { SCL_HP_MODEL_10,10,"PhotoSmart Photo Scanner", HP_COMPAT_PS }, { SCL_HP_MODEL_11,11,"OfficeJet 1150C", HP_COMPAT_OJ_1150C }, { SCL_HP_MODEL_12,12,"OfficeJet 1170C or later", HP_COMPAT_OJ_1170C }, { SCL_HP_MODEL_14,14,"ScanJet 62x0C", HP_COMPAT_6200C }, { SCL_HP_MODEL_16,15,"ScanJet 5200C", HP_COMPAT_5200C }, { SCL_HP_MODEL_17,17,"ScanJet 63x0C", HP_COMPAT_6300C } }; int i; char buf[8]; SANE_Status status; static char *last_device = NULL; static enum hp_device_compat_e last_compat; static int last_model_num = -1; static const char *last_model_name = "Model Unknown"; assert(scsi); DBG(1, "probe_scanner: Probing %s\n", sanei_hp_scsi_devicename (scsi)); if (last_device != NULL) /* Look if we already probed the device */ { if (strcmp (last_device, sanei_hp_scsi_devicename (scsi)) == 0) { DBG(3, "probe_scanner: use cached compatibility flags\n"); *compat = last_compat; if (model_num) *model_num = last_model_num; if (model_name) *model_name = last_model_name; return SANE_STATUS_GOOD; } sanei_hp_free (last_device); last_device = NULL; } *compat = 0; last_model_num = -1; last_model_name = "Model Unknown"; for (i = 0; i < (int)(sizeof(probes)/sizeof(probes[0])); i++) { DBG(1,"probing %s\n",probes[i].model); if (!FAILED( status = sanei_hp_scl_upload(scsi, probes[i].cmd, buf, sizeof(buf)) )) { DBG(1, "probe_scanner: %s compatible (%5s)\n", probes[i].model, buf); last_model_name = probes[i].model; /* Some scanners have different responses */ if (probes[i].model_num == 9) { if (strncmp (buf, "5110A", 5) == 0) last_model_name = "ScanJet 5p"; else if (strncmp (buf, "5190A", 5) == 0) last_model_name = "ScanJet 5100C"; else if (strncmp (buf, "6290A", 5) == 0) last_model_name = "ScanJet 4100C"; } *compat |= probes[i].flag; last_model_num = probes[i].model_num; } else if (!UNSUPPORTED( status )) return status; /* SCL inquiry failed */ } /* Save values for next call */ last_device = sanei_hp_strdup (sanei_hp_scsi_devicename (scsi)); last_compat = *compat; if (model_num) *model_num = last_model_num; if (model_name) *model_name = last_model_name; return SANE_STATUS_GOOD; }
virtual bool processBeginSet(const RtlFieldInfo * field, unsigned numElements, bool isAll, const byte *data) { UNSUPPORTED("SET fields"); return false; }
static cairo_int_status_t _cairo_skia_surface_stroke (void *asurface, cairo_operator_t op, const cairo_pattern_t *source, cairo_path_fixed_t *path, cairo_stroke_style_t *style, cairo_matrix_t *ctm, cairo_matrix_t *ctm_inverse, double tolerance, cairo_antialias_t antialias, cairo_clip_t *clip) { cairo_skia_surface_t *surface = (cairo_skia_surface_t *) asurface; cairo_image_surface_t *image = NULL; cairo_status_t status; void *image_extra; status = _cairo_surface_clipper_set_clip (&surface->clipper, clip); if (unlikely (status)) return (cairo_int_status_t) status; SkPaint paint; paint.setStyle (SkPaint::kStroke_Style); SkColor color; if (pattern_to_sk_color (source, color)) { paint.setColor (color); } else { SkShader *shader = pattern_to_sk_shader (surface, source, &image, &image_extra); if (shader == NULL) return UNSUPPORTED("pattern to shader conversion"); paint.setShader (shader); shader->unref (); paint.setFilterBitmap (pattern_filter_to_sk (source)); } paint.setXfermodeMode (operator_to_sk (op)); paint.setAntiAlias (antialias != CAIRO_ANTIALIAS_NONE); /* Convert the various stroke rendering bits */ paint.setStrokeWidth (SkFloatToScalar (style->line_width)); paint.setStrokeMiter (SkFloatToScalar (style->miter_limit)); static const SkPaint::Cap capMap[] = { SkPaint::kButt_Cap, SkPaint::kRound_Cap, SkPaint::kSquare_Cap }; paint.setStrokeCap (capMap[style->line_cap]); static const SkPaint::Join joinMap[] = { SkPaint::kMiter_Join, SkPaint::kRound_Join, SkPaint::kBevel_Join }; paint.setStrokeJoin (joinMap[style->line_join]); /* If we have a dash pattern, we need to * create a SkDashPathEffect and set it on the Paint. */ if (style->dash != NULL) { SkScalar intervals_static[20]; SkScalar *intervals = intervals_static; int loop = 0; unsigned int dash_count = style->num_dashes; if ((dash_count & 1) != 0) { loop = 1; dash_count <<= 1; } if (dash_count > 20) intervals = new SkScalar[dash_count]; unsigned int i = 0; do { for (unsigned int j = 0; i < style->num_dashes; j++) intervals[i++] = SkFloatToScalar (style->dash[j]); } while (loop--); SkDashPathEffect *dash = new SkDashPathEffect (intervals, dash_count, SkFloatToScalar (style->dash_offset)); paint.setPathEffect (dash); dash->unref (); } surface->canvas->save (SkCanvas::kMatrix_SaveFlag); surface->canvas->concat (matrix_to_sk (*ctm)); surface->canvas->drawPath (path_to_sk (path, ctm_inverse), paint); surface->canvas->restore (); if (image != NULL) { _cairo_surface_release_source_image (&surface->base, image, image_extra); } return CAIRO_INT_STATUS_SUCCESS; }
virtual void processBeginSet(const RtlFieldInfo * field, bool &isAll) { UNSUPPORTED("SET fields"); }
static VALUE ptrace_getsiginfo(VALUE self) { UNSUPPORTED(); return Qnil; }