Don't make dst copies when color stage requires dst but color writes are disabled.
R=robertphillips@google.com Review URL: https://codereview.chromium.org/15001035 git-svn-id: http://skia.googlecode.com/svn/trunk@9146 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
cefd981a4c
commit
d09ab84678
@ -973,12 +973,14 @@ void GrContext::drawRRect(const GrPaint& paint,
|
||||
GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
|
||||
GrDrawState::AutoStageDisable atr(fDrawState);
|
||||
|
||||
bool prAA = paint.isAntiAlias() && !this->getRenderTarget()->isMultisampled();
|
||||
bool useAA = paint.isAntiAlias() &&
|
||||
!this->getRenderTarget()->isMultisampled() &&
|
||||
!disable_coverage_aa_for_blend(target);
|
||||
|
||||
if (!fOvalRenderer->drawSimpleRRect(target, this, prAA, rect, stroke)) {
|
||||
if (!fOvalRenderer->drawSimpleRRect(target, this, useAA, rect, stroke)) {
|
||||
SkPath path;
|
||||
path.addRRect(rect);
|
||||
this->internalDrawPath(target, prAA, path, stroke);
|
||||
this->internalDrawPath(target, useAA, path, stroke);
|
||||
}
|
||||
}
|
||||
|
||||
@ -991,7 +993,9 @@ void GrContext::drawOval(const GrPaint& paint,
|
||||
GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW);
|
||||
GrDrawState::AutoStageDisable atr(fDrawState);
|
||||
|
||||
bool useAA = paint.isAntiAlias() && !this->getRenderTarget()->isMultisampled();
|
||||
bool useAA = paint.isAntiAlias() &&
|
||||
!this->getRenderTarget()->isMultisampled() &&
|
||||
!disable_coverage_aa_for_blend(target);
|
||||
|
||||
if (!fOvalRenderer->drawOval(target, this, useAA, oval, stroke)) {
|
||||
SkPath path;
|
||||
|
@ -163,6 +163,16 @@ bool GrDrawState::validateVertexAttribs() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrDrawState::willEffectReadDstColor() const {
|
||||
int startStage = this->isColorWriteDisabled() ? this->getFirstCoverageStage() : 0;
|
||||
for (int s = startStage; s < kNumStages; ++s) {
|
||||
if (this->isStageEnabled(s) && (*this->getStage(s).getEffect())->willReadDstColor()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool GrDrawState::srcAlphaWillBeOne() const {
|
||||
|
@ -451,14 +451,7 @@ public:
|
||||
/**
|
||||
* Checks whether any of the effects will read the dst pixel color.
|
||||
*/
|
||||
bool willEffectReadDstColor() const {
|
||||
for (int s = 0; s < kNumStages; ++s) {
|
||||
if (this->isStageEnabled(s) && (*this->getStage(s).getEffect())->willReadDstColor()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool willEffectReadDstColor() const;
|
||||
|
||||
/// @}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user