/** * Software rasterizes path to A8 mask (possibly using the context's matrix) * and uploads the result to a scratch texture. Returns the resulting * texture on success; NULL on failure. */ GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context, const SkPath& path, const SkStrokeRec& stroke, const SkIRect& resultBounds, bool antiAlias, SkMatrix* matrix) { GrSWMaskHelper helper(context); if (!helper.init(resultBounds, matrix)) { return NULL; } helper.draw(path, stroke, SkRegion::kReplace_Op, antiAlias, 0xFF); GrAutoScratchTexture ast; if (!helper.getTexture(&ast)) { return NULL; } helper.toTexture(ast.texture()); return ast.detach(); }
/** * Software rasterizes path to A8 mask (possibly using the context's matrix) * and uploads the result to a scratch texture. Returns the resulting * texture on success; NULL on failure. */ GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context, const SkPath& path, const GrIRect& resultBounds, GrPathFill fill, bool antiAlias, GrMatrix* matrix) { GrAutoScratchTexture ast; GrSWMaskHelper helper(context); if (!helper.init(resultBounds, matrix)) { return NULL; } helper.draw(path, SkRegion::kReplace_Op, fill, antiAlias, 0xFF); if (!helper.getTexture(&ast)) { return NULL; } helper.toTexture(ast.texture(), 0x00); return ast.detach(); }