SampleMode getSampleMode() const { return fSampleMode; }
const GrMatrix& getMatrix() const { return fMatrix; }
const GrRect& getTextureDomain() const { return fTextureDomain; }
- const bool hasTextureDomain() const {return SkIntToScalar(0) != fTextureDomain.right();}
+ bool hasTextureDomain() const {return SkIntToScalar(0) != fTextureDomain.right();}
Filter getFilter() const { return fFilter; }
bool isGradient() const {
const GrMatrix& getHWSamplerMatrix(int stage) const {
return fHWDrawState.fSamplerStates[stage].getMatrix();
}
- const void recordHWSamplerMatrix(int stage, const GrMatrix& matrix) {
+ void recordHWSamplerMatrix(int stage, const GrMatrix& matrix) {
fHWDrawState.fSamplerStates[stage].setMatrix(matrix);
}
#include "GrStencil.h"
-const GrStencilSettings GrStencilSettings::gDisabled = {};
+const GrStencilSettings GrStencilSettings::gDisabled = {
+ kKeep_StencilOp, kKeep_StencilOp,
+ kKeep_StencilOp, kKeep_StencilOp,
+ kAlways_StencilFunc, kAlways_StencilFunc,
+ 0x0, 0x0,
+ 0x0, 0x0,
+ 0x0, 0x0
+};
GR_STATIC_ASSERT(0 == kKeep_StencilOp);
GR_STATIC_ASSERT(0 == kAlways_StencilFunc);
p = q;
}
GrDrawTarget::Edge prev_edge = *edges->back();
- for (size_t i = 0; i < edges->count(); ++i) {
+ for (int i = 0; i < edges->count(); ++i) {
GrDrawTarget::Edge edge = edges->at(i);
vertices[i] = prev_edge.intersect(edge);
inverse.mapPoints(&vertices[i], 1);
GrPathFill fill,
const GrPoint* translate) {
GrDrawTarget::AutoStateRestore asr(target);
- bool colorWritesWereDisabled = target->isColorWriteDisabled();
// face culling doesn't make sense here
GrAssert(GrDrawTarget::kBoth_DrawFace == target->getDrawFace());
target->getViewInverse(&inverse);
count = computeEdgesAndOffsetVertices(matrix, inverse, base, count, &edges);
- int maxEdges = target->getMaxEdges();
+ size_t maxEdges = target->getMaxEdges();
if (count <= maxEdges) {
// All edges fit; upload all edges and draw all verts as a fan
target->setVertexSourceToArray(layout, base, count);
for (int sp = 0; sp < subpathCnt; ++sp) {
internal_gluTessBeginContour(tess);
int start = i;
- int end = start + subpathVertCount[sp];
+ size_t end = start + subpathVertCount[sp];
for (; i < end; ++i) {
double* inVertex = &inVertices[i * 3];
*vertices.append() = GrPoint::Make(inVertex[0], inVertex[1]);
for (size_t n = 0; n < GR_ARRAY_COUNT(array); n++) {
for (size_t i = 0; i < n; i++) {
int index = GrTBSearch<int, int>(array, n, array[i]);
- GrAssert(index == i);
+ GrAssert(index == (int) i);
index = GrTBSearch<int, int>(array, n, -array[i]);
GrAssert(index < 0);
}
'cflags': ['-O2']
},
},
+ 'cflags': [ '-Wall', '-Wextra', '-Wno-unused' ]
},
},
],
unsigned g = SkGetPackedG32(c);
unsigned b = SkGetPackedB32(c);
- unsigned x = r * 5 + g * 7 + b * 4 >> 4;
+ unsigned x = (r * 5 + g * 7 + b * 4) >> 4;
return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT));
}
SkScalar dx = SkIntToScalar(80);
SkScalar dy = SkIntToScalar(100);
SkMatrix matrix;
- for (int p = 0; p < SK_ARRAY_COUNT(paints); ++p) {
+ for (size_t p = 0; p < SK_ARRAY_COUNT(paints); ++p) {
for (int stroke = 0; stroke < 2; ++stroke) {
paints[p].setStyle(stroke ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
for (int a = 0; a < 3; ++ a) {
pos2[index].set(SkIntToScalar(index * 10), SkIntToScalar(20));
// shaders
- SkPoint linearPoints[] = { 0, 0, SkIntToScalar(40), SkIntToScalar(40) };
+ SkPoint linearPoints[] = { { 0, 0, }, { SkIntToScalar(40), SkIntToScalar(40) } };
SkColor linearColors[] = { SK_ColorRED, SK_ColorBLUE };
SkScalar* linearPos = NULL;
int linearCount = 2;
}
SkShader* shaderTest() {
- SkPoint pts[] = {0, 0, SkIntToScalar(100), 0 };
+ SkPoint pts[] = { { 0, 0, }, { SkIntToScalar(100), 0 } };
SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
SkShader* shaderA = SkGradientShader::CreateLinear(pts, colors, NULL,
2, SkShader::kClamp_TileMode);
}
void drawRaster(SkCanvas* canvas) {
- for (int index = 0; index < SK_ARRAY_COUNT(gRastProcs); index++)
+ for (size_t index = 0; index < SK_ARRAY_COUNT(gRastProcs); index++)
drawOneRaster(canvas);
}
SkString str("GOOGLE");
- for (int i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
apply_shader(&paint, i);
// paint.setMaskFilter(NULL);
225, 90
};
- for (int i = 0; i < SK_ARRAY_COUNT(gAngles); i += 2) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gAngles); i += 2) {
paint.setColor(SK_ColorBLACK);
drawRectWithLines(canvas, r, paint);
SK_ARRAY_COUNT(colors),
SkShader::kMirror_TileMode);
#else
- SkPoint pts[] = { SkIntToScalar(W)/2, SkIntToScalar(H)/2 };
+ SkPoint pts[] = { { SkIntToScalar(W)/2, SkIntToScalar(H)/2 } };
fShader = SkGradientShader::CreateRadial(pts[0], SkIntToScalar(H)/5,
colors, NULL,
SK_ARRAY_COUNT(colors),
canvas.drawColor(SK_ColorRED);
SkPaint paint;
paint.setAntiAlias(true);
- const SkPoint pts[] = { 0, 0, 64, 64 };
+ const SkPoint pts[] = { { 0, 0 }, { 64, 64 } };
const SkColor colors[] = { SK_ColorWHITE, SK_ColorBLUE };
paint.setShader(SkGradientShader::CreateLinear(pts, colors, NULL, 2,
SkShader::kClamp_TileMode))->unref();
canvas->save();
for (int invA = 0; invA < 2; ++invA) {
- for (int op = 0; op < SK_ARRAY_COUNT(gOps); ++op) {
+ for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); ++op) {
int idx = invA * SK_ARRAY_COUNT(gOps) + op;
if (!(idx % 3)) {
canvas->restore();
static void draw_gradient(SkCanvas* canvas) {
SkRect r = { 0, 0, SkIntToScalar(256), SkIntToScalar(32) };
- SkPoint pts[] = { r.fLeft, r.fTop, r.fRight, r.fTop };
+ SkPoint pts[] = { { r.fLeft, r.fTop }, { r.fRight, r.fTop } };
SkColor colors[] = { 0xFF000000, 0xFFFF0000 };
SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2,
SkShader::kClamp_TileMode);
info.fPaintBits = SkLayerDrawLooper::kStyle_Bit | SkLayerDrawLooper::kMaskFilter_Bit;
info.fColorMode = SkXfermode::kSrc_Mode;
- for (int i = 0; i < SK_ARRAY_COUNT(gParams); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gParams); i++) {
info.fOffset.set(gParams[i].fOffset, gParams[i].fOffset);
SkPaint* paint = fLooper->addLayer(info);
paint->setAntiAlias(true);
static void paint_proc3(SkPaint* paint) {
SkColor colors[] = { SK_ColorRED, COLOR, SK_ColorBLUE };
- SkPoint pts[] = { 3, 0, 7, 5 };
+ SkPoint pts[] = { { 3, 0 }, { 7, 5 } };
paint->setShader(SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_COUNT(colors),
SkShader::kMirror_TileMode))->unref();
}
static void make_paint(SkPaint* paint) {
SkColor colors[] = { 0, SK_ColorWHITE };
- SkPoint pts[] = { 0, 0, 0, SK_Scalar1*20 };
+ SkPoint pts[] = { { 0, 0 }, { 0, SK_Scalar1*20 } };
SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, SkShader::kClamp_TileMode);
paint->setShader(s)->unref();
SkPoint fPts[4];
void randPts() {
- for (int i = 0; i < SK_ARRAY_COUNT(fPts); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); i++) {
fPts[i].set(fRand.nextUScalar1() * 640,
fRand.nextUScalar1() * 480);
}
SkRect bounds;
SkPaint p(paint);
- for (int i = 0; i < SK_ARRAY_COUNT(gSettings); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gSettings); i++) {
p.setLinearText(gSettings[i].fLinearText);
p.setDevKernText(gSettings[i].fDevKernText);
SkScalar scale = gSettings[i].fScale;
}
static SkShader* make_shader1(const SkIPoint& size) {
- SkPoint pts[] = { 0, 0, SkIntToScalar(size.fX), SkIntToScalar(size.fY) };
+ SkPoint pts[] = { { 0, 0, },
+ { SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
return SkGradientShader::CreateLinear(pts, colors, NULL,
SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode, NULL);
}
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
- for (int i = 0; i < SK_ARRAY_COUNT(fPts); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); i++) {
if (hittest(fPts[i], x, y)) {
return new PtClick(this, i);
}
SkPaint::kRound_Join
};
- for (int i = 0; i < SK_ARRAY_COUNT(gJoins); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gJoins); i++) {
canvas->save();
- for (int j = 0; j < SK_ARRAY_COUNT(fPath); j++) {
+ for (size_t j = 0; j < SK_ARRAY_COUNT(fPath); j++) {
this->drawPath(canvas, fPath[j], gJoins[i]);
canvas->translate(SkIntToScalar(200), 0);
}
PolyToPolyView() {
// tests
{
- SkPoint src[] = { 0, 0, SK_Scalar1, 0, 0, SK_Scalar1 };
- SkPoint dst[] = { 0, 0, 2*SK_Scalar1, 0, 0, 2*SK_Scalar1 };
+ SkPoint src[] = { { 0, 0 },
+ { SK_Scalar1, 0 },
+ { 0, SK_Scalar1 } };
+ SkPoint dst[] = { { 0, 0 },
+ { 2*SK_Scalar1, 0 },
+ { 0, 2*SK_Scalar1 } };
SkMatrix m1, m2;
bool success;
{
const SkPoint src[] = {
- SkIntToScalar(1), SkIntToScalar(0),
- SkIntToScalar(4), SkIntToScalar(7),
- SkIntToScalar(10), SkIntToScalar(2)
+ { SkIntToScalar(1), SkIntToScalar(0) },
+ { SkIntToScalar(4), SkIntToScalar(7) },
+ { SkIntToScalar(10), SkIntToScalar(2) }
};
const SkPoint dst[] = {
- SkIntToScalar(4), SkIntToScalar(2),
- SkIntToScalar(45), SkIntToScalar(26),
- SkIntToScalar(32), SkIntToScalar(17)
+ { SkIntToScalar(4), SkIntToScalar(2) },
+ { SkIntToScalar(45), SkIntToScalar(26) },
+ { SkIntToScalar(32), SkIntToScalar(17) }
};
SkMatrix m0, m1;
canvas->translate(0, SkIntToScalar(200));
- for (int op = 0; op < SK_ARRAY_COUNT(gOps); op++) {
+ for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); op++) {
canvas->drawText(gOps[op].fName, strlen(gOps[op].fName), SkIntToScalar(75), SkIntToScalar(50), textPaint);
this->drawRgnOped(canvas, gOps[op].fOp, gOps[op].fColor);
SkCanvas canvas(*bm);
SkScalar s = SkIntToScalar(w < h ? w : h);
- SkPoint pts[] = { 0, 0, s, s };
+ SkPoint pts[] = { { 0, 0 }, { s, s } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
SkPaint paint;
}
static SkShader* make_shader1(const SkIPoint& size) {
- SkPoint pts[] = { 0, 0, SkIntToScalar(size.fX), SkIntToScalar(size.fY) };
+ SkPoint pts[] = { { 0, 0 },
+ { SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
return SkGradientShader::CreateLinear(pts, colors, NULL,
SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode, NULL);
paint.setDither(true);
paint.setFilterBitmap(true);
- for (int i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
canvas->save();
paint.setShader(NULL);
paint.setTextSize(75);
paint.setAntiAlias(true);
paint.setColor(SK_ColorBLUE);
- for (int i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
apply_shader(&paint, i);
canvas->drawText(str, len, x, y, paint);
y += 80;
mm = m;
}
- SkDEBUGCODE(int length2 =) paint.breakText(text, length, width, &mm);
+ SkDEBUGCODE(size_t length2 =) paint.breakText(text, length, width, &mm);
SkASSERT(length2 == length);
SkASSERT(mm == width);
}
paint.setTypeface(fFace);
- for (int i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gRastProcs); i++) {
apply_shader(&paint, i);
// paint.setMaskFilter(NULL);
bm->eraseColor(0);
SkCanvas canvas(*bm);
- SkPoint pts[] = { 0, 0, SkIntToScalar(w), SkIntToScalar(h) };
+ SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h) } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
SkPaint paint;
TilingView()
: fLooper(SkIntToScalar(1), SkIntToScalar(2), SkIntToScalar(2),
0x88000000) {
- for (int i = 0; i < SK_ARRAY_COUNT(gConfigs); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); i++) {
makebm(&fTexture[i], gConfigs[i], gWidth, gHeight);
}
}
}
if (textCanvas) {
- for (int kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
- for (int ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
+ for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
+ for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
SkPaint p;
SkString str;
p.setAntiAlias(true);
y += SkIntToScalar(16);
- for (int i = 0; i < SK_ARRAY_COUNT(gConfigs); i++) {
- for (int j = 0; j < SK_ARRAY_COUNT(gFilters); j++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gConfigs); i++) {
+ for (size_t j = 0; j < SK_ARRAY_COUNT(gFilters); j++) {
x = SkIntToScalar(10);
- for (int kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
- for (int ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
+ for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
+ for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
SkPaint paint;
setup(&paint, fTexture[i], gFilters[j], gModes[kx], gModes[ky]);
paint.setDither(true);
}
static SkShader* make_shader1(const SkIPoint& size) {
- SkPoint pts[] = { 0, 0, SkIntToScalar(size.fX), SkIntToScalar(size.fY) };
+ SkPoint pts[] = { { 0, 0 },
+ { SkIntToScalar(size.fX), SkIntToScalar(size.fY) } };
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorRED };
return SkGradientShader::CreateLinear(pts, colors, NULL,
SK_ARRAY_COUNT(colors), SkShader::kMirror_TileMode, NULL);
paint.setDither(true);
paint.setFilterBitmap(true);
- for (int i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
+ for (size_t i = 0; i < SK_ARRAY_COUNT(fRecs); i++) {
canvas->save();
paint.setShader(NULL);
if ((mode == kMode_immediate || mode == kMode_create) && scope == NULL)
return false; // !!! error?
bool enableMe = scope && (scope->hasEnable() || scope->isApply() || scope->isDrawable() == false);
- if (mode == kMode_immediate && enableMe || mode == kMode_create)
+ if ((mode == kMode_immediate && enableMe) || mode == kMode_create)
activate(maker); // for non-drawables like post, prime them here
if (mode == kMode_immediate && enableMe)
fActive->enable();
} else {
SkScriptValue scriptValue;
bool success = target->getProperty(info->propertyIndex(), &scriptValue);
- SkASSERT(success = true);
+ SkASSERT(success == true);
last[0] = scriptValue.fOperand;
scriptValue.fOperand = fActive->fSaveRestore[activeIndex][0];
target->setProperty(info->propertyIndex(), scriptValue);
SkInterpolatorBase::Result interpResult = fActive->fInterpolators[inner]->timeToValues(
innerTime, values.get());
result |= (interpResult != SkInterpolatorBase::kFreezeEnd_Result);
- if ((transition != SkApply::kTransition_reverse && interpResult == SkInterpolatorBase::kFreezeEnd_Result ||
- transition == SkApply::kTransition_reverse && fLastTime == 0) && state.fUnpostedEndEvent) {
+ if (((transition != SkApply::kTransition_reverse && interpResult == SkInterpolatorBase::kFreezeEnd_Result) ||
+ (transition == SkApply::kTransition_reverse && fLastTime == 0)) && state.fUnpostedEndEvent) {
// SkDEBUGF(("interpolate: post on end\n"));
state.fUnpostedEndEvent = false;
maker.postOnEnd(animate, state.fBegin + state.fDuration);
}
return info;
next:
- if (type == SkType_Drawable || type == SkType_Displayable &&
- container->fDisplayable->isDrawable()) {
+ if (type == SkType_Drawable || (type == SkType_Displayable &&
+ container->fDisplayable->isDrawable())) {
rectNext:
if (fParents.count() > 1) {
Parent* parent = fParents.end() - 2;
maker.fEvents.dump(maker);
if ((hasAttr |= (name.size() > 0)) == true)
maker.dump(name.c_str());
- if (displayList > 0 || displayList != 0 && hasAttr == false)
+ if (displayList > 0 || (displayList != 0 && hasAttr == false))
maker.fDisplayList.dump(&maker);
return true;
}
} while (true);
signed char topPrecedence = gPrecedence[compare];
SkASSERT(topPrecedence != -1);
- if (topPrecedence > precedence || topPrecedence == precedence &&
- gOpAttributes[op].fLeftType == kNoType) {
+ if (topPrecedence > precedence || (topPrecedence == precedence &&
+ gOpAttributes[op].fLeftType == kNoType)) {
break;
}
if (processOp() == false)
// check to see that there are no missing or duplicate entries
void SkScriptEngine2::ValidateDecompileTable() {
SkScriptEngine2::TypeOp op = SkScriptEngine2::kNop;
- int index;
+ size_t index;
for (index = 0; index < gOpNamesSize; index++) {
SkASSERT(gOpNames[index].fOp == op);
op = (SkScriptEngine2::TypeOp) (op + 1);
SkASSERT(length > 0);
const unsigned char* opCode = start;
do {
- SkASSERT(opCode - start < length);
+ SkASSERT((size_t)(opCode - start) < length);
SkScriptEngine2::TypeOp op = (SkScriptEngine2::TypeOp) *opCode++;
- SkASSERT(op < gOpNamesSize);
+ SkASSERT((size_t)op < gOpNamesSize);
SkDebugf("%d: %s", opCode - start - 1, gOpNames[op].fName);
switch (op) {
case SkScriptEngine2::kCallback: {
SkOperand2::OpType type;
memcpy(&type, opCode, sizeof(type));
opCode += sizeof(type);
- int index = 0;
+ size_t index = 0;
if (type == 0)
SkDebugf(" type: %s", gOperandNames[index].fName);
else {
goto done;
case SkScriptEngine2::kNop:
SkASSERT(0);
+ default:
+ break;
}
SkDebugf("\n");
} while (true);
goto done;
case SkScriptEngine2::kNop:
SkASSERT(0);
+ default:
+ break;
}
} while (true);
done:
#include "SkOpArray.h"
const SkScriptEngine2::OperatorAttributes SkScriptEngine2::gOpAttributes[] = {
-{ SkOperand2::kNoType },
+{ SkOperand2::kNoType, SkOperand2::kNoType, kNoBias, kResultIsNotBoolean },
{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
- SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString), kTowardsString }, // kAdd
-{ SkOperand2::kS32, SkOperand2::kS32, kNoBias }, // kBitAnd
-{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias }, // kBitNot
-{ SkOperand2::kS32, SkOperand2::kS32, kNoBias }, // kBitOr
+ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString), kTowardsString, kResultIsNotBoolean }, // kAdd
+{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kBitAnd
+{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kBitNot
+{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kBitOr
{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
- SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias }, // kDivide
+ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kDivide
{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar |SkOperand2:: kString), kTowardsNumber,
kResultIsBoolean }, // kEqual
-{ SkOperand2::kS32 }, // kFlipOps
+{ SkOperand2::kS32, SkOperand2::kNoType, kNoBias, kResultIsNotBoolean }, // kFlipOps
{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString),
SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar | SkOperand2::kString), kTowardsNumber,
kResultIsBoolean }, // kGreaterEqual
-{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias }, // kLogicalAnd (really, ToBool)
-{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias }, // kLogicalNot
-{ SkOperand2::kS32, SkOperand2::kS32, kNoBias }, // kLogicalOr
-{ SkOperand2::kNoType, SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias }, // kMinus
+{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kLogicalAnd (really, ToBool)
+{ SkOperand2::kNoType, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kLogicalNot
+{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kLogicalOr
+{ SkOperand2::kNoType, SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kMinus
{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
- SkOperand2::OpType(SkOperand2::kS32 |SkOperand2:: kScalar), kNoBias }, // kModulo
+ SkOperand2::OpType(SkOperand2::kS32 |SkOperand2:: kScalar), kNoBias, kResultIsNotBoolean }, // kModulo
{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
- SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias }, // kMultiply
-{ SkOperand2::kS32, SkOperand2::kS32, kNoBias }, // kShiftLeft
-{ SkOperand2::kS32, SkOperand2::kS32, kNoBias }, // kShiftRight
+ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kMultiply
+{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kShiftLeft
+{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean }, // kShiftRight
{ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar),
- SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias }, // kSubtract
-{ SkOperand2::kS32, SkOperand2::kS32, kNoBias } // kXor
+ SkOperand2::OpType(SkOperand2::kS32 | SkOperand2::kScalar), kNoBias, kResultIsNotBoolean }, // kSubtract
+{ SkOperand2::kS32, SkOperand2::kS32, kNoBias, kResultIsNotBoolean } // kXor
};
#define kBracketPrecedence 16
} while (true);
signed char topPrecedence = gPrecedence[compare];
SkASSERT(topPrecedence != -1);
- if (topPrecedence > precedence || topPrecedence == precedence &&
- gOpAttributes[op].fLeftType == SkOperand2::kNoType) {
+ if (topPrecedence > precedence || (topPrecedence == precedence &&
+ gOpAttributes[op].fLeftType == SkOperand2::kNoType)) {
break;
}
processOp();
fOpStack.pop(&op);
op = (Op) (op & ~kArtificialOp);
const OperatorAttributes* attributes = &gOpAttributes[op];
- SkScriptValue2 value1 = { 0 };
+ SkScriptValue2 value1;
+ memset(&value1, 0, sizeof(SkScriptValue2));
SkScriptValue2 value2;
fValueStack.pop(&value2);
value2.fIsWritten = SkScriptValue2::kUnwritten;
SkScalar SkScriptEngine2::IntToScalar(int32_t s32) {
SkScalar scalar;
- if (s32 == SK_NaN32)
+ if (s32 == (int32_t) SK_NaN32)
scalar = SK_ScalarNaN;
else if (SkAbs32(s32) == SK_MaxS32)
scalar = SkSign32(s32) * SK_ScalarMax;
#ifdef SK_DEBUG
-#define testInt(expression) { #expression, SkOperand2::kS32, expression }
+#define testInt(expression) { #expression, SkOperand2::kS32, expression, 0, NULL }
#ifdef SK_SCALAR_IS_FLOAT
-#define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (float) expression }
-#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, fmodf(exp1, exp2) }
+#define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (float) expression, NULL }
+#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, fmodf(exp1, exp2), NULL }
#else
#ifdef SK_CAN_USE_FLOAT
-#define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (int) ((expression) * 65536.0f) }
-#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, (int) (fmod(exp1, exp2) * 65536.0f) }
+#define testScalar(expression) { #expression, SkOperand2::kScalar, 0, (int) ((expression) * 65536.0f), NULL }
+#define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkOperand2::kScalar, 0, (int) (fmod(exp1, exp2) * 65536.0f), NULL }
#endif
#endif
-#define testTrue(expression) { #expression, SkOperand2::kS32, 1 }
-#define testFalse(expression) { #expression, SkOperand2::kS32, 0 }
+#define testTrue(expression) { #expression, SkOperand2::kS32, 1, 0, NULL }
+#define testFalse(expression) { #expression, SkOperand2::kS32, 0, 0, NULL }
static const SkScriptNAnswer2 scriptTests[] = {
- testInt(1||0&&3),
+ testInt(1||(0&&3)),
#ifdef SK_CAN_USE_FLOAT
testScalar(- -5.5- -1.5),
testScalar(1.0+5),
{ "'123'+\"456\"", SkOperand2::kString, 0, 0, "123456" },
{ "123+\"456\"", SkOperand2::kString, 0, 0, "123456" },
{ "'123'+456", SkOperand2::kString, 0, 0, "123456" },
- { "'123'|\"456\"", SkOperand2::kS32, 123|456 },
- { "123|\"456\"", SkOperand2::kS32, 123|456 },
- { "'123'|456", SkOperand2::kS32, 123|456 },
- { "'2'<11", SkOperand2::kS32, 1 },
- { "2<'11'", SkOperand2::kS32, 1 },
- { "'2'<'11'", SkOperand2::kS32, 0 },
+ { "'123'|\"456\"", SkOperand2::kS32, 123|456, 0, NULL },
+ { "123|\"456\"", SkOperand2::kS32, 123|456, 0, NULL },
+ { "'123'|456", SkOperand2::kS32, 123|456, 0, NULL },
+ { "'2'<11", SkOperand2::kS32, 1, 0, NULL },
+ { "2<'11'", SkOperand2::kS32, 1, 0, NULL },
+ { "'2'<'11'", SkOperand2::kS32, 0, 0, NULL },
testInt(123),
testInt(-345),
testInt(+678),
// logic
testInt(1?2:3),
testInt(0?2:3),
- testInt(1&&2||3),
- testInt(1&&0||3),
- testInt(1&&0||0),
- testInt(1||0&&3),
- testInt(0||0&&3),
- testInt(0||1&&3),
+ testInt((1&&2)||3),
+ testInt((1&&0)||3),
+ testInt((1&&0)||0),
+ testInt(1||(0&&3)),
+ testInt(0||(0&&3)),
+ testInt(0||(1&&3)),
testInt(0&&1?2:3)
#ifdef SK_CAN_USE_FLOAT
- , { "123.5", SkOperand2::kScalar, 0, SkIntToScalar(123) + SK_Scalar1/2 }
+ , { "123.5", SkOperand2::kScalar, 0, SkIntToScalar(123) + SK_Scalar1/2, NULL }
#endif
};
int SkSVGParser::findAttribute(SkSVGBase* element, const char* attrValue,
size_t len, bool isPaint) {
const SkSVGAttribute* attributes;
- int count = element->getAttributes(&attributes);
- int result = 0;
+ size_t count = element->getAttributes(&attributes);
+ size_t result = 0;
while (result < count) {
if (strncmp(attributes->fName, attrValue, len) == 0 && strlen(attributes->fName) == len) {
SkASSERT(result == (attributes->fOffset -
} else if (fInSVG == false)
return false;
const char* nextColon = strchr(name, ':');
- if (nextColon && nextColon - name < len)
+ if (nextColon && (size_t)(nextColon - name) < len)
return false;
SkSVGTypes type = GetType(name, len);
// SkASSERT(type >= 0);
long event_mask = NoEventMask;
XClientMessageEvent event;
event.type = ClientMessage;
- Atom myAtom;
+ Atom myAtom(0);
event.message_type = myAtom;
event.format = 32;
event.data.l[0] = 0;
#include "SkTime.h"
#include "SkStackViewLayout.h"
-SkBorderView::SkBorderView() : fTop(SkIntToScalar(0)), fLeft(SkIntToScalar(0)),
- fRight(SkIntToScalar(0)), fBottom(SkIntToScalar(0))
+SkBorderView::SkBorderView() : fLeft(SkIntToScalar(0)),
+ fRight(SkIntToScalar(0)),
+ fTop(SkIntToScalar(0)),
+ fBottom(SkIntToScalar(0))
{
fAnim.setHostEventSink(this);
init_skin_anim(kBorder_SkinEnum, &fAnim);
{
SkASSERT(child != this);
- if (child == NULL || fFirstChild && fFirstChild->fPrevSibling == child)
+ if (child == NULL || (fFirstChild && fFirstChild->fPrevSibling == child))
goto DONE;
child->ref();
void SkWidgetView::setLabel(const char label[], size_t len)
{
- if (label == NULL && fLabel.size() != 0 || !fLabel.equals(label, len))
+ if ((label == NULL && fLabel.size() != 0) || !fLabel.equals(label, len))
{
SkString tmp(label, len);
};
- for (int i = 0; i < SK_ARRAY_COUNT(gNames); i++)
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); i++)
if (!strcmp(gNames[i], name))
return SkWidgetFactory((SkWidgetEnum)i);