void InstancedRendering::Batch::initBatchTracker(const GrXPOverridesForBatch& overrides) { Draw& draw = this->getSingleDraw(); // This will assert if we have > 1 command. SkASSERT(draw.fGeometry.isEmpty()); SkASSERT(SkIsPow2(fInfo.fShapeTypes)); SkASSERT(!fIsTracked); if (kRect_ShapeFlag == fInfo.fShapeTypes) { draw.fGeometry = InstanceProcessor::GetIndexRangeForRect(fInfo.fAntialiasMode); } else if (kOval_ShapeFlag == fInfo.fShapeTypes) { draw.fGeometry = InstanceProcessor::GetIndexRangeForOval(fInfo.fAntialiasMode, this->bounds()); } else { draw.fGeometry = InstanceProcessor::GetIndexRangeForRRect(fInfo.fAntialiasMode); } if (!fParams.empty()) { SkASSERT(fInstancedRendering->fParams.count() < (int)kParamsIdx_InfoMask); // TODO: cleaner. this->getSingleInstance().fInfo |= fInstancedRendering->fParams.count(); fInstancedRendering->fParams.push_back_n(fParams.count(), fParams.begin()); } GrColor overrideColor; if (overrides.getOverrideColorIfSet(&overrideColor)) { SkASSERT(State::kRecordingDraws == fInstancedRendering->fState); this->getSingleInstance().fColor = overrideColor; } fInfo.fUsesLocalCoords = overrides.readsLocalCoords(); fInfo.fCannotTweakAlphaForCoverage = !overrides.canTweakAlphaForCoverage(); fInstancedRendering->fTrackedBatches.addToTail(this); fIsTracked = true; }
void AAStrokeRectBatch::initBatchTracker(const GrXPOverridesForBatch& overrides) { // Handle any color overrides if (!overrides.readsColor()) { fGeoData[0].fColor = GrColor_ILLEGAL; } overrides.getOverrideColorIfSet(&fGeoData[0].fColor); // setup batch properties fBatch.fColorIgnored = !overrides.readsColor(); fBatch.fColor = fGeoData[0].fColor; fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); fBatch.fCoverageIgnored = !overrides.readsCoverage(); fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage(); }
void initBatchTracker(const GrXPOverridesForBatch& overrides) override { // Handle any color overrides if (!overrides.readsColor()) { fGeoData[0].fColor = GrColor_ILLEGAL; } overrides.getOverrideColorIfSet(&fGeoData[0].fColor); // setup batch properties fBatch.fColorIgnored = !overrides.readsColor(); fBatch.fColor = fGeoData[0].fColor; fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); fBatch.fCoverageIgnored = !overrides.readsCoverage(); fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSegmentMasks(); fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage(); }