aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-09 16:10:24 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-09 16:10:24 +0000
commit6b67e21b6549598254c1ffa4243bf32615d90fb6 (patch)
treea8fbac0a84569727856e84d77fa4319050eb5e26 /src
parent8f9cbd62ec108d410b91155dcf6a4789c641246f (diff)
roll more changes from r2830 back in
git-svn-id: http://skia.googlecode.com/svn/trunk@2842 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrContext.cpp23
-rw-r--r--src/gpu/GrDrawTarget.h4
-rw-r--r--src/gpu/GrTextContext.cpp4
3 files changed, 11 insertions, 20 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index f455984313..de36307ae0 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -217,20 +217,15 @@ void gen_stencil_key_values(const GrStencilBuffer* sb,
// 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);
@@ -354,8 +349,8 @@ GrContext::TextureCacheEntry GrContext::createAndLockTexture(TextureKey key,
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());
@@ -1779,8 +1774,8 @@ bool GrContext::internalReadRenderTargetPixels(GrRenderTarget* target,
GrAssert(NULL != target);
GrDrawTarget::AutoStateRestore asr(fGpu);
- reset_target_state(fGpu);
GrDrawState* drawState = fGpu->drawState();
+ reset_draw_state(drawState);
drawState->setRenderTarget(target);
GrMatrix matrix;
@@ -1817,8 +1812,8 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst) {
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);
@@ -1888,8 +1883,8 @@ void GrContext::internalWriteRenderTargetPixels(GrRenderTarget* target,
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));
@@ -1949,7 +1944,7 @@ void GrContext::setPaint(const GrPaint& paint, GrDrawTarget* target) {
} 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()) {
@@ -2155,7 +2150,7 @@ void GrContext::convolve(GrTexture* texture,
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);
}
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 262f72cde2..aabf813058 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -89,10 +89,6 @@ public:
const GrDrawState& getDrawState() const { return fCurrDrawState; }
GrDrawState* drawState() { return &fCurrDrawState; }
- void setBlendFunc(GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff) {
- this->drawState()->setBlendFunc(srcCoeff, dstCoeff);
- }
-
/**
* Shortcut for drawState()->preConcatSamplerMatrices() on all enabled
* stages
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 3b3841b293..48cddabf6d 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -50,13 +50,13 @@ void GrTextContext::flushGlyphs() {
}
// 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);
}