Sanitizing source files in Skia_Periodic_House_Keeping
git-svn-id: http://skia.googlecode.com/svn/trunk@7939 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
2c00ba3d72
commit
f140f18878
@ -501,7 +501,7 @@ public:
|
||||
T* unflatten(int index) const {
|
||||
// fData is sorted so it is necessary to search through it to find the
|
||||
// SkFlatData with the specified index
|
||||
// TODO: findAndReplace makes it a bit difficult but there must be
|
||||
// TODO: findAndReplace makes it a bit difficult but there must be
|
||||
// a better way to perform this mapping
|
||||
for (int i = 0; i < fData.count(); ++i) {
|
||||
const SkFlatData* element = fData[i];
|
||||
|
@ -67,7 +67,7 @@ SkPictureRecord::~SkPictureRecord() {
|
||||
// this method)
|
||||
static inline uint32_t getPaintOffset(DrawType op, uint32_t opSize) {
|
||||
// These offsets are where the paint would be if the op size doesn't overflow
|
||||
static const uint8_t gPaintOffsets[LAST_DRAWTYPE_ENUM + 1] = {
|
||||
static const uint8_t gPaintOffsets[LAST_DRAWTYPE_ENUM + 1] = {
|
||||
0, // UNUSED - no paint
|
||||
0, // CLIP_PATH - no paint
|
||||
0, // CLIP_REGION - no paint
|
||||
@ -99,13 +99,13 @@ static inline uint32_t getPaintOffset(DrawType op, uint32_t opSize) {
|
||||
0, // RESTORE - no paint
|
||||
0, // ROTATE - no paint
|
||||
0, // SAVE - no paint
|
||||
0, // SAVE_LAYER - see below - this paint's location varies
|
||||
0, // SAVE_LAYER - see below - this paint's location varies
|
||||
0, // SCALE - no paint
|
||||
0, // SET_MATRIX - no paint
|
||||
0, // SKEW - no paint
|
||||
0, // TRANSLATE - no paint
|
||||
0, // NOOP - no paint
|
||||
};
|
||||
};
|
||||
|
||||
SkASSERT(sizeof(gPaintOffsets) == LAST_DRAWTYPE_ENUM + 1);
|
||||
SkASSERT((unsigned)op <= (unsigned)LAST_DRAWTYPE_ENUM);
|
||||
@ -215,7 +215,7 @@ static DrawType peek_op_and_size(SkWriter32* writer, int32_t offset, uint32_t* s
|
||||
|
||||
// Is the supplied paint simply a color?
|
||||
static bool is_simple(const SkPaint& p) {
|
||||
intptr_t orAccum = (intptr_t)p.getPathEffect() |
|
||||
intptr_t orAccum = (intptr_t)p.getPathEffect() |
|
||||
(intptr_t)p.getShader() |
|
||||
(intptr_t)p.getXfermode() |
|
||||
(intptr_t)p.getMaskFilter() |
|
||||
@ -227,14 +227,14 @@ static bool is_simple(const SkPaint& p) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore has just been called (but not recorded), look back at the
|
||||
* Restore has just been called (but not recorded), look back at the
|
||||
* matching save* and see if we are in the configuration:
|
||||
* SAVE_LAYER
|
||||
* DRAW_BITMAP|DRAW_BITMAP_MATRIX|DRAW_BITMAP_NINE|DRAW_BITMAP_RECT_TO_RECT
|
||||
* RESTORE
|
||||
* where the saveLayer's color can be moved into the drawBitmap*'s paint
|
||||
*/
|
||||
static bool remove_save_layer1(SkWriter32* writer, int32_t offset,
|
||||
static bool remove_save_layer1(SkWriter32* writer, int32_t offset,
|
||||
SkPaintDictionary* paintDict) {
|
||||
|
||||
int32_t restoreOffset = (int32_t)writer->size();
|
||||
@ -292,8 +292,8 @@ static bool remove_save_layer1(SkWriter32* writer, int32_t offset,
|
||||
uint32_t* ptr = writer->peek32(saveLayerOffset);
|
||||
*ptr = (*ptr & MASK_24) | (NOOP << 24);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (0 == dbmPaintId) {
|
||||
// In this case just make the DBM* use the saveLayer's paint, kill the saveLayer
|
||||
// and signal the caller (by returning true) to not add the RESTORE op
|
||||
@ -303,7 +303,7 @@ static bool remove_save_layer1(SkWriter32* writer, int32_t offset,
|
||||
SkASSERT(0 == *ptr);
|
||||
*ptr = saveLayerPaintId;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
SkAutoTDelete<SkPaint> saveLayerPaint(paintDict->unflatten(saveLayerPaintId));
|
||||
if (NULL == saveLayerPaint.get() || !is_simple(*saveLayerPaint)) {
|
||||
@ -322,7 +322,7 @@ static bool remove_save_layer1(SkWriter32* writer, int32_t offset,
|
||||
if (NULL == dbmPaint.get() || dbmPaint->getColor() != layerColor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
SkColor newColor = SkColorSetA(dbmPaint->getColor(),
|
||||
SkColorGetA(saveLayerPaint->getColor()));
|
||||
dbmPaint->setColor(newColor);
|
||||
|
@ -13,7 +13,7 @@ SK_DEFINE_INST_COUNT(GrAARectRenderer)
|
||||
|
||||
namespace {
|
||||
|
||||
static void aa_rect_attributes(bool useCoverage, GrAttribBindings* bindings,
|
||||
static void aa_rect_attributes(bool useCoverage, GrAttribBindings* bindings,
|
||||
GrDrawState::AttribIndex* index) {
|
||||
if (useCoverage) {
|
||||
*bindings = GrDrawState::kCoverage_AttribBindingsBit;
|
||||
@ -211,7 +211,7 @@ void GrAARectRenderer::strokeAARect(GrGpu* gpu,
|
||||
this->fillAARect(gpu, target, r, useVertexCoverage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// position + color/coverage
|
||||
static const GrVertexAttrib kVertexAttribs[] = {
|
||||
{kVec2f_GrVertexAttribType, 0},
|
||||
|
@ -72,7 +72,7 @@ const size_t GrDrawState::kVertexAttribSizes[kGrVertexAttribTypeCount] = {
|
||||
sizeof(float), // kFloat_GrVertexAttribType
|
||||
2*sizeof(float), // kVec2_GrVertexAttribType
|
||||
3*sizeof(float), // kVec3_GrVertexAttribType
|
||||
4*sizeof(float), // kVec4_GrVertexAttribType
|
||||
4*sizeof(float), // kVec4_GrVertexAttribType
|
||||
4*sizeof(char) // kCVec4_GrVertexAttribType
|
||||
};
|
||||
|
||||
@ -125,7 +125,7 @@ void GrDrawState::setDefaultVertexAttribs() {
|
||||
static const GrVertexAttrib kPositionAttrib = {kVec2f_GrVertexAttribType, 0};
|
||||
fVertexAttribs.reset();
|
||||
fVertexAttribs.push_back(kPositionAttrib);
|
||||
|
||||
|
||||
fCommon.fAttribBindings = kDefault_AttribBindings;
|
||||
|
||||
fAttribIndices[kPosition_AttribIndex] = 0;
|
||||
@ -152,7 +152,7 @@ void GrDrawState::VertexAttributesUnitTest() {
|
||||
|
||||
GrVertexAttribArray<6> attribs;
|
||||
GrAssert(0 == vertex_size(attribs.begin(), attribs.count()));
|
||||
|
||||
|
||||
GrVertexAttrib currAttrib = {kFloat_GrVertexAttribType, 0};
|
||||
attribs.push_back(currAttrib);
|
||||
GrAssert(sizeof(float) == vertex_size(attribs.begin(), attribs.count()));
|
||||
@ -170,15 +170,15 @@ void GrDrawState::VertexAttributesUnitTest() {
|
||||
GrAssert(4*sizeof(char) + 2*sizeof(float) == vertex_size(attribs.begin(), attribs.count()));
|
||||
currAttrib.set(kVec3f_GrVertexAttribType, attribs[1].fOffset + 2*sizeof(float));
|
||||
attribs.push_back(currAttrib);
|
||||
GrAssert(4*sizeof(char) + 2*sizeof(float) + 3*sizeof(float) ==
|
||||
GrAssert(4*sizeof(char) + 2*sizeof(float) + 3*sizeof(float) ==
|
||||
vertex_size(attribs.begin(), attribs.count()));
|
||||
currAttrib.set(kFloat_GrVertexAttribType, attribs[2].fOffset + 3*sizeof(float));
|
||||
attribs.push_back(currAttrib);
|
||||
GrAssert(4*sizeof(char) + 2*sizeof(float) + 3*sizeof(float) + sizeof(float) ==
|
||||
GrAssert(4*sizeof(char) + 2*sizeof(float) + 3*sizeof(float) + sizeof(float) ==
|
||||
vertex_size(attribs.begin(), attribs.count()));
|
||||
currAttrib.set(kVec4f_GrVertexAttribType, attribs[3].fOffset + sizeof(float));
|
||||
attribs.push_back(currAttrib);
|
||||
GrAssert(4*sizeof(char) + 2*sizeof(float) + 3*sizeof(float) + sizeof(float) + 4*sizeof(float) ==
|
||||
GrAssert(4*sizeof(char) + 2*sizeof(float) + 3*sizeof(float) + sizeof(float) + 4*sizeof(float) ==
|
||||
vertex_size(attribs.begin(), attribs.count()));
|
||||
|
||||
GrAttribBindings tcMask = 0;
|
||||
|
@ -38,7 +38,7 @@ enum GrVertexAttribType {
|
||||
static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1;
|
||||
|
||||
struct GrVertexAttrib {
|
||||
inline void set(GrVertexAttribType type, size_t offset) {
|
||||
inline void set(GrVertexAttribType type, size_t offset) {
|
||||
fType = type; fOffset = offset;
|
||||
}
|
||||
bool operator==(const GrVertexAttrib& other) const {
|
||||
@ -151,21 +151,21 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* The format of vertices is represented as an array of vertex attribute
|
||||
* pair, with each pair representing the type of the attribute and the
|
||||
* offset in the vertex structure (see GrVertexAttrib, above).
|
||||
* The format of vertices is represented as an array of vertex attribute
|
||||
* pair, with each pair representing the type of the attribute and the
|
||||
* offset in the vertex structure (see GrVertexAttrib, above).
|
||||
*
|
||||
* This will only set up the vertex geometry. To bind the attributes in
|
||||
* the shaders, attribute indices and attribute bindings need to be set
|
||||
* the shaders, attribute indices and attribute bindings need to be set
|
||||
* as well.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets vertex attributes for next draw.
|
||||
* Sets vertex attributes for next draw.
|
||||
*
|
||||
* @param attribs the array of vertex attributes to set.
|
||||
* @param attribs the array of vertex attributes to set.
|
||||
* @param count the number of attributes being set.
|
||||
* limited to a count of kVertexAttribCnt.
|
||||
* limited to a count of kVertexAttribCnt.
|
||||
*/
|
||||
void setVertexAttribs(const GrVertexAttrib attribs[], int count);
|
||||
|
||||
@ -175,7 +175,7 @@ public:
|
||||
size_t getVertexSize() const;
|
||||
|
||||
/**
|
||||
* Sets default vertex attributes for next draw.
|
||||
* Sets default vertex attributes for next draw.
|
||||
*
|
||||
* This will also set default vertex attribute indices and bindings
|
||||
*/
|
||||
@ -253,10 +253,10 @@ public:
|
||||
////
|
||||
|
||||
/**
|
||||
* The vertex data used by the current program is represented as a bitfield
|
||||
* of flags. Programs always use positions and may also use texture
|
||||
* coordinates, per-vertex colors, per-vertex coverage and edge data. Each
|
||||
* stage can use the explicit texture coordinates as its input texture
|
||||
* The vertex data used by the current program is represented as a bitfield
|
||||
* of flags. Programs always use positions and may also use texture
|
||||
* coordinates, per-vertex colors, per-vertex coverage and edge data. Each
|
||||
* stage can use the explicit texture coordinates as its input texture
|
||||
* coordinates or it may use the positions as texture coordinates.
|
||||
*/
|
||||
|
||||
@ -342,10 +342,10 @@ public:
|
||||
/**
|
||||
* Vertex attribute indices map the data set in the vertex attribute array
|
||||
* to the bindings specified in the attribute bindings. Each binding type
|
||||
* has an associated index in the attribute array. This index is used to
|
||||
* look up the vertex attribute data from the array, and potentially as the
|
||||
* has an associated index in the attribute array. This index is used to
|
||||
* look up the vertex attribute data from the array, and potentially as the
|
||||
* attribute index if we're binding attributes in GL.
|
||||
*
|
||||
*
|
||||
* Indices which do not have active attribute bindings will be ignored.
|
||||
*/
|
||||
|
||||
@ -367,11 +367,11 @@ public:
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers to set attribute indices. These should match the index in the
|
||||
// current attribute index array.
|
||||
// Helpers to set attribute indices. These should match the index in the
|
||||
// current attribute index array.
|
||||
|
||||
/**
|
||||
* Sets index for next draw. This is used to look up the offset
|
||||
* Sets index for next draw. This is used to look up the offset
|
||||
* from the current vertex attribute array and to bind the attributes.
|
||||
*
|
||||
* @param index the attribute index we're setting
|
||||
@ -1198,7 +1198,7 @@ public:
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < kAttribIndexCount; ++i) {
|
||||
if ((i == kPosition_AttribIndex ||
|
||||
if ((i == kPosition_AttribIndex ||
|
||||
s.fCommon.fAttribBindings & kAttribIndexMasks[i]) &&
|
||||
fAttribIndices[i] != s.fAttribIndices[i]) {
|
||||
return false;
|
||||
@ -1329,7 +1329,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < kAttribIndexCount; ++i) {
|
||||
if ((i == kPosition_AttribIndex ||
|
||||
if ((i == kPosition_AttribIndex ||
|
||||
state.fCommon.fAttribBindings & kAttribIndexMasks[i]) &&
|
||||
fAttribIndices[i] != state.fAttribIndices[i]) {
|
||||
return false;
|
||||
@ -1338,7 +1338,7 @@ public:
|
||||
if (fVertexAttribs.count() != state.fVertexAttribs.count()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < fVertexAttribs.count(); ++i)
|
||||
for (int i = 0; i < fVertexAttribs.count(); ++i)
|
||||
if (fVertexAttribs[i] != state.fVertexAttribs[i]) {
|
||||
return false;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ void GrGLProgram::BuildDesc(const GrDrawState& drawState,
|
||||
desc->fColorAttributeIndex = drawState.getAttribIndex(GrDrawState::kColor_AttribIndex);
|
||||
} else {
|
||||
desc->fColorAttributeIndex = GrDrawState::kColorOverrideAttribIndexValue;
|
||||
}
|
||||
}
|
||||
if (requiresAttributeCoverage) {
|
||||
desc->fCoverageAttributeIndex = drawState.getAttribIndex(GrDrawState::kCoverage_AttribIndex);
|
||||
} else {
|
||||
@ -1015,14 +1015,14 @@ bool GrGLProgram::bindOutputsAttribsAndLinkProgram(const GrGLShaderBuilder& buil
|
||||
builder.positionAttribute().c_str()));
|
||||
GL_CALL(BindAttribLocation(fProgramID, fDesc.fColorAttributeIndex, COL_ATTR_NAME));
|
||||
GL_CALL(BindAttribLocation(fProgramID, fDesc.fCoverageAttributeIndex, COV_ATTR_NAME));
|
||||
|
||||
|
||||
if (fDesc.fAttribBindings & GrDrawState::kEdge_AttribBindingsBit) {
|
||||
GL_CALL(BindAttribLocation(fProgramID, fDesc.fEdgeAttributeIndex, EDGE_ATTR_NAME));
|
||||
}
|
||||
if (GrDrawState::AttributesBindExplicitTexCoords(fDesc.fAttribBindings)) {
|
||||
GL_CALL(BindAttribLocation(fProgramID, fDesc.fTexCoordAttributeIndex, TEX_ATTR_NAME));
|
||||
}
|
||||
|
||||
|
||||
GL_CALL(LinkProgram(fProgramID));
|
||||
|
||||
GrGLint linked = GR_GL_INIT_ZERO;
|
||||
|
@ -224,7 +224,7 @@ void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) {
|
||||
uint32_t usedAttribArraysMask = 0;
|
||||
const GrVertexAttrib* vertexAttrib = this->getDrawState().getVertexAttribs();
|
||||
int vertexAttribCount = this->getDrawState().getVertexAttribCount();
|
||||
for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount;
|
||||
for (int vertexAttribIndex = 0; vertexAttribIndex < vertexAttribCount;
|
||||
++vertexAttribIndex, ++vertexAttrib) {
|
||||
|
||||
usedAttribArraysMask |= (1 << vertexAttribIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user