Update shader rect drawing path for r9087 (removal of isIRect "opt")

https://codereview.chromium.org/14972013/

(SkipBuildbotRuns)



git-svn-id: http://skia.googlecode.com/svn/trunk@9089 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2013-05-10 13:16:13 +00:00
parent 18136d1cf2
commit 114eb9e699
2 changed files with 13 additions and 11 deletions

View File

@ -11,11 +11,11 @@
#include "GrRect.h"
#include "GrRefCnt.h"
#include "SkMatrix.h"
class GrGpu;
class GrDrawTarget;
class GrIndexBuffer;
class SkMatrix;
/*
* This class wraps helper functions that draw AA rects (filled & stroked)
@ -46,10 +46,10 @@ public:
#ifdef SHADER_AA_FILL_RECT
if (combinedMatrix.rectStaysRect()) {
this->shaderFillAlignedAARect(gpu, target,
combinedMatrix, devRect);
rect, combinedMatrix);
} else {
this->shaderFillAARect(gpu, target,
rect, combinedMatrix, devRect);
rect, combinedMatrix);
}
#else
this->geometryFillAARect(gpu, target,
@ -85,14 +85,12 @@ private:
void shaderFillAARect(GrGpu* gpu,
GrDrawTarget* target,
const GrRect& rect,
const SkMatrix& combinedMatrix,
const GrRect& devRect);
const SkMatrix& combinedMatrix);
void shaderFillAlignedAARect(GrGpu* gpu,
GrDrawTarget* target,
const GrRect& rect,
const SkMatrix& combinedMatrix,
const GrRect& devRect);
const SkMatrix& combinedMatrix);
typedef GrRefCnt INHERITED;
};

View File

@ -487,8 +487,7 @@ extern const GrVertexAttrib gAAAARectVertexAttribs[] = {
void GrAARectRenderer::shaderFillAARect(GrGpu* gpu,
GrDrawTarget* target,
const GrRect& rect,
const SkMatrix& combinedMatrix,
const GrRect& devRect) {
const SkMatrix& combinedMatrix) {
GrDrawState* drawState = target->drawState();
SkPoint center = SkPoint::Make(rect.centerX(), rect.centerY());
@ -536,6 +535,9 @@ void GrAARectRenderer::shaderFillAARect(GrGpu* gpu,
verts[i].fWidthHeight.fY = newHeight;
}
SkRect devRect;
combinedMatrix.mapRect(&devRect, rect);
SkRect devBounds = {
devRect.fLeft - SK_ScalarHalf,
devRect.fTop - SK_ScalarHalf,
@ -556,8 +558,7 @@ void GrAARectRenderer::shaderFillAARect(GrGpu* gpu,
void GrAARectRenderer::shaderFillAlignedAARect(GrGpu* gpu,
GrDrawTarget* target,
const GrRect& rect,
const SkMatrix& combinedMatrix,
const GrRect& devRect) {
const SkMatrix& combinedMatrix) {
GrDrawState* drawState = target->drawState();
SkASSERT(combinedMatrix.rectStaysRect());
@ -583,6 +584,9 @@ void GrAARectRenderer::shaderFillAlignedAARect(GrGpu* gpu,
static const int kOffsetIndex = 1;
drawState->setEffect(kEdgeEffectStage, effect, kOffsetIndex)->unref();
SkRect devRect;
combinedMatrix.mapRect(&devRect, rect);
SkRect devBounds = {
devRect.fLeft - SK_ScalarHalf,
devRect.fTop - SK_ScalarHalf,