Remove unused batch rect append functions

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2106283003

Review-Url: https://codereview.chromium.org/2106283003
This commit is contained in:
bsalomon 2016-06-30 13:09:48 -07:00 committed by Commit bot
parent 08d141534c
commit b8cbd20982
4 changed files with 27 additions and 127 deletions

View File

@ -526,27 +526,6 @@ private:
typedef GrVertexBatch INHERITED;
};
inline static void append_to_batch(AAFillRectNoLocalMatrixBatch* batch, GrColor color,
const SkMatrix& viewMatrix, const SkRect& rect,
const SkRect& devRect) {
AAFillRectNoLocalMatrixBatch::Geometry& geo = batch->geoData()->push_back();
geo.fColor = color;
geo.fViewMatrix = viewMatrix;
geo.fRect = rect;
geo.fDevRect = devRect;
}
inline static void append_to_batch(AAFillRectLocalMatrixBatch* batch, GrColor color,
const SkMatrix& viewMatrix, const SkMatrix& localMatrix,
const SkRect& rect, const SkRect& devRect) {
AAFillRectLocalMatrixBatch::Geometry& geo = batch->geoData()->push_back();
geo.fColor = color;
geo.fViewMatrix = viewMatrix;
geo.fLocalMatrix = localMatrix;
geo.fRect = rect;
geo.fDevRect = devRect;
}
namespace GrAAFillRectBatch {
GrDrawBatch* Create(GrColor color,
@ -554,7 +533,11 @@ GrDrawBatch* Create(GrColor color,
const SkRect& rect,
const SkRect& devRect) {
AAFillRectNoLocalMatrixBatch* batch = AAFillRectNoLocalMatrixBatch::Create();
append_to_batch(batch, color, viewMatrix, rect, devRect);
AAFillRectNoLocalMatrixBatch::Geometry& geo = batch->geoData()->push_back();
geo.fColor = color;
geo.fViewMatrix = viewMatrix;
geo.fRect = rect;
geo.fDevRect = devRect;
batch->init();
return batch;
}
@ -565,7 +548,12 @@ GrDrawBatch* Create(GrColor color,
const SkRect& rect,
const SkRect& devRect) {
AAFillRectLocalMatrixBatch* batch = AAFillRectLocalMatrixBatch::Create();
append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect);
AAFillRectLocalMatrixBatch::Geometry& geo = batch->geoData()->push_back();
geo.fColor = color;
geo.fViewMatrix = viewMatrix;
geo.fLocalMatrix = localMatrix;
geo.fRect = rect;
geo.fDevRect = devRect;
batch->init();
return batch;
}
@ -592,27 +580,6 @@ GrDrawBatch* CreateWithLocalRect(GrColor color,
return Create(color, viewMatrix, localMatrix, rect, devRect);
}
void Append(GrBatch* origBatch,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect& devRect) {
AAFillRectNoLocalMatrixBatch* batch = origBatch->cast<AAFillRectNoLocalMatrixBatch>();
append_to_batch(batch, color, viewMatrix, rect, devRect);
batch->updateBoundsAfterAppend();
}
void Append(GrBatch* origBatch,
GrColor color,
const SkMatrix& viewMatrix,
const SkMatrix& localMatrix,
const SkRect& rect,
const SkRect& devRect) {
AAFillRectLocalMatrixBatch* batch = origBatch->cast<AAFillRectLocalMatrixBatch>();
append_to_batch(batch, color, viewMatrix, localMatrix, rect, devRect);
batch->updateBoundsAfterAppend();
}
};
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -36,19 +36,6 @@ GrDrawBatch* CreateWithLocalRect(GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect& localRect);
void Append(GrBatch*,
GrColor,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect& devRect);
void Append(GrBatch*,
GrColor,
const SkMatrix& viewMatrix,
const SkMatrix& localMatrix,
const SkRect& rect,
const SkRect& devRect);
};
#endif

View File

@ -424,9 +424,14 @@ private:
typedef GrVertexBatch INHERITED;
};
inline static void append_to_batch(NonAAFillRectBatch* batch, GrColor color,
const SkMatrix& viewMatrix, const SkRect& rect,
const SkRect* localRect, const SkMatrix* localMatrix) {
namespace GrNonAAFillRectBatch {
GrDrawBatch* Create(GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix) {
NonAAFillRectBatch* batch = NonAAFillRectBatch::Create();
SkASSERT(!viewMatrix.hasPerspective() && (!localMatrix || !localMatrix->hasPerspective()));
NonAAFillRectBatch::Geometry& geo = batch->geoData()->push_back();
@ -443,11 +448,16 @@ inline static void append_to_batch(NonAAFillRectBatch* batch, GrColor color,
} else {
geo.fLocalQuad.set(rect);
}
batch->init();
return batch;
}
inline static void append_to_batch(NonAAFillRectPerspectiveBatch* batch, GrColor color,
const SkMatrix& viewMatrix, const SkRect& rect,
const SkRect* localRect, const SkMatrix* localMatrix) {
GrDrawBatch* CreateWithPerspective(GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix) {
NonAAFillRectPerspectiveBatch* batch = NonAAFillRectPerspectiveBatch::Create();
SkASSERT(viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspective()));
NonAAFillRectPerspectiveBatch::Geometry& geo = batch->geoData()->push_back();
@ -462,68 +472,10 @@ inline static void append_to_batch(NonAAFillRectPerspectiveBatch* batch, GrColor
if (localRect) {
geo.fLocalRect = *localRect;
}
}
namespace GrNonAAFillRectBatch {
GrDrawBatch* Create(GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix) {
NonAAFillRectBatch* batch = NonAAFillRectBatch::Create();
append_to_batch(batch, color, viewMatrix, rect, localRect, localMatrix);
batch->init();
return batch;
}
GrDrawBatch* CreateWithPerspective(GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix) {
NonAAFillRectPerspectiveBatch* batch = NonAAFillRectPerspectiveBatch::Create();
append_to_batch(batch, color, viewMatrix, rect, localRect, localMatrix);
batch->init();
return batch;
}
bool Append(GrBatch* origBatch,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix) {
bool usePerspective = viewMatrix.hasPerspective() ||
(localMatrix && localMatrix->hasPerspective());
if (usePerspective && origBatch->classID() != NonAAFillRectPerspectiveBatch::ClassID()) {
return false;
}
if (!usePerspective) {
NonAAFillRectBatch* batch = origBatch->cast<NonAAFillRectBatch>();
append_to_batch(batch, color, viewMatrix, rect, localRect, localMatrix);
batch->updateBoundsAfterAppend();
} else {
NonAAFillRectPerspectiveBatch* batch = origBatch->cast<NonAAFillRectPerspectiveBatch>();
const NonAAFillRectPerspectiveBatch::Geometry& geo = batch->geoData()->back();
if (!geo.fViewMatrix.cheapEqualTo(viewMatrix) ||
geo.fHasLocalRect != SkToBool(localRect) ||
geo.fHasLocalMatrix != SkToBool(localMatrix) ||
(geo.fHasLocalMatrix && !geo.fLocalMatrix.cheapEqualTo(*localMatrix))) {
return false;
}
append_to_batch(batch, color, viewMatrix, rect, localRect, localMatrix);
batch->updateBoundsAfterAppend();
}
return true;
}
};
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -28,12 +28,6 @@ GrDrawBatch* CreateWithPerspective(GrColor color,
const SkRect* localRect,
const SkMatrix* localMatrix);
bool Append(GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix);
};
#endif