Remove unneeded sk/gr conversion code
Review URL: http://codereview.appspot.com/4876055/ git-svn-id: http://skia.googlecode.com/svn/trunk@2123 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
37be7b0b01
commit
178d41e750
@ -32,37 +32,9 @@
|
||||
// #error "inconsistent GR_DEBUG and SK_DEBUG"
|
||||
#endif
|
||||
|
||||
#if GR_SCALAR_IS_FIXED
|
||||
#ifdef SK_SCALAR_IS_FIXED
|
||||
#define SK_SCALAR_IS_GR_SCALAR 1
|
||||
#else
|
||||
#define SK_SCALAR_IS_GR_SCALAR 0
|
||||
#endif
|
||||
#define SkScalarToGrScalar(x) SkScalarToFixed(x)
|
||||
|
||||
#elif GR_SCALAR_IS_FLOAT
|
||||
|
||||
#ifdef SK_SCALAR_IS_FLOAT
|
||||
#define SK_SCALAR_IS_GR_SCALAR 1
|
||||
#else
|
||||
#define SK_SCALAR_IS_GR_SCALAR 0
|
||||
#endif
|
||||
#define SkScalarToGrScalar(x) SkScalarToFloat(x)
|
||||
|
||||
#else
|
||||
#error "Ganesh scalar type not defined"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Sk to Gr Type conversions
|
||||
|
||||
// Verify that SkPoint and GrPoint are compatible if using the same scalar type
|
||||
#if 0/*SK_SCALAR_IS_GR_SCALAR*/
|
||||
GR_STATIC_ASSERT(sizeof(SkPoint) == sizeof(GrPoint));
|
||||
GR_STATIC_ASSERT(offsetof(SkPoint,fX) == offsetof(GrPoint,fX)));
|
||||
GR_STATIC_ASSERT(offsetof(SkPoint,fY) == offsetof(GrPoint,fY)));
|
||||
#endif
|
||||
|
||||
GR_STATIC_ASSERT((int)GrSamplerState::kClamp_WrapMode == (int)SkShader::kClamp_TileMode);
|
||||
GR_STATIC_ASSERT((int)GrSamplerState::kRepeat_WrapMode ==(
|
||||
int)SkShader::kRepeat_TileMode);
|
||||
|
@ -550,8 +550,8 @@ public:
|
||||
|
||||
void writeValue(int i, GrPoint* dstPosition) const {
|
||||
SkASSERT(i < fCount);
|
||||
dstPosition->fX = SkScalarToGrScalar(fPoints[i].fX);
|
||||
dstPosition->fY = SkScalarToGrScalar(fPoints[i].fY);
|
||||
dstPosition->fX = fPoints[i].fX;
|
||||
dstPosition->fY = fPoints[i].fY;
|
||||
}
|
||||
private:
|
||||
const SkPoint* fPoints;
|
||||
@ -564,8 +564,8 @@ public:
|
||||
: fCoords(coords) {}
|
||||
|
||||
void writeValue(int i, GrPoint* dstCoord) const {
|
||||
dstCoord->fX = SkScalarToGrScalar(fCoords[i].fX);
|
||||
dstCoord->fY = SkScalarToGrScalar(fCoords[i].fY);
|
||||
dstCoord->fX = fCoords[i].fX;
|
||||
dstCoord->fY = fCoords[i].fY;
|
||||
}
|
||||
private:
|
||||
const SkPoint* fCoords;
|
||||
@ -599,75 +599,6 @@ private:
|
||||
int fCount;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if 0 // not currently being used so don't compile,
|
||||
|
||||
// can be used for positions or texture coordinates
|
||||
|
||||
class SkRectFanSource {
|
||||
public:
|
||||
SkRectFanSource(const SkRect& rect) : fRect(rect) {}
|
||||
|
||||
int count() const { return 4; }
|
||||
|
||||
void writeValue(int i, GrPoint* dstPoint) const {
|
||||
SkASSERT(i < 4);
|
||||
dstPoint->fX = SkScalarToGrScalar((i % 3) ? fRect.fRight :
|
||||
fRect.fLeft);
|
||||
dstPoint->fY = SkScalarToGrScalar((i < 2) ? fRect.fTop :
|
||||
fRect.fBottom);
|
||||
}
|
||||
private:
|
||||
const SkRect& fRect;
|
||||
};
|
||||
|
||||
class SkIRectFanSource {
|
||||
public:
|
||||
SkIRectFanSource(const SkIRect& rect) : fRect(rect) {}
|
||||
|
||||
int count() const { return 4; }
|
||||
|
||||
void writeValue(int i, GrPoint* dstPoint) const {
|
||||
SkASSERT(i < 4);
|
||||
dstPoint->fX = (i % 3) ? GrIntToScalar(fRect.fRight) :
|
||||
GrIntToScalar(fRect.fLeft);
|
||||
dstPoint->fY = (i < 2) ? GrIntToScalar(fRect.fTop) :
|
||||
GrIntToScalar(fRect.fBottom);
|
||||
}
|
||||
private:
|
||||
const SkIRect& fRect;
|
||||
};
|
||||
|
||||
class SkMatRectFanSource {
|
||||
public:
|
||||
SkMatRectFanSource(const SkRect& rect, const SkMatrix& matrix)
|
||||
: fRect(rect), fMatrix(matrix) {}
|
||||
|
||||
int count() const { return 4; }
|
||||
|
||||
void writeValue(int i, GrPoint* dstPoint) const {
|
||||
SkASSERT(i < 4);
|
||||
|
||||
#if SK_SCALAR_IS_GR_SCALAR
|
||||
fMatrix.mapXY((i % 3) ? fRect.fRight : fRect.fLeft,
|
||||
(i < 2) ? fRect.fTop : fRect.fBottom,
|
||||
(SkPoint*)dstPoint);
|
||||
#else
|
||||
SkPoint dst;
|
||||
fMatrix.mapXY((i % 3) ? fRect.fRight : fRect.fLeft,
|
||||
(i < 2) ? fRect.fTop : fRect.fBottom,
|
||||
&dst);
|
||||
dstPoint->fX = SkScalarToGrScalar(dst.fX);
|
||||
dstPoint->fY = SkScalarToGrScalar(dst.fY);
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
const SkRect& fRect;
|
||||
const SkMatrix& fMatrix;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -723,7 +654,6 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
|
||||
return;
|
||||
}
|
||||
|
||||
#if SK_SCALAR_IS_GR_SCALAR
|
||||
fContext->drawVertices(grPaint,
|
||||
gPointMode2PrimtiveType[mode],
|
||||
count,
|
||||
@ -732,11 +662,6 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
|
||||
NULL,
|
||||
NULL,
|
||||
0);
|
||||
#else
|
||||
fContext->drawCustomVertices(grPaint,
|
||||
gPointMode2PrimtiveType[mode],
|
||||
SkPositionSource(pts, count));
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -1539,7 +1464,6 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
|
||||
}
|
||||
}
|
||||
|
||||
#if SK_SCALAR_IS_GR_SCALAR
|
||||
// even if GrColor and SkColor byte offsets match we need
|
||||
// to perform pre-multiply.
|
||||
if (NULL == colors) {
|
||||
@ -1551,9 +1475,7 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
|
||||
NULL,
|
||||
indices,
|
||||
indexCount);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
SkTexCoordSource texSrc(texs);
|
||||
SkColorSource colSrc(colors);
|
||||
SkIndexSource idxSrc(indices, indexCount);
|
||||
|
Loading…
Reference in New Issue
Block a user