diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-04-27 15:52:53 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-04-27 15:52:53 +0000 |
commit | 8d033a1b125886c62906d975b5cc28a382064526 (patch) | |
tree | 54f0ac568bd0543e777045571f1239ae182a7c36 | |
parent | 5af56069010b33562d337a4f76543d898ca8d485 (diff) |
Remove GrPath typedef
Review URL: http://codereview.appspot.com/6128045/
git-svn-id: http://skia.googlecode.com/svn/trunk@3780 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | gyp/gpu.gyp | 1 | ||||
-rw-r--r-- | include/gpu/GrClip.h | 6 | ||||
-rw-r--r-- | include/gpu/GrClipIterator.h | 4 | ||||
-rw-r--r-- | include/gpu/GrContext.h | 6 | ||||
-rw-r--r-- | include/gpu/GrGlyph.h | 4 | ||||
-rw-r--r-- | include/gpu/GrPath.h | 20 | ||||
-rw-r--r-- | include/gpu/SkGr.h | 5 | ||||
-rw-r--r-- | src/gpu/GrAAConvexPathRenderer.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrClipMaskManager.cpp | 6 | ||||
-rw-r--r-- | src/gpu/GrClipMaskManager.h | 4 | ||||
-rw-r--r-- | src/gpu/GrContext.cpp | 10 | ||||
-rw-r--r-- | src/gpu/GrDefaultPathRenderer.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrDefaultTextContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrPathUtils.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrPathUtils.h | 4 | ||||
-rw-r--r-- | src/gpu/SkGrFontScaler.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gr_unittests.cpp | 120 |
17 files changed, 30 insertions, 172 deletions
diff --git a/gyp/gpu.gyp b/gyp/gpu.gyp index f0f9821672..5e05c9accb 100644 --- a/gyp/gpu.gyp +++ b/gyp/gpu.gyp @@ -186,7 +186,6 @@ '../include/gpu/GrMatrix.h', '../include/gpu/GrNoncopyable.h', '../include/gpu/GrPaint.h', - '../include/gpu/GrPath.h', '../include/gpu/GrPoint.h', '../include/gpu/GrRect.h', '../include/gpu/GrRefCnt.h', diff --git a/include/gpu/GrClip.h b/include/gpu/GrClip.h index c94755d2b0..6f1c5d47b2 100644 --- a/include/gpu/GrClip.h +++ b/include/gpu/GrClip.h @@ -13,9 +13,9 @@ #include "GrClipIterator.h" #include "GrRect.h" -#include "GrPath.h" #include "GrTemplates.h" +#include "SkPath.h" #include "SkTArray.h" class GrClip { @@ -45,7 +45,7 @@ public: GrClipType getElementType(int i) const { return fList[i].fType; } - const GrPath& getPath(int i) const { + const SkPath& getPath(int i) const { GrAssert(kPath_ClipType == fList[i].fType); return fList[i].fPath; } @@ -113,7 +113,7 @@ private: struct Element { GrClipType fType; GrRect fRect; - GrPath fPath; + SkPath fPath; GrPathFill fPathFill; SkRegion::Op fOp; bool fDoAA; diff --git a/include/gpu/GrClipIterator.h b/include/gpu/GrClipIterator.h index 4f98c5c770..5d3bd4587d 100644 --- a/include/gpu/GrClipIterator.h +++ b/include/gpu/GrClipIterator.h @@ -11,8 +11,8 @@ #ifndef GrClipIterator_DEFINED #define GrClipIterator_DEFINED -#include "GrPath.h" #include "GrRect.h" +#include "SkPath.h" #include "SkRegion.h" /** @@ -41,7 +41,7 @@ public: * Return the current path. It is an error to call this when isDone() is * true or when getType() is kRect_Type. */ - virtual const GrPath* getPath() = 0; + virtual const SkPath* getPath() = 0; /** * Return the fill rule for the path. It is an error to call this when diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index d3723c7380..b26d2b3aee 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -411,7 +411,7 @@ public: * @param translate optional additional translation applied to the * path. */ - void drawPath(const GrPaint& paint, const GrPath& path, GrPathFill fill, + void drawPath(const GrPaint& paint, const SkPath& path, GrPathFill fill, const GrPoint* translate = NULL); /** @@ -728,12 +728,12 @@ private: GrDrawTarget* prepareToDraw(const GrPaint& paint, DrawCategory drawType); - GrPathRenderer* getPathRenderer(const GrPath& path, + GrPathRenderer* getPathRenderer(const SkPath& path, GrPathFill fill, const GrDrawTarget* target, bool antiAlias); - void internalDrawPath(const GrPaint& paint, const GrPath& path, + void internalDrawPath(const GrPaint& paint, const SkPath& path, GrPathFill fill, const GrPoint* translate); /** diff --git a/include/gpu/GrGlyph.h b/include/gpu/GrGlyph.h index a0d81a1f35..f79de7cb33 100644 --- a/include/gpu/GrGlyph.h +++ b/include/gpu/GrGlyph.h @@ -11,8 +11,8 @@ #ifndef GrGlyph_DEFINED #define GrGlyph_DEFINED -#include "GrPath.h" #include "GrRect.h" +#include "SkPath.h" class GrAtlas; @@ -26,7 +26,7 @@ struct GrGlyph { typedef uint32_t PackedID; GrAtlas* fAtlas; - GrPath* fPath; + SkPath* fPath; PackedID fPackedID; GrIRect16 fBounds; GrIPoint16 fAtlasLocation; diff --git a/include/gpu/GrPath.h b/include/gpu/GrPath.h deleted file mode 100644 index 7da0d48082..0000000000 --- a/include/gpu/GrPath.h +++ /dev/null @@ -1,20 +0,0 @@ - -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - - -#ifndef GrPath_DEFINED -#define GrPath_DEFINED - -#include "GrTypes.h" -#include "SkPath.h" - -typedef SkPath GrPath; - -#endif - diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h index 5ad90f4c7b..74dc2cfce4 100644 --- a/include/gpu/SkGr.h +++ b/include/gpu/SkGr.h @@ -18,7 +18,6 @@ #include "GrContext.h" #include "GrFontScaler.h" #include "GrClipIterator.h" -#include "GrPath.h" // skia headers #include "SkBitmap.h" @@ -120,7 +119,7 @@ public: } } - virtual const GrPath* getPath() SK_OVERRIDE { + virtual const SkPath* getPath() SK_OVERRIDE { return fCurr->fPath; } @@ -147,7 +146,7 @@ public: virtual bool getPackedGlyphBounds(GrGlyph::PackedID, GrIRect* bounds); virtual bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height, int rowBytes, void* image); - virtual bool getGlyphPath(uint16_t glyphID, GrPath*); + virtual bool getGlyphPath(uint16_t glyphID, SkPath*); private: SkGlyphCache* fStrike; diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp index 28aeef1d54..ca7ecdcb4a 100644 --- a/src/gpu/GrAAConvexPathRenderer.cpp +++ b/src/gpu/GrAAConvexPathRenderer.cpp @@ -200,7 +200,7 @@ void update_degenerate_test(DegenerateTestData* data, const GrPoint& pt) { } } -inline SkPath::Direction get_direction(const GrPath& path, const GrMatrix& m) { +inline SkPath::Direction get_direction(const SkPath& path, const GrMatrix& m) { SkPath::Direction dir; GR_DEBUGCODE(bool succeeded = ) path.cheapComputeDirection(&dir); @@ -220,7 +220,7 @@ inline SkPath::Direction get_direction(const GrPath& path, const GrMatrix& m) { return dir; } -bool get_segments(const GrPath& path, +bool get_segments(const SkPath& path, const GrMatrix& m, SegmentArray* segments, SkPoint* fanPt, diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index be6e19e704..027ec5bb4e 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -235,7 +235,7 @@ void setUpBooleanBlendCoeffs(GrDrawState* drawState, SkRegion::Op op) { //////////////////////////////////////////////////////////////////////////////// bool GrClipMaskManager::drawPath(GrGpu* gpu, - const GrPath& path, + const SkPath& path, GrPathFill fill, bool doAA) { @@ -545,7 +545,7 @@ bool GrClipMaskManager::createStencilClipMask(GrGpu* gpu, SkRegion::Op op = (c == start) ? startOp : clipCopy.getOp(c); GrPathRenderer* pr = NULL; - const GrPath* clipPath = NULL; + const SkPath* clipPath = NULL; if (kRect_ClipType == clipCopy.getElementType(c)) { canRenderDirectToStencil = true; fill = kEvenOdd_PathFill; @@ -639,7 +639,7 @@ bool GrClipMaskManager::createStencilClipMask(GrGpu* gpu, //////////////////////////////////////////////////////////////////////////////// GrPathRenderer* GrClipMaskManager::getClipPathRenderer(GrGpu* gpu, - const GrPath& path, + const SkPath& path, GrPathFill fill, bool antiAlias) { if (NULL == fPathRendererChain) { diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h index 3e7b88eaab..e698791677 100644 --- a/src/gpu/GrClipMaskManager.h +++ b/src/gpu/GrClipMaskManager.h @@ -10,7 +10,7 @@ #define GrClipMaskManager_DEFINED #include "GrRect.h" -#include "GrPath.h" +#include "SkPath.h" class GrGpu; class GrClip; @@ -79,7 +79,7 @@ private: bool createAlphaClipMask(GrGpu* gpu, const GrClip& clipIn); bool drawPath(GrGpu* gpu, - const GrPath& path, + const SkPath& path, GrPathFill fill, bool doAA); diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 7ee2b71746..835ab23368 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -1293,7 +1293,7 @@ SkPath::FillType gr_fill_to_sk_fill(GrPathFill fill) { // path bounds will be a subset of the clip bounds. returns false if // path bounds would be empty. bool get_path_and_clip_bounds(const GrDrawTarget* target, - const GrPath& path, + const SkPath& path, const GrVec* translate, GrIRect* pathBounds, GrIRect* clipBounds) { @@ -1336,7 +1336,7 @@ bool get_path_and_clip_bounds(const GrDrawTarget* target, * scratch texture. */ -bool sw_draw_path_to_mask_texture(const GrPath& clientPath, +bool sw_draw_path_to_mask_texture(const SkPath& clientPath, const GrIRect& pathDevBounds, GrPathFill fill, GrContext* context, @@ -1606,7 +1606,7 @@ bool onDrawPath(const SkPath& path, return false; } -void GrContext::drawPath(const GrPaint& paint, const GrPath& path, +void GrContext::drawPath(const GrPaint& paint, const SkPath& path, GrPathFill fill, const GrPoint* translate) { if (path.isEmpty()) { @@ -1629,7 +1629,7 @@ void GrContext::drawPath(const GrPaint& paint, const GrPath& path, internalDrawPath(paint, path, fill, translate); } -void GrContext::internalDrawPath(const GrPaint& paint, const GrPath& path, +void GrContext::internalDrawPath(const GrPaint& paint, const SkPath& path, GrPathFill fill, const GrPoint* translate) { // Note that below we may sw-rasterize the path into a scratch texture. @@ -2113,7 +2113,7 @@ GrDrawTarget* GrContext::prepareToDraw(const GrPaint& paint, return target; } -GrPathRenderer* GrContext::getPathRenderer(const GrPath& path, +GrPathRenderer* GrContext::getPathRenderer(const SkPath& path, GrPathFill fill, const GrDrawTarget* target, bool antiAlias) { diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp index b164131eba..27e3fa89a5 100644 --- a/src/gpu/GrDefaultPathRenderer.cpp +++ b/src/gpu/GrDefaultPathRenderer.cpp @@ -150,7 +150,7 @@ GR_STATIC_CONST_SAME_STENCIL(gDirectToStencil, #define STENCIL_OFF 0 // Always disable stencil (even when needed) -static inline bool single_pass_path(const GrPath& path, GrPathFill fill) { +static inline bool single_pass_path(const SkPath& path, GrPathFill fill) { #if STENCIL_OFF return true; #else diff --git a/src/gpu/GrDefaultTextContext.cpp b/src/gpu/GrDefaultTextContext.cpp index a606dd5c64..3bb8543c34 100644 --- a/src/gpu/GrDefaultTextContext.cpp +++ b/src/gpu/GrDefaultTextContext.cpp @@ -220,7 +220,7 @@ void GrDefaultTextContext::drawPackedGlyph(GrGlyph::PackedID packed, } if (NULL == glyph->fPath) { - GrPath* path = new GrPath; + SkPath* path = new SkPath; if (!scaler->getGlyphPath(glyph->glyphID(), path)) { // flag the glyph as being dead? delete path; diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp index cecc514f35..aa18792574 100644 --- a/src/gpu/GrPathUtils.cpp +++ b/src/gpu/GrPathUtils.cpp @@ -145,7 +145,7 @@ uint32_t GrPathUtils::generateCubicPoints(const GrPoint& p0, return a + b; } -int GrPathUtils::worstCasePointCount(const GrPath& path, int* subpaths, +int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths, GrScalar tol) { if (tol < gMinCurveTol) { tol = gMinCurveTol; diff --git a/src/gpu/GrPathUtils.h b/src/gpu/GrPathUtils.h index 403f03ae16..a1d0eb630b 100644 --- a/src/gpu/GrPathUtils.h +++ b/src/gpu/GrPathUtils.h @@ -11,7 +11,7 @@ #define GrPathUtils_DEFINED #include "GrMatrix.h" -#include "GrPath.h" +#include "SkPath.h" #include "SkTArray.h" /** @@ -24,7 +24,7 @@ namespace GrPathUtils { /// Since we divide by tol if we're computing exact worst-case bounds, /// very small tolerances will be increased to gMinCurveTol. - int worstCasePointCount(const GrPath&, + int worstCasePointCount(const SkPath&, int* subpaths, GrScalar tol); diff --git a/src/gpu/SkGrFontScaler.cpp b/src/gpu/SkGrFontScaler.cpp index 95c29ffe69..d2e099b03d 100644 --- a/src/gpu/SkGrFontScaler.cpp +++ b/src/gpu/SkGrFontScaler.cpp @@ -159,7 +159,7 @@ bool SkGrFontScaler::getPackedGlyphImage(GrGlyph::PackedID packed, } // we should just return const SkPath* (NULL means false) -bool SkGrFontScaler::getGlyphPath(uint16_t glyphID, GrPath* path) { +bool SkGrFontScaler::getGlyphPath(uint16_t glyphID, SkPath* path) { const SkGlyph& glyph = fStrike->getGlyphIDMetrics(glyphID); const SkPath* skPath = fStrike->findPath(glyph); diff --git a/src/gpu/gr_unittests.cpp b/src/gpu/gr_unittests.cpp index 6e51e19a7c..4adc7e9c82 100644 --- a/src/gpu/gr_unittests.cpp +++ b/src/gpu/gr_unittests.cpp @@ -11,7 +11,6 @@ #include "GrBinHashKey.h" #include "GrDrawTarget.h" #include "GrMatrix.h" -#include "GrPath.h" #include "GrRedBlackTree.h" #include "GrTDArray.h" @@ -102,130 +101,11 @@ static void test_binHashKey() GrAssert(keyA.getHash() != keyB.getHash()); } -static void test_convex() { -#if 0 - GrPath testPath; - GrPath::Iter testIter; - - GrPath pt; - pt.moveTo(0, 0); - pt.close(); - - testIter.reset(pt); - testPath.resetFromIter(&testIter); - GrAssert(kConvex_ConvexHint == testPath.getConvexHint()); - - GrPath line; - line.moveTo(GrIntToScalar(12), GrIntToScalar(20)); - line.lineTo(GrIntToScalar(-12), GrIntToScalar(-20)); - line.close(); - - testIter.reset(line); - testPath.resetFromIter(&testIter); - GrAssert(kConvex_ConvexHint == testPath.getConvexHint()); - - GrPath triLeft; - triLeft.moveTo(0, 0); - triLeft.lineTo(1, 0); - triLeft.lineTo(1, 1); - triLeft.close(); - - testIter.reset(triLeft); - testPath.resetFromIter(&testIter); - GrAssert(kConvex_ConvexHint == testPath.getConvexHint()); - - GrPath triRight; - triRight.moveTo(0, 0); - triRight.lineTo(-1, 0); - triRight.lineTo(1, 1); - triRight.close(); - - testIter.reset(triRight); - testPath.resetFromIter(&testIter); - GrAssert(kConvex_ConvexHint == testPath.getConvexHint()); - - GrPath square; - square.moveTo(0, 0); - square.lineTo(1, 0); - square.lineTo(1, 1); - square.lineTo(0, 1); - square.close(); - - testIter.reset(square); - testPath.resetFromIter(&testIter); - GrAssert(kConvex_ConvexHint == testPath.getConvexHint()); - - GrPath redundantSquare; - square.moveTo(0, 0); - square.lineTo(0, 0); - square.lineTo(0, 0); - square.lineTo(1, 0); - square.lineTo(1, 0); - square.lineTo(1, 0); - square.lineTo(1, 1); - square.lineTo(1, 1); - square.lineTo(1, 1); - square.lineTo(0, 1); - square.lineTo(0, 1); - square.lineTo(0, 1); - square.close(); - - testIter.reset(redundantSquare); - testPath.resetFromIter(&testIter); - GrAssert(kConvex_ConvexHint == testPath.getConvexHint()); - - GrPath bowTie; - bowTie.moveTo(0, 0); - bowTie.lineTo(0, 0); - bowTie.lineTo(0, 0); - bowTie.lineTo(1, 1); - bowTie.lineTo(1, 1); - bowTie.lineTo(1, 1); - bowTie.lineTo(1, 0); - bowTie.lineTo(1, 0); - bowTie.lineTo(1, 0); - bowTie.lineTo(0, 1); - bowTie.lineTo(0, 1); - bowTie.lineTo(0, 1); - bowTie.close(); - - testIter.reset(bowTie); - testPath.resetFromIter(&testIter); - GrAssert(kConcave_ConvexHint == testPath.getConvexHint()); - - GrPath spiral; - spiral.moveTo(0, 0); - spiral.lineTo(1, 0); - spiral.lineTo(1, 1); - spiral.lineTo(0, 1); - spiral.lineTo(0,.5); - spiral.lineTo(.5,.5); - spiral.lineTo(.5,.75); - spiral.close(); - - testIter.reset(spiral); - testPath.resetFromIter(&testIter); - GrAssert(kConcave_ConvexHint == testPath.getConvexHint()); - - GrPath dent; - dent.moveTo(0, 0); - dent.lineTo(1, 1); - dent.lineTo(0, 1); - dent.lineTo(-.5,2); - dent.lineTo(-2, 1); - dent.close(); - - testIter.reset(dent); - testPath.resetFromIter(&testIter); - GrAssert(kConcave_ConvexHint == testPath.getConvexHint()); -#endif -} void gr_run_unittests() { test_tdarray(); test_bsearch(); test_binHashKey(); - test_convex(); GrRedBlackTree<int>::UnitTest(); GrDrawTarget::VertexLayoutUnitTest(); } |