Fix some VS2010 warnings
Review URL: http://codereview.appspot.com/5155043 git-svn-id: http://skia.googlecode.com/svn/trunk@2380 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
6f92f18b62
commit
9d12f5c11b
@ -103,7 +103,9 @@ protected:
|
|||||||
paint.fDstBlendCoeff = kISA_BlendCoeff;
|
paint.fDstBlendCoeff = kISA_BlendCoeff;
|
||||||
GrMatrix vm;
|
GrMatrix vm;
|
||||||
if (i) {
|
if (i) {
|
||||||
vm.setRotate(90, S , S);
|
vm.setRotate(90 * SK_Scalar1,
|
||||||
|
S * SK_Scalar1,
|
||||||
|
S * SK_Scalar1);
|
||||||
} else {
|
} else {
|
||||||
vm.reset();
|
vm.reset();
|
||||||
}
|
}
|
||||||
|
@ -856,8 +856,8 @@ void GrContext::doOffscreenAAPass2(GrDrawTarget* target,
|
|||||||
scale * GR_Scalar1 / src->height());
|
scale * GR_Scalar1 / src->height());
|
||||||
sampler.setMatrix(sampleM);
|
sampler.setMatrix(sampleM);
|
||||||
target->setSamplerState(kOffscreenStage, sampler);
|
target->setSamplerState(kOffscreenStage, sampler);
|
||||||
GrRect rect = SkRect::MakeWH(scale * tileRect.width(),
|
GrRect rect = SkRect::MakeWH(SkIntToScalar(scale * tileRect.width()),
|
||||||
scale * tileRect.height());
|
SkIntToScalar(scale * tileRect.height()));
|
||||||
target->drawSimpleRect(rect, NULL, 1 << kOffscreenStage);
|
target->drawSimpleRect(rect, NULL, 1 << kOffscreenStage);
|
||||||
|
|
||||||
src = record->fOffscreen1.texture();
|
src = record->fOffscreen1.texture();
|
||||||
@ -896,7 +896,8 @@ void GrContext::doOffscreenAAPass2(GrDrawTarget* target,
|
|||||||
sampleM.setScale(scale * GR_Scalar1 / src->width(),
|
sampleM.setScale(scale * GR_Scalar1 / src->width(),
|
||||||
scale * GR_Scalar1 / src->height());
|
scale * GR_Scalar1 / src->height());
|
||||||
sampler.setMatrix(sampleM);
|
sampler.setMatrix(sampleM);
|
||||||
sampleM.setTranslate(-tileRect.fLeft, -tileRect.fTop);
|
sampleM.setTranslate(SkIntToScalar(-tileRect.fLeft),
|
||||||
|
SkIntToScalar(-tileRect.fTop));
|
||||||
sampler.preConcatMatrix(sampleM);
|
sampler.preConcatMatrix(sampleM);
|
||||||
target->setSamplerState(kOffscreenStage, sampler);
|
target->setSamplerState(kOffscreenStage, sampler);
|
||||||
|
|
||||||
@ -1506,23 +1507,23 @@ void GrContext::drawPath(const GrPaint& paint, const GrPath& path,
|
|||||||
GrDrawTarget::AutoDeviceCoordDraw adcd(target, stageMask);
|
GrDrawTarget::AutoDeviceCoordDraw adcd(target, stageMask);
|
||||||
GrRect rect;
|
GrRect rect;
|
||||||
if (clipIBounds.fTop < bound.fTop) {
|
if (clipIBounds.fTop < bound.fTop) {
|
||||||
rect.setLTRB(clipIBounds.fLeft, clipIBounds.fTop,
|
rect.iset(clipIBounds.fLeft, clipIBounds.fTop,
|
||||||
clipIBounds.fRight, bound.fTop);
|
clipIBounds.fRight, bound.fTop);
|
||||||
target->drawSimpleRect(rect, NULL, stageMask);
|
target->drawSimpleRect(rect, NULL, stageMask);
|
||||||
}
|
}
|
||||||
if (clipIBounds.fLeft < bound.fLeft) {
|
if (clipIBounds.fLeft < bound.fLeft) {
|
||||||
rect.setLTRB(clipIBounds.fLeft, bound.fTop,
|
rect.iset(clipIBounds.fLeft, bound.fTop,
|
||||||
bound.fLeft, bound.fBottom);
|
bound.fLeft, bound.fBottom);
|
||||||
target->drawSimpleRect(rect, NULL, stageMask);
|
target->drawSimpleRect(rect, NULL, stageMask);
|
||||||
}
|
}
|
||||||
if (clipIBounds.fRight > bound.fRight) {
|
if (clipIBounds.fRight > bound.fRight) {
|
||||||
rect.setLTRB(bound.fRight, bound.fTop,
|
rect.iset(bound.fRight, bound.fTop,
|
||||||
clipIBounds.fRight, bound.fBottom);
|
clipIBounds.fRight, bound.fBottom);
|
||||||
target->drawSimpleRect(rect, NULL, stageMask);
|
target->drawSimpleRect(rect, NULL, stageMask);
|
||||||
}
|
}
|
||||||
if (clipIBounds.fBottom > bound.fBottom) {
|
if (clipIBounds.fBottom > bound.fBottom) {
|
||||||
rect.setLTRB(clipIBounds.fLeft, bound.fBottom,
|
rect.iset(clipIBounds.fLeft, bound.fBottom,
|
||||||
clipIBounds.fRight, clipIBounds.fBottom);
|
clipIBounds.fRight, clipIBounds.fBottom);
|
||||||
target->drawSimpleRect(rect, NULL, stageMask);
|
target->drawSimpleRect(rect, NULL, stageMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ private:
|
|||||||
uint8_t fKernelWidth;
|
uint8_t fKernelWidth;
|
||||||
|
|
||||||
inline bool isEnabled() const {
|
inline bool isEnabled() const {
|
||||||
return fOptFlags & kIsEnabled_OptFlagBit;
|
return 0 != (fOptFlags & kIsEnabled_OptFlagBit);
|
||||||
}
|
}
|
||||||
inline void setEnabled(bool newValue) {
|
inline void setEnabled(bool newValue) {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
|
@ -432,7 +432,7 @@ void GrGpuGL::initCaps() {
|
|||||||
probe_for_npot_render_target_support(fGL, fCaps.fNPOTTextureSupport);
|
probe_for_npot_render_target_support(fGL, fCaps.fNPOTTextureSupport);
|
||||||
} else {
|
} else {
|
||||||
GrAssert(expectNPOTTargets == 0 || expectNPOTTargets == 1);
|
GrAssert(expectNPOTTargets == 0 || expectNPOTTargets == 1);
|
||||||
fCaps.fNPOTRenderTargetSupport = static_cast<bool>(expectNPOTTargets);
|
fCaps.fNPOTRenderTargetSupport = (0 != expectNPOTTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
GR_GL_GetIntegerv(fGL, GR_GL_MAX_TEXTURE_SIZE, &fCaps.fMaxTextureSize);
|
GR_GL_GetIntegerv(fGL, GR_GL_MAX_TEXTURE_SIZE, &fCaps.fMaxTextureSize);
|
||||||
|
@ -238,7 +238,9 @@ bool GrGpuGLShaders::programUnitTest() {
|
|||||||
}
|
}
|
||||||
pdesc.fEdgeAANumEdges = 0;
|
pdesc.fEdgeAANumEdges = 0;
|
||||||
} else {
|
} else {
|
||||||
pdesc.fEdgeAANumEdges = random.nextF() * this->getMaxEdges() + 1;
|
pdesc.fEdgeAANumEdges =
|
||||||
|
static_cast<int8_t>(1 + random.nextF() *
|
||||||
|
this->getMaxEdges());
|
||||||
pdesc.fEdgeAAConcave = random.nextF() > .5f;
|
pdesc.fEdgeAAConcave = random.nextF() > .5f;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -279,7 +281,7 @@ bool GrGpuGLShaders::programUnitTest() {
|
|||||||
stage.fOptFlags |= StageDesc::kNoPerspective_OptFlagBit;
|
stage.fOptFlags |= StageDesc::kNoPerspective_OptFlagBit;
|
||||||
}
|
}
|
||||||
stage.setEnabled(VertexUsesStage(s, pdesc.fVertexLayout));
|
stage.setEnabled(VertexUsesStage(s, pdesc.fVertexLayout));
|
||||||
stage.fKernelWidth = 4 * random.nextF() + 2;
|
stage.fKernelWidth = static_cast<int8_t>(4 * random.nextF() + 2);
|
||||||
}
|
}
|
||||||
CachedData cachedData;
|
CachedData cachedData;
|
||||||
if (!program.genProgram(this->glInterface(),
|
if (!program.genProgram(this->glInterface(),
|
||||||
@ -562,7 +564,8 @@ void GrGpuGLShaders::flushEdgeAAData() {
|
|||||||
int count = fCurrDrawState.fEdgeAANumEdges;
|
int count = fCurrDrawState.fEdgeAANumEdges;
|
||||||
Edge edges[kMaxEdges];
|
Edge edges[kMaxEdges];
|
||||||
// Flip the edges in Y
|
// Flip the edges in Y
|
||||||
float height = fCurrDrawState.fRenderTarget->height();
|
float height =
|
||||||
|
static_cast<float>(fCurrDrawState.fRenderTarget->height());
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
edges[i] = fCurrDrawState.fEdgeAAEdges[i];
|
edges[i] = fCurrDrawState.fEdgeAAEdges[i];
|
||||||
float b = edges[i].fY;
|
float b = edges[i].fY;
|
||||||
@ -822,7 +825,7 @@ void GrGpuGLShaders::buildProgram(GrPrimitiveType type) {
|
|||||||
|
|
||||||
desc.fEmitsPointSize = kPoints_PrimitiveType == type;
|
desc.fEmitsPointSize = kPoints_PrimitiveType == type;
|
||||||
|
|
||||||
bool requiresAttributeColors = desc.fVertexLayout & kColor_VertexLayoutBit;
|
bool requiresAttributeColors = 0 != (desc.fVertexLayout & kColor_VertexLayoutBit);
|
||||||
// fColorType records how colors are specified for the program. Strip
|
// fColorType records how colors are specified for the program. Strip
|
||||||
// the bit from the layout to avoid false negatives when searching for an
|
// the bit from the layout to avoid false negatives when searching for an
|
||||||
// existing program in the cache.
|
// existing program in the cache.
|
||||||
|
@ -157,8 +157,8 @@ bool SkDisplayXMLParser::onAddAttributeLen(const char attrName[], const char att
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SK_BUILD_FOR_WIN32)
|
#if defined(SK_BUILD_FOR_WIN32)
|
||||||
#define SK_strcasecmp stricmp
|
#define SK_strcasecmp _stricmp
|
||||||
#define SK_strncasecmp strnicmp
|
#define SK_strncasecmp _strnicmp
|
||||||
#else
|
#else
|
||||||
#define SK_strcasecmp strcasecmp
|
#define SK_strcasecmp strcasecmp
|
||||||
#define SK_strncasecmp strncasecmp
|
#define SK_strncasecmp strncasecmp
|
||||||
|
@ -603,7 +603,7 @@ scalarCommon:
|
|||||||
}
|
}
|
||||||
if (ch == '.') {
|
if (ch == '.') {
|
||||||
if (fTokenLength == 0) {
|
if (fTokenLength == 0) {
|
||||||
SkScriptValue2 scriptValue;
|
SkDEBUGCODE(SkScriptValue2 scriptValue);
|
||||||
SkDEBUGCODE(scriptValue.fOperand.fObject = NULL);
|
SkDEBUGCODE(scriptValue.fOperand.fObject = NULL);
|
||||||
int tokenLength = token_length(++script);
|
int tokenLength = token_length(++script);
|
||||||
const char* token = script;
|
const char* token = script;
|
||||||
|
@ -984,7 +984,8 @@ static bool drawWithMaskFilter(GrContext* context, const SkPath& path,
|
|||||||
GrIntToScalar(dstM.fBounds.fBottom));
|
GrIntToScalar(dstM.fBounds.fBottom));
|
||||||
|
|
||||||
GrMatrix m;
|
GrMatrix m;
|
||||||
m.setTranslate(-dstM.fBounds.fLeft, -dstM.fBounds.fTop);
|
m.setTranslate(-dstM.fBounds.fLeft*SK_Scalar1,
|
||||||
|
-dstM.fBounds.fTop*SK_Scalar1);
|
||||||
m.postIDiv(texture->width(), texture->height());
|
m.postIDiv(texture->width(), texture->height());
|
||||||
grp->getMaskSampler(MASK_IDX)->setMatrix(m);
|
grp->getMaskSampler(MASK_IDX)->setMatrix(m);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ void SkBitSet::setBit(int index, bool value) {
|
|||||||
|
|
||||||
bool SkBitSet::isBitSet(int index) const {
|
bool SkBitSet::isBitSet(int index) const {
|
||||||
uint32_t mask = 1 << (index % 32);
|
uint32_t mask = 1 << (index % 32);
|
||||||
return (*internalGet(index) & mask);
|
return 0 != (*internalGet(index) & mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkBitSet::orBits(const SkBitSet& source) {
|
bool SkBitSet::orBits(const SkBitSet& source) {
|
||||||
|
@ -164,9 +164,9 @@ void SkMatrix44::setRotateAbout(SkMScalar x, SkMScalar y, SkMScalar z,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double scale = 1 / sqrt(len2);
|
double scale = 1 / sqrt(len2);
|
||||||
x *= scale;
|
x = SkDoubleToMScalar(x * scale);
|
||||||
y *= scale;
|
y = SkDoubleToMScalar(y * scale);
|
||||||
z *= scale;
|
z = SkDoubleToMScalar(z * scale);
|
||||||
}
|
}
|
||||||
this->setRotateAboutUnit(x, y, z, radians);
|
this->setRotateAboutUnit(x, y, z, radians);
|
||||||
}
|
}
|
||||||
@ -187,9 +187,17 @@ void SkMatrix44::setRotateAboutUnit(SkMScalar x, SkMScalar y, SkMScalar z,
|
|||||||
double zxC = z * xC;
|
double zxC = z * xC;
|
||||||
|
|
||||||
// if you're looking at wikipedia, remember that we're column major.
|
// if you're looking at wikipedia, remember that we're column major.
|
||||||
this->set3x3(x * xC + c, xyC + zs, zxC - ys,
|
this->set3x3(SkDoubleToMScalar(x * xC + c), // scale x
|
||||||
xyC - zs, y * yC + c, yzC + xs,
|
SkDoubleToMScalar(xyC + zs), // skew x
|
||||||
zxC + ys, yzC - xs, z * zC + c);
|
SkDoubleToMScalar(zxC - ys), // trans x
|
||||||
|
|
||||||
|
SkDoubleToMScalar(xyC - zs), // skew y
|
||||||
|
SkDoubleToMScalar(y * yC + c), // scale y
|
||||||
|
SkDoubleToMScalar(yzC + xs), // trans y
|
||||||
|
|
||||||
|
SkDoubleToMScalar(zxC + ys), // persp x
|
||||||
|
SkDoubleToMScalar(yzC - xs), // persp y
|
||||||
|
SkDoubleToMScalar(z * zC + c)); // persp 2
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -211,7 +219,7 @@ void SkMatrix44::setConcat(const SkMatrix44& a, const SkMatrix44& b) {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static inline SkMScalar det2x2(double m00, double m01, double m10, double m11) {
|
static inline SkMScalar det2x2(double m00, double m01, double m10, double m11) {
|
||||||
return m00 * m11 - m10 * m01;
|
return SkDoubleToMScalar(m00 * m11 - m10 * m01);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline double det3x3(double m00, double m01, double m02,
|
static inline double det3x3(double m00, double m01, double m02,
|
||||||
|
@ -143,7 +143,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
|
|||||||
stretchX = (bounds.width() - SkIntToScalar(fixed)) / numXStretch;
|
stretchX = (bounds.width() - SkIntToScalar(fixed)) / numXStretch;
|
||||||
if (stretchX < 0) {
|
if (stretchX < 0) {
|
||||||
// reuse stretchX, but keep it negative as a signal
|
// reuse stretchX, but keep it negative as a signal
|
||||||
stretchX = -bitmap.width() / fixed;
|
stretchX = -SkIntToScalar(bitmap.width()) / fixed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ void SkNinePatch::DrawMesh(SkCanvas* canvas, const SkRect& bounds,
|
|||||||
stretchY = (bounds.height() - SkIntToScalar(fixed)) / numYStretch;
|
stretchY = (bounds.height() - SkIntToScalar(fixed)) / numYStretch;
|
||||||
if (stretchY < 0) {
|
if (stretchY < 0) {
|
||||||
// reuse stretchY, but keep it negative as a signal
|
// reuse stretchY, but keep it negative as a signal
|
||||||
stretchY = -bitmap.height() / fixed;
|
stretchY = -SkIntToScalar(bitmap.height()) / fixed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ HRESULT STDMETHODCALLTYPE SkIStream::Seek(LARGE_INTEGER liDistanceToMove
|
|||||||
hr = E_FAIL;
|
hr = E_FAIL;
|
||||||
} else {
|
} else {
|
||||||
size_t skipped = this->fSkStream->skip(
|
size_t skipped = this->fSkStream->skip(
|
||||||
liDistanceToMove.QuadPart
|
static_cast<size_t>(liDistanceToMove.QuadPart)
|
||||||
);
|
);
|
||||||
this->fLocation.QuadPart = skipped;
|
this->fLocation.QuadPart = skipped;
|
||||||
if (skipped != liDistanceToMove.QuadPart) {
|
if (skipped != liDistanceToMove.QuadPart) {
|
||||||
@ -163,7 +163,9 @@ HRESULT STDMETHODCALLTYPE SkIStream::Seek(LARGE_INTEGER liDistanceToMove
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STREAM_SEEK_CUR: {
|
case STREAM_SEEK_CUR: {
|
||||||
size_t skipped = this->fSkStream->skip(liDistanceToMove.QuadPart);
|
size_t skipped = this->fSkStream->skip(
|
||||||
|
static_cast<size_t>(liDistanceToMove.QuadPart)
|
||||||
|
);
|
||||||
this->fLocation.QuadPart += skipped;
|
this->fLocation.QuadPart += skipped;
|
||||||
if (skipped != liDistanceToMove.QuadPart) {
|
if (skipped != liDistanceToMove.QuadPart) {
|
||||||
hr = E_FAIL;
|
hr = E_FAIL;
|
||||||
@ -176,7 +178,7 @@ HRESULT STDMETHODCALLTYPE SkIStream::Seek(LARGE_INTEGER liDistanceToMove
|
|||||||
} else {
|
} else {
|
||||||
LONGLONG skip = this->fSkStream->getLength()
|
LONGLONG skip = this->fSkStream->getLength()
|
||||||
+ liDistanceToMove.QuadPart;
|
+ liDistanceToMove.QuadPart;
|
||||||
size_t skipped = this->fSkStream->skip(skip);
|
size_t skipped = this->fSkStream->skip(static_cast<size_t>(skip));
|
||||||
this->fLocation.QuadPart = skipped;
|
this->fLocation.QuadPart = skipped;
|
||||||
if (skipped != skip) {
|
if (skipped != skip) {
|
||||||
hr = E_FAIL;
|
hr = E_FAIL;
|
||||||
@ -198,7 +200,7 @@ HRESULT STDMETHODCALLTYPE SkIStream::Seek(LARGE_INTEGER liDistanceToMove
|
|||||||
HRESULT STDMETHODCALLTYPE SkIStream::Stat(STATSTG* pStatstg
|
HRESULT STDMETHODCALLTYPE SkIStream::Stat(STATSTG* pStatstg
|
||||||
, DWORD grfStatFlag)
|
, DWORD grfStatFlag)
|
||||||
{
|
{
|
||||||
if (0 == grfStatFlag & STATFLAG_NONAME) {
|
if (0 == (grfStatFlag & STATFLAG_NONAME)) {
|
||||||
return STG_E_INVALIDFLAG;
|
return STG_E_INVALIDFLAG;
|
||||||
}
|
}
|
||||||
pStatstg->pwcsName = NULL;
|
pStatstg->pwcsName = NULL;
|
||||||
@ -256,7 +258,7 @@ HRESULT STDMETHODCALLTYPE SkWIStream::Commit(DWORD) {
|
|||||||
HRESULT STDMETHODCALLTYPE SkWIStream::Stat(STATSTG* pStatstg
|
HRESULT STDMETHODCALLTYPE SkWIStream::Stat(STATSTG* pStatstg
|
||||||
, DWORD grfStatFlag)
|
, DWORD grfStatFlag)
|
||||||
{
|
{
|
||||||
if (0 == grfStatFlag & STATFLAG_NONAME) {
|
if (0 == (grfStatFlag & STATFLAG_NONAME)) {
|
||||||
return STG_E_INVALIDFLAG;
|
return STG_E_INVALIDFLAG;
|
||||||
}
|
}
|
||||||
pStatstg->pwcsName = NULL;
|
pStatstg->pwcsName = NULL;
|
||||||
|
@ -100,7 +100,7 @@ char* tchar_to_utf8(const TCHAR* str) {
|
|||||||
str8[size] = '\0';
|
str8[size] = '\0';
|
||||||
return str8;
|
return str8;
|
||||||
#else
|
#else
|
||||||
return strdup(str);
|
return _strdup(str);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,6 @@ bool SkWindow::update(SkIRect* updateArea, SkCanvas* canvas)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SkCanvas rasterCanvas;
|
SkCanvas rasterCanvas;
|
||||||
SkDevice* device;
|
|
||||||
|
|
||||||
if (NULL == canvas) {
|
if (NULL == canvas) {
|
||||||
canvas = &rasterCanvas;
|
canvas = &rasterCanvas;
|
||||||
|
Loading…
Reference in New Issue
Block a user