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;
}
Пример #2
0
 void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
     // Handle any color overrides
     if (!overrides.readsColor()) {
         fColor = GrColor_ILLEGAL;
     }
     overrides.getOverrideColorIfSet(&fColor);
     fPipelineInfo = overrides;
 }
Пример #3
0
    void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
        // Handle any color overrides
        if (!overrides.readsColor()) {
            fColor = GrColor_ILLEGAL;
        }
        overrides.getOverrideColorIfSet(&fColor);

        // setup batch properties
        fUsesLocalCoords = overrides.readsLocalCoords();
    }
Пример #4
0
    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();
    }
    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();
    }
Пример #6
0
void GrDrawAtlasBatch::initBatchTracker(const GrXPOverridesForBatch& overrides) {
    SkASSERT(fGeoData.count() == 1);
    // Handle any color overrides
    if (!overrides.readsColor()) {
        fGeoData[0].fColor = GrColor_ILLEGAL;
    }
    if (overrides.getOverrideColorIfSet(&fGeoData[0].fColor) && fHasColors) {
        size_t vertexStride = sizeof(SkPoint) + sizeof(SkPoint) +
                             (this->hasColors() ? sizeof(GrColor) : 0);
        uint8_t* currVertex = fGeoData[0].fVerts.begin();
        for (int i = 0; i < 4*fQuadCount; ++i) {
            *(reinterpret_cast<GrColor*>(currVertex + sizeof(SkPoint))) = fGeoData[0].fColor;
            currVertex += vertexStride;
        }
    }

    // setup batch properties
    fColorIgnored = !overrides.readsColor();
    fColor = fGeoData[0].fColor;
    // We'd like to assert this, but we can't because of GLPrograms test
    //SkASSERT(init.readsLocalCoords());
    fCoverageIgnored = !overrides.readsCoverage();
}
Пример #7
0
 void initBatchTracker(const GrXPOverridesForBatch& overrides) override {
     overrides.getOverrideColorIfSet(&fGeoData[0].fColor);
     fOverrides = overrides;
 }