void GrDrawTarget::drawPaths(int pathCount, const GrPath** paths, const SkMatrix* transforms, SkPath::FillType fill, SkStrokeRec::Style stroke) { SkASSERT(pathCount > 0); SkASSERT(NULL != paths); SkASSERT(NULL != paths[0]); SkASSERT(this->caps()->pathRenderingSupport()); SkASSERT(!SkPath::IsInverseFillType(fill)); const GrDrawState* drawState = &getDrawState(); SkRect devBounds; for (int i = 0; i < pathCount; ++i) { SkRect mappedPathBounds; transforms[i].mapRect(&mappedPathBounds, paths[i]->getBounds()); devBounds.join(mappedPathBounds); } SkMatrix viewM = drawState->getViewMatrix(); viewM.mapRect(&devBounds); GrDeviceCoordTexture dstCopy; if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) { return; } this->onDrawPaths(pathCount, paths, transforms, fill, stroke, dstCopy.texture() ? &dstCopy : NULL); }
void GrDrawTarget::drawPath(const GrPath* path, GrPathRendering::FillType fill) { // TODO: extract portions of checkDraw that are relevant to path rendering. SkASSERT(path); SkASSERT(this->caps()->pathRenderingSupport()); SkRect devBounds = path->getBounds(); SkMatrix viewM = this->drawState()->getViewMatrix(); viewM.mapRect(&devBounds); GrDeviceCoordTexture dstCopy; if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) { return; } this->onDrawPath(path, fill, dstCopy.texture() ? &dstCopy : NULL); }
void GrDrawTarget::drawPaths(const GrPathRange* pathRange, const uint32_t indices[], int count, const float transforms[], PathTransformType transformsType, GrPathRendering::FillType fill) { SkASSERT(this->caps()->pathRenderingSupport()); SkASSERT(pathRange); SkASSERT(indices); SkASSERT(transforms); // Don't compute a bounding box for setupDstReadIfNecessary(), we'll opt // instead for it to just copy the entire dst. Realistically this is a moot // point, because any context that supports NV_path_rendering will also // support NV_blend_equation_advanced. GrDeviceCoordTexture dstCopy; if (!this->setupDstReadIfNecessary(&dstCopy, NULL)) { return; } this->onDrawPaths(pathRange, indices, count, transforms, transformsType, fill, dstCopy.texture() ? &dstCopy : NULL); }
void GrDrawTarget::drawPath(const GrPath* path, SkPath::FillType fill) { // TODO: extract portions of checkDraw that are relevant to path rendering. SkASSERT(NULL != path); SkASSERT(this->caps()->pathRenderingSupport()); const GrDrawState* drawState = &getDrawState(); SkRect devBounds; if (SkPath::IsInverseFillType(fill)) { devBounds = SkRect::MakeWH(SkIntToScalar(drawState->getRenderTarget()->width()), SkIntToScalar(drawState->getRenderTarget()->height())); } else { devBounds = path->getBounds(); } SkMatrix viewM = drawState->getViewMatrix(); viewM.mapRect(&devBounds); GrDeviceCoordTexture dstCopy; if (!this->setupDstReadIfNecessary(&dstCopy, &devBounds)) { return; } this->onDrawPath(path, fill, dstCopy.texture() ? &dstCopy : NULL); }