In SkGPipeCanvas, rename fSharedHeap to fBitmapHeap
authorscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 14 Aug 2012 17:21:34 +0000 (17:21 +0000)
committerscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 14 Aug 2012 17:21:34 +0000 (17:21 +0000)
to reflect the fact that it is only used for storing bitmaps.

Review URL: https://codereview.appspot.com/6446134

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

src/pipe/SkGPipePriv.h
src/pipe/SkGPipeRead.cpp
src/pipe/SkGPipeWrite.cpp

index 5caecd8..c68f3ec 100644 (file)
@@ -74,7 +74,7 @@ enum DrawOps {
 
     // these are signals to playback, not drawing verbs
     kReportFlags_DrawOp,
-    kShareHeap_DrawOp,
+    kShareBitmapHeap_DrawOp,
     kDone_DrawOp,
 };
 
index dc7dbfb..651e838 100644 (file)
@@ -605,7 +605,7 @@ static void reportFlags_rp(SkCanvas*, SkReader32*, uint32_t op32,
     state->setFlags(flags);
 }
 
-static void shareHeap_rp(SkCanvas*, SkReader32* reader, uint32_t,
+static void shareBitmapHeap_rp(SkCanvas*, SkReader32* reader, uint32_t,
                            SkGPipeState* state) {
     state->setSharedHeap(static_cast<SkBitmapHeap*>(reader->readPtr()));
 }
@@ -654,7 +654,7 @@ static const ReadProc gReadTable[] = {
     def_Factory_rp,
 
     reportFlags_rp,
-    shareHeap_rp,
+    shareBitmapHeap_rp,
     done_rp
 };
 
index 119a809..f5401aa 100644 (file)
@@ -168,16 +168,16 @@ public:
                 this->writeOp(kDone_DrawOp);
                 this->doNotify();
                 if (shouldFlattenBitmaps(fFlags)) {
-                    // In this case, a BitmapShuttle is reffed by the SharedHeap
-                    // and refs this canvas. Unref the SharedHeap to end the
+                    // In this case, a BitmapShuttle is reffed by the SkBitmapHeap
+                    // and refs this canvas. Unref the SkBitmapHeap to end the
                     // circular reference. When shouldFlattenBitmaps is false,
-                    // there is no circular reference, so the SharedHeap can be
+                    // there is no circular reference, so the SkBitmapHeap can be
                     // safely unreffed in the destructor.
-                    fSharedHeap->unref();
+                    fBitmapHeap->unref();
                     // This eliminates a similar circular reference (Canvas owns
-                    // the FlattenableHeap which holds a ref to fSharedHeap).
+                    // the FlattenableHeap which holds a ref to the SkBitmapHeap).
                     fFlattenableHeap.setBitmapStorage(NULL);
-                    fSharedHeap = NULL;
+                    fBitmapHeap = NULL;
                 }
             }
             fDone = true;
@@ -188,7 +188,7 @@ public:
     size_t freeMemoryIfPossible(size_t bytesToFree);
 
     size_t storageAllocatedForRecording() {
-        return fSharedHeap->bytesAllocated();
+        return fBitmapHeap->bytesAllocated();
     }
 
     // overrides from SkCanvas
@@ -253,7 +253,7 @@ private:
     };
     SkNamedFactorySet* fFactorySet;
     int                fFirstSaveLayerStackLevel;
-    SkBitmapHeap*      fSharedHeap;
+    SkBitmapHeap*      fBitmapHeap;
     SkGPipeController* fController;
     SkWriter32&        fWriter;
     size_t             fBlockSize; // amount allocated for writer
@@ -356,11 +356,11 @@ int SkGPipeCanvas::flattenToIndex(SkFlattenable* obj, PaintFlats paintflat) {
         writeBufferFlags = 0;
     }
 
-    fSharedHeap->deferAddingOwners();
+    fBitmapHeap->deferAddingOwners();
     bool added, replaced;
     const SkFlatData* flat = fFlatDictionary.findAndReplace(
             *obj, writeBufferFlags, fFlattenableHeap.flatToReplace(), &added, &replaced);
-    fSharedHeap->endAddingOwnersDeferral(added);
+    fBitmapHeap->endAddingOwnersDeferral(added);
     int index = flat->index();
     if (added) {
         if (isCrossProcess(fFlags)) {
@@ -431,24 +431,24 @@ SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller,
     
     if (shouldFlattenBitmaps(flags)) {
         BitmapShuttle* shuttle = SkNEW_ARGS(BitmapShuttle, (this));
-        fSharedHeap = SkNEW_ARGS(SkBitmapHeap, (shuttle, BITMAPS_TO_KEEP));
+        fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, (shuttle, BITMAPS_TO_KEEP));
         shuttle->unref();
     } else {
-        fSharedHeap = SkNEW_ARGS(SkBitmapHeap,
+        fBitmapHeap = SkNEW_ARGS(SkBitmapHeap,
                                  (BITMAPS_TO_KEEP, controller->numberOfReaders()));
         if (this->needOpBytes(sizeof(void*))) {
-            this->writeOp(kShareHeap_DrawOp);
-            fWriter.writePtr(static_cast<void*>(fSharedHeap));
+            this->writeOp(kShareBitmapHeap_DrawOp);
+            fWriter.writePtr(static_cast<void*>(fBitmapHeap));
         }
     }
-    fFlattenableHeap.setBitmapStorage(fSharedHeap);
+    fFlattenableHeap.setBitmapStorage(fBitmapHeap);
     this->doNotify();
 }
 
 SkGPipeCanvas::~SkGPipeCanvas() {
     this->finish();
     SkSafeUnref(fFactorySet);
-    SkSafeUnref(fSharedHeap);
+    SkSafeUnref(fBitmapHeap);
 }
 
 bool SkGPipeCanvas::needOpBytes(size_t needed) {
@@ -706,7 +706,7 @@ bool SkGPipeCanvas::commonDrawBitmap(const SkBitmap& bm, DrawOps op,
                                      unsigned flags,
                                      size_t opBytesNeeded,
                                      const SkPaint* paint) {
-    int32_t bitmapIndex = fSharedHeap->insert(bm);
+    int32_t bitmapIndex = fBitmapHeap->insert(bm);
     if (SkBitmapHeap::INVALID_SLOT == bitmapIndex) {
         return false;
     }
@@ -944,7 +944,7 @@ void SkGPipeCanvas::flushRecording(bool detachCurrentBlock) {
 }
 
 size_t SkGPipeCanvas::freeMemoryIfPossible(size_t bytesToFree) {
-    return fSharedHeap->freeMemoryIfPossible(bytesToFree);
+    return fBitmapHeap->freeMemoryIfPossible(bytesToFree);
 }
 
 ///////////////////////////////////////////////////////////////////////////////