Fix more coverity defects - Uninitialized class fields.
authorvandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 22 Jun 2011 05:01:28 +0000 (05:01 +0000)
committervandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 22 Jun 2011 05:01:28 +0000 (05:01 +0000)
In SkCanvas, SkBitmapCache::Entry, SkDrawLooper

CID=13440,1366,16236,14393

Review URL: http://codereview.appspot.com/4628055

git-svn-id: http://skia.googlecode.com/svn/trunk@1671 2bbb7eff-a529-9590-31e7-b0007b416f81

src/core/SkCanvas.cpp
src/effects/SkBitmapCache.cpp
src/effects/SkLayerDrawLooper.cpp

index 0b6f086..f8dd028 100644 (file)
@@ -399,7 +399,9 @@ private:
 
 SkDevice* SkCanvas::init(SkDevice* device) {
     fBounder = NULL;
+    fLocalBoundsCompareType.setEmpty();
     fLocalBoundsCompareTypeDirty = true;
+    fLocalBoundsCompareTypeBW.setEmpty();
     fLocalBoundsCompareTypeDirtyBW = true;
     fLastDeviceToGainFocus = NULL;
     fDeviceCMDirty = false;
@@ -411,6 +413,8 @@ SkDevice* SkCanvas::init(SkDevice* device) {
     fMCRec->fTopLayer = fMCRec->fLayer;
     fMCRec->fNext = NULL;
 
+    fExternalMatrix.reset();
+    fExternalInverse.reset();
     fUseExternalMatrix = false;
 
     return this->setDevice(device);
@@ -434,7 +438,7 @@ SkCanvas::SkCanvas(SkDevice* device)
         : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
     inc_canvas();
 
-    fDeviceFactory = device->getDeviceFactory();\r
+    fDeviceFactory = device->getDeviceFactory();
     SkSafeRef(fDeviceFactory);
 
     this->init(device);
@@ -445,7 +449,7 @@ SkCanvas::SkCanvas(const SkBitmap& bitmap)
     inc_canvas();
 
     SkDevice* device = SkNEW_ARGS(SkDevice, (bitmap));
-    fDeviceFactory = device->getDeviceFactory();\r
+    fDeviceFactory = device->getDeviceFactory();
     SkSafeRef(fDeviceFactory);
 
     this->init(device)->unref();
index 2a3f87a..404eace 100644 (file)
@@ -24,7 +24,10 @@ struct SkBitmapCache::Entry {
     size_t      fSize;
     SkBitmap    fBitmap;
 
-    Entry(const void* buffer, size_t size, const SkBitmap& bm) : fBitmap(bm) {
+    Entry(const void* buffer, size_t size, const SkBitmap& bm)
+            : fPrev(NULL),
+              fNext(NULL),
+              fBitmap(bm) {
         fBuffer = sk_malloc_throw(size);
         fSize = size;
         memcpy(fBuffer, buffer, size);
index 3b21d49..b837fc0 100644 (file)
@@ -12,9 +12,10 @@ SkLayerDrawLooper::LayerInfo::LayerInfo() {
     fPostTranslate = false;
 }
 
-SkLayerDrawLooper::SkLayerDrawLooper() {
-    fRecs = NULL;
-    fCount = 0;
+SkLayerDrawLooper::SkLayerDrawLooper()
+        : fRecs(NULL),
+          fCount(0),
+          fCurrRec(NULL) {
 }
 
 SkLayerDrawLooper::~SkLayerDrawLooper() {
@@ -200,10 +201,10 @@ void SkLayerDrawLooper::flatten(SkFlattenableWriteBuffer& buffer) {
 }
 
 SkLayerDrawLooper::SkLayerDrawLooper(SkFlattenableReadBuffer& buffer)
-        : INHERITED(buffer) {
-    fRecs = NULL;
-    fCount = 0;
-    
+        : INHERITED(buffer),
+          fRecs(NULL),
+          fCount(0),
+          fCurrRec(NULL) {
     int count = buffer.readInt();
 
     for (int i = 0; i < count; i++) {