aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-28 20:29:38 +0000
committerGravatar vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-28 20:29:38 +0000
commita728e35edcffd99216e3965a4b908ad0df7f69c2 (patch)
treef9c2668a0aeae6d649bfcdd86d275edbb548dfed /src
parent802eee956c0dcc0c30f29911b9254d1dcd92088e (diff)
Fix a bunch of Coverity defects - class members not initialized in the constructor.
CID=14533,14036,9275,9271,4156,4153,4151,1666,1665,1618,1617,1616,1615 Review URL: https://codereview.appspot.com/5940049 git-svn-id: http://skia.googlecode.com/svn/trunk@3532 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBitmapSampler.cpp2
-rw-r--r--src/core/SkCubicClipper.cpp4
-rw-r--r--src/core/SkMMapStream.cpp1
-rw-r--r--src/core/SkQuadClipper.cpp4
-rw-r--r--src/effects/Sk1DPathEffect.cpp7
-rw-r--r--src/effects/SkBlurDrawLooper.cpp2
-rw-r--r--src/gpu/GrGpu.cpp3
-rw-r--r--src/images/SkScaledBitmapSampler.cpp7
8 files changed, 23 insertions, 7 deletions
diff --git a/src/core/SkBitmapSampler.cpp b/src/core/SkBitmapSampler.cpp
index 37cbc5a058..4c05be27c4 100644
--- a/src/core/SkBitmapSampler.cpp
+++ b/src/core/SkBitmapSampler.cpp
@@ -234,6 +234,7 @@ class A8_Bilinear_Sampler : public SkBitmapSampler {
public:
A8_Bilinear_Sampler(const SkBitmap& bm, SkShader::TileMode tmx, SkShader::TileMode tmy)
: SkBitmapSampler(bm, true, tmx, tmy)
+ , fColor(0)
{
fProcTable = SkGetBilinearFilterProcTable();
}
@@ -289,6 +290,7 @@ class A8_NoFilter_Sampler : public SkBitmapSampler {
public:
A8_NoFilter_Sampler(const SkBitmap& bm, SkShader::TileMode tmx, SkShader::TileMode tmy)
: SkBitmapSampler(bm, false, tmx, tmy)
+ , fProcTable(NULL)
{
}
diff --git a/src/core/SkCubicClipper.cpp b/src/core/SkCubicClipper.cpp
index 662591fe2b..3db2feb34c 100644
--- a/src/core/SkCubicClipper.cpp
+++ b/src/core/SkCubicClipper.cpp
@@ -10,7 +10,9 @@
#include "SkCubicClipper.h"
#include "SkGeometry.h"
-SkCubicClipper::SkCubicClipper() {}
+SkCubicClipper::SkCubicClipper() {
+ fClip.setEmpty();
+}
void SkCubicClipper::setClip(const SkIRect& clip) {
// conver to scalars, since that's where we'll see the points
diff --git a/src/core/SkMMapStream.cpp b/src/core/SkMMapStream.cpp
index 0aec5e19d2..1579044dc8 100644
--- a/src/core/SkMMapStream.cpp
+++ b/src/core/SkMMapStream.cpp
@@ -15,6 +15,7 @@
SkMMAPStream::SkMMAPStream(const char filename[])
{
fAddr = NULL; // initialize to failure case
+ fSize = 0;
int fildes = open(filename, O_RDONLY);
if (fildes < 0)
diff --git a/src/core/SkQuadClipper.cpp b/src/core/SkQuadClipper.cpp
index b79d5a2497..0c9c9add09 100644
--- a/src/core/SkQuadClipper.cpp
+++ b/src/core/SkQuadClipper.cpp
@@ -22,7 +22,9 @@ static inline void clamp_ge(SkScalar& value, SkScalar min) {
}
}
-SkQuadClipper::SkQuadClipper() {}
+SkQuadClipper::SkQuadClipper() {
+ fClip.setEmpty();
+}
void SkQuadClipper::setClip(const SkIRect& clip) {
// conver to scalars, since that's where we'll see the points
diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp
index 9ccc4539ae..11170f4a46 100644
--- a/src/effects/Sk1DPathEffect.cpp
+++ b/src/effects/Sk1DPathEffect.cpp
@@ -34,6 +34,8 @@ SkPath1DPathEffect::SkPath1DPathEffect(const SkPath& path, SkScalar advance,
if (advance <= 0 || path.isEmpty()) {
SkDEBUGF(("SkPath1DPathEffect can't use advance <= 0\n"));
fAdvance = 0; // signals we can't draw anything
+ fInitialOffset = 0;
+ fStyle = kStyleCount;
} else {
// cleanup their phase parameter, inverting it so that it becomes an
// offset along the path (to match the interpretation in PostScript)
@@ -142,6 +144,11 @@ SkPath1DPathEffect::SkPath1DPathEffect(SkFlattenableReadBuffer& buffer) {
fPath.unflatten(buffer);
fInitialOffset = buffer.readScalar();
fStyle = (Style) buffer.readU8();
+ } else {
+ SkDEBUGF(("SkPath1DPathEffect can't use advance <= 0\n"));
+ // Make Coverity happy.
+ fInitialOffset = 0;
+ fStyle = kStyleCount;
}
}
diff --git a/src/effects/SkBlurDrawLooper.cpp b/src/effects/SkBlurDrawLooper.cpp
index a44f081a02..656f8f7d6c 100644
--- a/src/effects/SkBlurDrawLooper.cpp
+++ b/src/effects/SkBlurDrawLooper.cpp
@@ -14,7 +14,7 @@
SkBlurDrawLooper::SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy,
SkColor color, uint32_t flags)
- : fDx(dx), fDy(dy), fBlurColor(color), fBlurFlags(flags) {
+ : fDx(dx), fDy(dy), fBlurColor(color), fBlurFlags(flags), fState(kDone) {
SkASSERT(flags <= kAll_BlurFlag);
if (radius > 0) {
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 10c5c44a56..ab16218a51 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -31,7 +31,8 @@ extern void gr_run_unittests();
#define DEBUG_INVAL_START_IDX -1
GrGpu::GrGpu()
- : fContext(NULL)
+ : fClipInStencil(false)
+ , fContext(NULL)
, fResetTimestamp(kExpiredTimestamp+1)
, fVertexPool(NULL)
, fIndexPool(NULL)
diff --git a/src/images/SkScaledBitmapSampler.cpp b/src/images/SkScaledBitmapSampler.cpp
index 1af433dac6..15633d3a63 100644
--- a/src/images/SkScaledBitmapSampler.cpp
+++ b/src/images/SkScaledBitmapSampler.cpp
@@ -295,6 +295,10 @@ static bool Sample_Index_DI(void* SK_RESTRICT dstRow,
SkScaledBitmapSampler::SkScaledBitmapSampler(int width, int height,
int sampleSize) {
+ fCTable = NULL;
+ fDstRow = NULL;
+ fRowProc = NULL;
+
if (width <= 0 || height <= 0) {
sk_throw();
}
@@ -327,9 +331,6 @@ SkScaledBitmapSampler::SkScaledBitmapSampler(int width, int height,
SkASSERT(fDX > 0 && (fX0 + fDX * (fScaledWidth - 1)) < width);
SkASSERT(fDY > 0 && (fY0 + fDY * (fScaledHeight - 1)) < height);
-
- fRowProc = NULL;
- fCTable = NULL;
}
bool SkScaledBitmapSampler::begin(SkBitmap* dst, SrcConfig sc, bool dither,