// It does not reset stage textures/samplers or per-vertex-edge-aa state since
// they aren't used unless the vertex layout references them.
// It also doesn't set the render target.
-void reset_target_state(GrDrawTarget* target){
- GrDrawState* drawState = target->drawState();
+void reset_draw_state(GrDrawState* drawState){
drawState->setViewMatrix(GrMatrix::I());
drawState->setColorFilter(0, SkXfermode::kDst_Mode);
- drawState->disableState(GrDrawState::kDither_StateBit |
- GrDrawState::kHWAntialias_StateBit |
- GrDrawState::kClip_StateBit |
- GrDrawState::kNoColorWrites_StateBit |
- GrDrawState::kEdgeAAConcave_StateBit);
+ drawState->resetStateFlags();
drawState->setEdgeAAData(NULL, 0);
drawState->disableStencil();
drawState->setAlpha(0xFF);
- target->setBlendFunc(kOne_BlendCoeff,
+ drawState->setBlendFunc(kOne_BlendCoeff,
kZero_BlendCoeff);
drawState->setFirstCoverageStage(GrDrawState::kNumStages);
drawState->setDrawFace(GrDrawState::kBoth_DrawFace);
if (NULL != texture) {
GrDrawTarget::AutoStateRestore asr(fGpu);
- reset_target_state(fGpu);
GrDrawState* drawState = fGpu->drawState();
+ reset_draw_state(drawState);
drawState->setRenderTarget(texture->asRenderTarget());
drawState->setTexture(0, clampEntry.texture());
GrAssert(NULL != target);
GrDrawTarget::AutoStateRestore asr(fGpu);
- reset_target_state(fGpu);
GrDrawState* drawState = fGpu->drawState();
+ reset_draw_state(drawState);
drawState->setRenderTarget(target);
GrMatrix matrix;
ASSERT_OWNED_RESOURCE(src);
GrDrawTarget::AutoStateRestore asr(fGpu);
- reset_target_state(fGpu);
GrDrawState* drawState = fGpu->drawState();
+ reset_draw_state(drawState);
drawState->setRenderTarget(dst);
GrSamplerState sampler(GrSamplerState::kClamp_WrapMode,
GrSamplerState::kNearest_Filter);
config, buffer, rowBytes, flags);
GrDrawTarget::AutoStateRestore asr(fGpu);
- reset_target_state(fGpu);
GrDrawState* drawState = fGpu->drawState();
+ reset_draw_state(drawState);
GrMatrix matrix;
matrix.setTranslate(GrIntToScalar(left), GrIntToScalar(top));
} else {
drawState->disableState(GrDrawState::kHWAntialias_StateBit);
}
- target->setBlendFunc(paint.fSrcBlendCoeff, paint.fDstBlendCoeff);
+ drawState->setBlendFunc(paint.fSrcBlendCoeff, paint.fDstBlendCoeff);
drawState->setColorFilter(paint.fColorFilterColor, paint.fColorFilterXfermode);
if (paint.getActiveMaskStageMask() && !target->canApplyCoverage()) {
drawState->setViewMatrix(GrMatrix::I());
drawState->setTexture(0, texture);
drawState->setAlpha(0xFF);
- fGpu->setBlendFunc(kOne_BlendCoeff, kZero_BlendCoeff);
+ drawState->setBlendFunc(kOne_BlendCoeff, kZero_BlendCoeff);
fGpu->drawSimpleRect(rect, NULL, 1 << 0);
}
}
// setup blend so that we get mask * paintColor + (1-mask)*dstColor
drawState->setBlendConstant(fPaint.fColor);
- fDrawTarget->setBlendFunc(kConstC_BlendCoeff, kISC_BlendCoeff);
+ drawState->setBlendFunc(kConstC_BlendCoeff, kISC_BlendCoeff);
// don't modulate by the paint's color in the frag since we're
// already doing it via the blend const.
drawState->setColor(0xffffffff);
} else {
// set back to normal in case we took LCD path previously.
- fDrawTarget->setBlendFunc(fPaint.fSrcBlendCoeff, fPaint.fDstBlendCoeff);
+ drawState->setBlendFunc(fPaint.fSrcBlendCoeff, fPaint.fDstBlendCoeff);
drawState->setColor(fPaint.fColor);
}