Rename GrBWFillRectBatch to GrNonAAFillRectBAtch
TBR=bsalomon@google.com BUG=skia: Review URL: https://codereview.chromium.org/1319733002
This commit is contained in:
parent
4bf69f7bbc
commit
bcf33d5c06
@ -223,8 +223,6 @@
|
||||
'<(skia_src_path)/gpu/batches/GrAAFillRectBatch.h',
|
||||
'<(skia_src_path)/gpu/batches/GrAAStrokeRectBatch.cpp',
|
||||
'<(skia_src_path)/gpu/batches/GrAAStrokeRectBatch.h',
|
||||
'<(skia_src_path)/gpu/batches/GrBWFillRectBatch.h',
|
||||
'<(skia_src_path)/gpu/batches/GrBWFillRectBatch.cpp',
|
||||
'<(skia_src_path)/gpu/batches/GrBatch.cpp',
|
||||
'<(skia_src_path)/gpu/batches/GrBatch.h',
|
||||
'<(skia_src_path)/gpu/batches/GrClearBatch.h',
|
||||
@ -238,6 +236,8 @@
|
||||
'<(skia_src_path)/gpu/batches/GrDrawPathBatch.h',
|
||||
'<(skia_src_path)/gpu/batches/GrDrawVerticesBatch.cpp',
|
||||
'<(skia_src_path)/gpu/batches/GrDrawVerticesBatch.h',
|
||||
'<(skia_src_path)/gpu/batches/GrNonAAFillRectBatch.h',
|
||||
'<(skia_src_path)/gpu/batches/GrNonAAFillRectBatch.cpp',
|
||||
'<(skia_src_path)/gpu/batches/GrRectBatchFactory.h',
|
||||
'<(skia_src_path)/gpu/batches/GrRectBatchFactory.cpp',
|
||||
'<(skia_src_path)/gpu/batches/GrStrokeRectBatch.cpp',
|
||||
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "GrBWFillRectBatch.h"
|
||||
#include "GrNonAAFillRectBatch.h"
|
||||
|
||||
#include "GrBatchFlushState.h"
|
||||
#include "GrColor.h"
|
||||
@ -17,7 +17,7 @@
|
||||
#include "GrVertexBatch.h"
|
||||
|
||||
// Common functions
|
||||
class BWFillRectBatchBase {
|
||||
class NonAAFillRectBatchBase {
|
||||
public:
|
||||
static const int kVertsPerInstance = 4;
|
||||
static const int kIndicesPerInstance = 6;
|
||||
@ -84,14 +84,14 @@ static void tesselate(intptr_t vertices,
|
||||
|
||||
if (!viewMatrix.hasPerspective()) {
|
||||
viewMatrix.mapPointsWithStride(positions, vertexStride,
|
||||
BWFillRectBatchBase::kVertsPerInstance);
|
||||
NonAAFillRectBatchBase::kVertsPerInstance);
|
||||
}
|
||||
|
||||
// Setup local coords
|
||||
// TODO we should only do this if local coords are being read
|
||||
if (localQuad) {
|
||||
static const int kLocalOffset = sizeof(SkPoint) + sizeof(GrColor);
|
||||
for (int i = 0; i < BWFillRectBatchBase::kVertsPerInstance; i++) {
|
||||
for (int i = 0; i < NonAAFillRectBatchBase::kVertsPerInstance; i++) {
|
||||
SkPoint* coords = reinterpret_cast<SkPoint*>(vertices + kLocalOffset +
|
||||
i * vertexStride);
|
||||
*coords = localQuad->point(i);
|
||||
@ -106,7 +106,7 @@ static void tesselate(intptr_t vertices,
|
||||
}
|
||||
}
|
||||
|
||||
class BWFillRectBatchNoLocalMatrixImp : public BWFillRectBatchBase {
|
||||
class NonAAFillRectBatchImp : public NonAAFillRectBatchBase {
|
||||
public:
|
||||
struct Geometry {
|
||||
SkMatrix fViewMatrix;
|
||||
@ -115,7 +115,7 @@ public:
|
||||
GrColor fColor;
|
||||
};
|
||||
|
||||
static const char* Name() { return "BWFillRectBatchNoLocalMatrix"; }
|
||||
static const char* Name() { return "NonAAFillRectBatch"; }
|
||||
|
||||
static bool CanCombine(const Geometry& mine, const Geometry& theirs,
|
||||
const GrPipelineOptimizations& opts) {
|
||||
@ -139,7 +139,7 @@ public:
|
||||
};
|
||||
|
||||
// We handle perspective in the local matrix or viewmatrix with special batches
|
||||
class BWFillRectBatchPerspectiveImp : public BWFillRectBatchBase {
|
||||
class NonAAFillRectBatchPerspectiveImp : public NonAAFillRectBatchBase {
|
||||
public:
|
||||
struct Geometry {
|
||||
SkMatrix fViewMatrix;
|
||||
@ -151,7 +151,7 @@ public:
|
||||
bool fHasLocalRect;
|
||||
};
|
||||
|
||||
static const char* Name() { return "BWFillRectBatchPerspective"; }
|
||||
static const char* Name() { return "NonAAFillRectBatchPerspective"; }
|
||||
|
||||
static bool CanCombine(const Geometry& mine, const Geometry& theirs,
|
||||
const GrPipelineOptimizations& opts) {
|
||||
@ -184,10 +184,10 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
typedef GrTInstanceBatch<BWFillRectBatchNoLocalMatrixImp> BWFillRectBatchSimple;
|
||||
typedef GrTInstanceBatch<BWFillRectBatchPerspectiveImp> BWFillRectBatchPerspective;
|
||||
typedef GrTInstanceBatch<NonAAFillRectBatchImp> NonAAFillRectBatchSimple;
|
||||
typedef GrTInstanceBatch<NonAAFillRectBatchPerspectiveImp> NonAAFillRectBatchPerspective;
|
||||
|
||||
namespace GrBWFillRectBatch {
|
||||
namespace GrNonAAFillRectBatch {
|
||||
GrDrawBatch* Create(GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect,
|
||||
@ -196,8 +196,8 @@ GrDrawBatch* Create(GrColor color,
|
||||
|
||||
/* Perspective has to be handled in a slow path for now */
|
||||
if (viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspective())) {
|
||||
BWFillRectBatchPerspective* batch = BWFillRectBatchPerspective::Create();
|
||||
BWFillRectBatchPerspective::Geometry& geo = *batch->geometry();
|
||||
NonAAFillRectBatchPerspective* batch = NonAAFillRectBatchPerspective::Create();
|
||||
NonAAFillRectBatchPerspective::Geometry& geo = *batch->geometry();
|
||||
|
||||
geo.fColor = color;
|
||||
geo.fViewMatrix = viewMatrix;
|
||||
@ -215,8 +215,8 @@ GrDrawBatch* Create(GrColor color,
|
||||
return batch;
|
||||
} else {
|
||||
// TODO bubble these up as separate calls
|
||||
BWFillRectBatchSimple* batch = BWFillRectBatchSimple::Create();
|
||||
BWFillRectBatchSimple::Geometry& geo = *batch->geometry();
|
||||
NonAAFillRectBatchSimple* batch = NonAAFillRectBatchSimple::Create();
|
||||
NonAAFillRectBatchSimple::Geometry& geo = *batch->geometry();
|
||||
|
||||
geo.fColor = color;
|
||||
geo.fViewMatrix = viewMatrix;
|
||||
@ -253,8 +253,9 @@ DRAW_BATCH_TEST_DEFINE(RectBatch) {
|
||||
|
||||
bool hasLocalRect = random->nextBool();
|
||||
bool hasLocalMatrix = random->nextBool();
|
||||
return GrBWFillRectBatch::Create(color, viewMatrix, rect, hasLocalRect ? &localRect : nullptr,
|
||||
hasLocalMatrix ? &localMatrix : nullptr);
|
||||
return GrNonAAFillRectBatch::Create(color, viewMatrix, rect,
|
||||
hasLocalRect ? &localRect : nullptr,
|
||||
hasLocalMatrix ? &localMatrix : nullptr);
|
||||
}
|
||||
|
||||
#endif
|
@ -5,8 +5,8 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrBWFillRectBatch_DEFINED
|
||||
#define GrBWFillRectBatch_DEFINED
|
||||
#ifndef GrNonAAFillRectBatch_DEFINED
|
||||
#define GrNonAAFillRectBatch_DEFINED
|
||||
|
||||
#include "GrColor.h"
|
||||
|
||||
@ -14,7 +14,7 @@ class GrDrawBatch;
|
||||
class SkMatrix;
|
||||
struct SkRect;
|
||||
|
||||
namespace GrBWFillRectBatch {
|
||||
namespace GrNonAAFillRectBatch {
|
||||
GrDrawBatch* Create(GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect,
|
@ -9,8 +9,8 @@
|
||||
#define GrRectBatchFactory_DEFINED
|
||||
|
||||
#include "GrAAFillRectBatch.h"
|
||||
#include "GrBWFillRectBatch.h"
|
||||
#include "GrColor.h"
|
||||
#include "GrNonAAFillRectBatch.h"
|
||||
|
||||
class GrBatch;
|
||||
class SkMatrix;
|
||||
@ -27,7 +27,7 @@ inline GrDrawBatch* CreateNonAAFill(GrColor color,
|
||||
const SkRect& rect,
|
||||
const SkRect* localRect,
|
||||
const SkMatrix* localMatrix) {
|
||||
return GrBWFillRectBatch::Create(color, viewMatrix, rect, localRect, localMatrix);
|
||||
return GrNonAAFillRectBatch::Create(color, viewMatrix, rect, localRect, localMatrix);
|
||||
}
|
||||
|
||||
inline GrDrawBatch* CreateAAFill(GrColor color,
|
||||
|
Loading…
Reference in New Issue
Block a user