Sanitizing source files in Skia_Periodic_House_Keeping
authorskia.committer@gmail.com <skia.committer@gmail.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 31 Jan 2013 20:28:24 +0000 (20:28 +0000)
committerskia.committer@gmail.com <skia.committer@gmail.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 31 Jan 2013 20:28:24 +0000 (20:28 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@7499 2bbb7eff-a529-9590-31e7-b0007b416f81

15 files changed:
bench/RegionContainBench.cpp
src/gpu/GrBufferAllocPool.cpp
src/gpu/GrBufferAllocPool.h
src/gpu/GrDrawTarget.cpp
src/gpu/GrDrawTarget.h
src/gpu/GrGpu.cpp
src/gpu/GrGpu.h
src/gpu/GrInOrderDrawBuffer.cpp
src/gpu/GrInOrderDrawBuffer.h
src/gpu/GrTextContext.cpp
src/utils/SkMD5.h
src/utils/SkSHA1.h
tests/MD5Test.cpp
tests/SHA1Test.cpp
tools/filtermain.cpp

index 8597f31..1aae264 100644 (file)
@@ -66,4 +66,3 @@ private:
 static SkBenchmark* gF0(void* p) { return SkNEW_ARGS(RegionContainBench, (p, sect_proc, "sect")); }
 
 static BenchRegistry gR0(gF0);
-
index ec8a9c9..831c430 100644 (file)
@@ -373,7 +373,7 @@ GrVertexBufferAllocPool::GrVertexBufferAllocPool(GrGpu* gpu,
                     preallocBufferCnt) {
 }
 
-void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize,
+void* GrVertexBufferAllocPool::makeSpace(GrVertexLayout layout,
                                          int vertexCount,
                                          const GrVertexBuffer** buffer,
                                          int* startVertex) {
@@ -382,41 +382,43 @@ void* GrVertexBufferAllocPool::makeSpace(size_t vertexSize,
     GrAssert(NULL != buffer);
     GrAssert(NULL != startVertex);
 
+    size_t vSize = GrDrawState::VertexSize(layout);
     size_t offset = 0; // assign to suppress warning
     const GrGeometryBuffer* geomBuffer = NULL; // assign to suppress warning
-    void* ptr = INHERITED::makeSpace(vertexSize * vertexCount,
-                                     vertexSize,
+    void* ptr = INHERITED::makeSpace(vSize * vertexCount,
+                                     vSize,
                                      &geomBuffer,
                                      &offset);
 
     *buffer = (const GrVertexBuffer*) geomBuffer;
-    GrAssert(0 == offset % vertexSize);
-    *startVertex = offset / vertexSize;
+    GrAssert(0 == offset % vSize);
+    *startVertex = offset / vSize;
     return ptr;
 }
 
-bool GrVertexBufferAllocPool::appendVertices(size_t vertexSize,
+bool GrVertexBufferAllocPool::appendVertices(GrVertexLayout layout,
                                              int vertexCount,
                                              const void* vertices,
                                              const GrVertexBuffer** buffer,
                                              int* startVertex) {
-    void* space = makeSpace(vertexSize, vertexCount, buffer, startVertex);
+    void* space = makeSpace(layout, vertexCount, buffer, startVertex);
     if (NULL != space) {
         memcpy(space,
                vertices,
-               vertexSize * vertexCount);
+               GrDrawState::VertexSize(layout) * vertexCount);
         return true;
     } else {
         return false;
     }
 }
 
-int GrVertexBufferAllocPool::preallocatedBufferVertices(size_t vertexSize) const {
-    return INHERITED::preallocatedBufferSize() / vertexSize;
+int GrVertexBufferAllocPool::preallocatedBufferVertices(GrVertexLayout layout) const {
+    return INHERITED::preallocatedBufferSize() /
+            GrDrawState::VertexSize(layout);
 }
 
-int GrVertexBufferAllocPool::currentBufferVertices(size_t vertexSize) const {
-    return currentBufferItems(vertexSize);
+int GrVertexBufferAllocPool::currentBufferVertices(GrVertexLayout layout) const {
+    return currentBufferItems(GrDrawState::VertexSize(layout));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
index ffd8c34..654ba74 100644 (file)
@@ -222,7 +222,7 @@ public:
      * the buffer at the offset indicated by startVertex. Until that time they
      * may be in temporary storage and/or the buffer may be locked.
      *
-     * @param vertexSize   specifies size of a vertex to allocate space for
+     * @param layout       specifies type of vertices to allocate space for
      * @param vertexCount  number of vertices to allocate space for
      * @param buffer       returns the vertex buffer that will hold the
      *                     vertices.
@@ -230,7 +230,7 @@ public:
      *                     In units of the size of a vertex from layout param.
      * @return pointer to first vertex.
      */
-    void* makeSpace(size_t vertexSize,
+    void* makeSpace(GrVertexLayout layout,
                     int vertexCount,
                     const GrVertexBuffer** buffer,
                     int* startVertex);
@@ -238,7 +238,7 @@ public:
     /**
      * Shortcut to make space and then write verts into the made space.
      */
-    bool appendVertices(size_t vertexSize,
+    bool appendVertices(GrVertexLayout layout,
                         int vertexCount,
                         const void* vertices,
                         const GrVertexBuffer** buffer,
@@ -251,21 +251,21 @@ public:
      * would fit in the next available preallocated buffer. If any makeSpace
      * would force a new VB to be created the return value will be zero.
      *
-     * @param   the size of a vertex to compute space for.
+     * @param   the format of vertices to compute space for.
      * @return the number of vertices that would fit in the current buffer.
      */
-    int currentBufferVertices(size_t vertexSize) const;
+    int currentBufferVertices(GrVertexLayout layout) const;
 
     /**
      * Gets the number of vertices that can fit in a  preallocated vertex buffer.
      * Zero if no preallocated buffers.
      *
-     * @param   the size of a vertex to compute space for.
+     * @param   the format of vertices to compute space for.
      *
      * @return number of vertices that fit in one of the preallocated vertex
      *         buffers.
      */
-    int preallocatedBufferVertices(size_t vertexSize) const;
+    int preallocatedBufferVertices(GrVertexLayout layout) const;
 
 private:
     typedef GrBufferAllocPool INHERITED;
index 04ffaa4..d2d1d8d 100644 (file)
@@ -86,7 +86,7 @@ bool GrDrawTarget::reserveVertexSpace(GrVertexLayout vertexLayout,
         this->releasePreviousVertexSource();
         geoSrc.fVertexSrc = kNone_GeometrySrcType;
 
-        acquired = this->onReserveVertexSpace(GrDrawState::VertexSize(vertexLayout),
+        acquired = this->onReserveVertexSpace(vertexLayout,
                                               vertexCount,
                                               vertices);
     }
@@ -126,7 +126,7 @@ bool GrDrawTarget::reserveVertexAndIndexSpace(GrVertexLayout vertexLayout,
                                               int indexCount,
                                               void** vertices,
                                               void** indices) {
-    this->willReserveVertexAndIndexSpace(GrDrawState::VertexSize(vertexLayout), vertexCount, indexCount);
+    this->willReserveVertexAndIndexSpace(vertexLayout, vertexCount, indexCount);
     if (vertexCount) {
         if (!this->reserveVertexSpace(vertexLayout, vertexCount, vertices)) {
             if (indexCount) {
@@ -146,7 +146,7 @@ bool GrDrawTarget::reserveVertexAndIndexSpace(GrVertexLayout vertexLayout,
     return true;
 }
 
-bool GrDrawTarget::geometryHints(size_t vertexSize,
+bool GrDrawTarget::geometryHints(GrVertexLayout vertexLayout,
                                  int32_t* vertexCount,
                                  int32_t* indexCount) const {
     if (NULL != vertexCount) {
index 1c8ada1..2d1ca6c 100644 (file)
@@ -254,7 +254,7 @@ public:
      * Also may hint whether the draw target should be flushed first. This is
      * useful for deferred targets.
      *
-     * @param vertexSize   size of vertices caller would like to reserve
+     * @param vertexLayout layout of vertices caller would like to reserve
      * @param vertexCount  in: hint about how many vertices the caller would
      *                     like to allocate.
      *                     out: a hint about the number of vertices that can be
@@ -268,7 +268,7 @@ public:
      *
      * @return  true if target should be flushed based on the input values.
      */
-    virtual bool geometryHints(size_t vertexSize,
+    virtual bool geometryHints(GrVertexLayout vertexLayout,
                                int* vertexCount,
                                int* indexCount) const;
 
@@ -761,10 +761,10 @@ protected:
 private:
     // A subclass can optionally overload this function to be notified before
     // vertex and index space is reserved.
-    virtual void willReserveVertexAndIndexSpace(size_t vertexSize, int vertexCount, int indexCount) {}
+    virtual void willReserveVertexAndIndexSpace(GrVertexLayout,int vertexCount, int indexCount) {}
 
     // implemented by subclass to allocate space for reserved geom
-    virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertices) = 0;
+    virtual bool onReserveVertexSpace(GrVertexLayout, int vertexCount, void** vertices) = 0;
     virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0;
     // implemented by subclass to handle release of reserved geom space
     virtual void releaseReservedVertexSpace() = 0;
index 4cce03f..b0ce7fe 100644 (file)
@@ -429,7 +429,7 @@ void GrGpu::prepareIndexPool() {
     }
 }
 
-bool GrGpu::onReserveVertexSpace(size_t vertexSize,
+bool GrGpu::onReserveVertexSpace(GrVertexLayout vertexLayout,
                                  int vertexCount,
                                  void** vertices) {
     GeometryPoolState& geomPoolState = fGeomPoolStateStack.back();
@@ -439,7 +439,7 @@ bool GrGpu::onReserveVertexSpace(size_t vertexSize,
 
     this->prepareVertexPool();
 
-    *vertices = fVertexPool->makeSpace(vertexSize,
+    *vertices = fVertexPool->makeSpace(vertexLayout,
                                        vertexCount,
                                        &geomPoolState.fPoolVertexBuffer,
                                        &geomPoolState.fPoolStartVertex);
@@ -490,7 +490,7 @@ void GrGpu::onSetVertexSourceToArray(const void* vertexArray, int vertexCount) {
 #if GR_DEBUG
     bool success =
 #endif
-    fVertexPool->appendVertices(GrDrawState::VertexSize(this->getVertexLayout()),
+    fVertexPool->appendVertices(this->getVertexLayout(),
                                 vertexCount,
                                 vertexArray,
                                 &geomPoolState.fPoolVertexBuffer,
index bcda257..ebfc60f 100644 (file)
@@ -423,7 +423,7 @@ protected:
 
 private:
     // GrDrawTarget overrides
-    virtual bool onReserveVertexSpace(size_t vSize, int vertexCount, void** vertices) SK_OVERRIDE;
+    virtual bool onReserveVertexSpace(GrVertexLayout, int vertexCount, void** vertices) SK_OVERRIDE;
     virtual bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE;
     virtual void releaseReservedVertexSpace() SK_OVERRIDE;
     virtual void releaseReservedIndexSpace() SK_OVERRIDE;
index a0e3e99..197cf0b 100644 (file)
@@ -592,7 +592,7 @@ void GrInOrderDrawBuffer::setAutoFlushTarget(GrDrawTarget* target) {
 }
 
 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(
-                                size_t vertexSize,
+                                GrVertexLayout vertexLayout,
                                 int vertexCount,
                                 int indexCount) {
     if (NULL != fAutoFlushTarget) {
@@ -624,14 +624,14 @@ void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(
             !unreleasedVertexSpace &&
             !unreleasedIndexSpace &&
             !targetHasReservedGeom &&
-            this->geometryHints(vertexSize, &vcount, &icount)) {
+            this->geometryHints(vertexLayout, &vcount, &icount)) {
 
             this->flushTo(fAutoFlushTarget);
         }
     }
 }
 
-bool GrInOrderDrawBuffer::geometryHints(size_t vertexSize,
+bool GrInOrderDrawBuffer::geometryHints(GrVertexLayout vertexLayout,
                                         int* vertexCount,
                                         int* indexCount) const {
     // we will recommend a flush if the data could fit in a single
@@ -649,10 +649,10 @@ bool GrInOrderDrawBuffer::geometryHints(size_t vertexSize,
         *indexCount = currIndices;
     }
     if (NULL != vertexCount) {
-        int32_t currVertices = fVertexPool.currentBufferVertices(vertexSize);
+        int32_t currVertices = fVertexPool.currentBufferVertices(vertexLayout);
         if (*vertexCount > currVertices &&
             (!fVertexPool.preallocatedBuffersRemaining() &&
-             *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexSize))) {
+             *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexLayout))) {
 
             flush = true;
         }
@@ -661,7 +661,7 @@ bool GrInOrderDrawBuffer::geometryHints(size_t vertexSize,
     return flush;
 }
 
-bool GrInOrderDrawBuffer::onReserveVertexSpace(size_t vertexSize,
+bool GrInOrderDrawBuffer::onReserveVertexSpace(GrVertexLayout vertexLayout,
                                                int vertexCount,
                                                void** vertices) {
     GeometryPoolState& poolState = fGeoPoolStateStack.back();
@@ -669,7 +669,7 @@ bool GrInOrderDrawBuffer::onReserveVertexSpace(size_t vertexSize,
     GrAssert(NULL != vertices);
     GrAssert(0 == poolState.fUsedPoolVertexBytes);
 
-    *vertices = fVertexPool.makeSpace(vertexSize,
+    *vertices = fVertexPool.makeSpace(vertexLayout,
                                       vertexCount,
                                       &poolState.fPoolVertexBuffer,
                                       &poolState.fPoolStartVertex);
@@ -736,7 +736,7 @@ void GrInOrderDrawBuffer::onSetVertexSourceToArray(const void* vertexArray,
 #if GR_DEBUG
     bool success =
 #endif
-    fVertexPool.appendVertices(GrDrawState::VertexSize(this->getVertexLayout()),
+    fVertexPool.appendVertices(this->getVertexLayout(),
                                vertexCount,
                                vertexArray,
                                &poolState.fPoolVertexBuffer,
index 21011c9..353d5bf 100644 (file)
@@ -100,7 +100,7 @@ public:
                                       int indicesPerInstance)
                                       SK_OVERRIDE;
 
-    virtual bool geometryHints(size_t vertexSize,
+    virtual bool geometryHints(GrVertexLayout vertexLayout,
                                int* vertexCount,
                                int* indexCount) const SK_OVERRIDE;
 
@@ -152,7 +152,7 @@ private:
     // overrides from GrDrawTarget
     virtual void onDraw(const DrawInfo&) SK_OVERRIDE;
     virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath::FillType) SK_OVERRIDE;
-    virtual bool onReserveVertexSpace(size_t vertexSize,
+    virtual bool onReserveVertexSpace(GrVertexLayout layout,
                                       int vertexCount,
                                       void** vertices) SK_OVERRIDE;
     virtual bool onReserveIndexSpace(int indexCount,
@@ -167,7 +167,7 @@ private:
     virtual void releaseIndexArray() SK_OVERRIDE;
     virtual void geometrySourceWillPush() SK_OVERRIDE;
     virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) SK_OVERRIDE;
-    virtual void willReserveVertexAndIndexSpace(size_t vertexSize,
+    virtual void willReserveVertexAndIndexSpace(GrVertexLayout vertexLayout,
                                                 int vertexCount,
                                                 int indexCount) SK_OVERRIDE;
 
index 97e92fa..206f4ca 100644 (file)
@@ -204,7 +204,7 @@ HAS_ATLAS:
         // a number of verts to reserve and whether to perform a flush.
         fMaxVertices = kMinRequestedVerts;
         bool flush = (NULL != fDrawTarget) &&
-                     fDrawTarget->geometryHints(GrDrawState::VertexSize(fVertexLayout),
+                     fDrawTarget->geometryHints(fVertexLayout,
                                                 &fMaxVertices,
                                                 NULL);
         if (flush) {
@@ -214,7 +214,7 @@ HAS_ATLAS:
         fDrawTarget = fContext->getTextTarget(fPaint);
         fMaxVertices = kDefaultRequestedVerts;
         // ignore return, no point in flushing again.
-        fDrawTarget->geometryHints(GrDrawState::VertexSize(fVertexLayout),
+        fDrawTarget->geometryHints(fVertexLayout,
                                    &fMaxVertices,
                                    NULL);
 
index 23119e8..6fbdb46 100644 (file)
@@ -51,4 +51,3 @@ private:
 };
 
 #endif
-
index e0653c6..10bbc43 100644 (file)
@@ -51,4 +51,3 @@ private:
 };
 
 #endif
-
index a7b132b..9b9e756 100644 (file)
@@ -65,4 +65,4 @@ static void TestMD5(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("MD5", MD5TestClass, TestMD5)
\ No newline at end of file
+DEFINE_TESTCLASS("MD5", MD5TestClass, TestMD5)
index 9f07849..dde828c 100644 (file)
@@ -52,4 +52,4 @@ static void TestSHA1(skiatest::Reporter* reporter) {
 }
 
 #include "TestClassDef.h"
-DEFINE_TESTCLASS("SHA1", SHA1TestClass, TestSHA1)
\ No newline at end of file
+DEFINE_TESTCLASS("SHA1", SHA1TestClass, TestSHA1)
index ecaf3b2..3715b3e 100644 (file)
@@ -86,7 +86,7 @@ static int filter_picture(const SkString& inFile, const SkString& outFile) {
                            (SkColorGetG(p0->getColor()) == SkColorGetG(p1->getColor())) &&
                            (SkColorGetB(p0->getColor()) == SkColorGetB(p1->getColor()))) {
                     commands[i]->setVisible(false);
-                    SkColor newColor = SkColorSetA(p1->getColor(), 
+                    SkColor newColor = SkColorSetA(p1->getColor(),
                                                    SkColorGetA(p0->getColor()));
                     p1->setColor(newColor);
                     commands[i+2]->setVisible(false);