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
This commit is contained in:
parent
5af5606901
commit
8d033a1b12
@ -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',
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user