aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-06 15:32:52 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-06 15:32:52 +0000
commit39ee0ffa72fbd5df6d3ec6db4fdad0c1bc3946fd (patch)
tree02cd7e93425776b39d82b5f4673832d058e57502 /src/gpu
parentb0c5e078d8af06ec3ce5ea2cdc86c2f1084457a2 (diff)
Prep #1 for making GrDrawState a class
Review URL: http://codereview.appspot.com/5437138/ git-svn-id: http://skia.googlecode.com/svn/trunk@2808 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.cpp14
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.h6
-rw-r--r--src/gpu/GrContext.cpp6
-rw-r--r--src/gpu/GrDefaultPathRenderer.cpp24
-rw-r--r--src/gpu/GrDefaultPathRenderer.h8
-rw-r--r--src/gpu/GrDrawState.h6
-rw-r--r--src/gpu/GrDrawTarget.cpp13
-rw-r--r--src/gpu/GrDrawTarget.h26
-rw-r--r--src/gpu/GrInOrderDrawBuffer.cpp6
-rw-r--r--src/gpu/GrInOrderDrawBuffer.h2
-rw-r--r--src/gpu/GrPathRenderer.h2
-rw-r--r--src/gpu/GrTesselatedPathRenderer.cpp4
-rw-r--r--src/gpu/GrTesselatedPathRenderer.h2
-rw-r--r--src/gpu/GrTextContext.cpp4
-rw-r--r--src/gpu/SkGpuDevice.cpp30
15 files changed, 78 insertions, 75 deletions
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index eafe9ebdc2..e306b676b0 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -601,7 +601,7 @@ void add_line(const SkPoint p[2],
}
-bool GrAAHairLinePathRenderer::createGeom(GrDrawTarget::StageBitfield stages) {
+bool GrAAHairLinePathRenderer::createGeom(GrDrawState::StageMask stageMask) {
int rtHeight = fTarget->getRenderTarget()->height();
@@ -616,7 +616,7 @@ bool GrAAHairLinePathRenderer::createGeom(GrDrawTarget::StageBitfield stages) {
// If none of the inputs that affect generation of path geometry have
// have changed since last previous path draw then we can reuse the
// previous geoemtry.
- if (stages == fPreviousStages &&
+ if (stageMask == fPreviousStages &&
fPreviousViewMatrix == fTarget->getViewMatrix() &&
fPreviousTranslate == fTranslate &&
rtHeight == fPreviousRTHeight &&
@@ -626,7 +626,7 @@ bool GrAAHairLinePathRenderer::createGeom(GrDrawTarget::StageBitfield stages) {
GrVertexLayout layout = GrDrawTarget::kEdge_VertexLayoutBit;
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
- if ((1 << s) & stages) {
+ if ((1 << s) & stageMask) {
layout |= GrDrawTarget::StagePosAsTexCoordVertexLayoutBit(s);
}
}
@@ -671,7 +671,7 @@ bool GrAAHairLinePathRenderer::createGeom(GrDrawTarget::StageBitfield stages) {
add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &verts);
}
- fPreviousStages = stages;
+ fPreviousStages = stageMask;
fPreviousViewMatrix = fTarget->getViewMatrix();
fPreviousRTHeight = rtHeight;
fClipRect = clip;
@@ -679,9 +679,9 @@ bool GrAAHairLinePathRenderer::createGeom(GrDrawTarget::StageBitfield stages) {
return true;
}
-void GrAAHairLinePathRenderer::drawPath(GrDrawTarget::StageBitfield stages) {
+void GrAAHairLinePathRenderer::drawPath(GrDrawState::StageMask stageMask) {
- if (!this->createGeom(stages)) {
+ if (!this->createGeom(stageMask)) {
return;
}
@@ -690,7 +690,7 @@ void GrAAHairLinePathRenderer::drawPath(GrDrawTarget::StageBitfield stages) {
asr.set(fTarget);
GrMatrix ivm;
if (fTarget->getViewInverse(&ivm)) {
- fTarget->preConcatSamplerMatrices(stages, ivm);
+ fTarget->preConcatSamplerMatrices(stageMask, ivm);
}
fTarget->setViewMatrix(GrMatrix::I());
}
diff --git a/src/gpu/GrAAHairLinePathRenderer.h b/src/gpu/GrAAHairLinePathRenderer.h
index 1d561fa4c2..3b29919f9e 100644
--- a/src/gpu/GrAAHairLinePathRenderer.h
+++ b/src/gpu/GrAAHairLinePathRenderer.h
@@ -21,7 +21,7 @@ public:
const SkPath& path,
GrPathFill fill,
bool antiAlias) const SK_OVERRIDE;
- virtual void drawPath(GrDrawTarget::StageBitfield stages) SK_OVERRIDE;
+ virtual void drawPath(GrDrawState::StageMask stages) SK_OVERRIDE;
protected:
@@ -35,13 +35,13 @@ private:
const GrIndexBuffer* fLinesIndexBuffer,
const GrIndexBuffer* fQuadsIndexBuffer);
- bool createGeom(GrDrawTarget::StageBitfield stages);
+ bool createGeom(GrDrawState::StageMask stages);
const GrIndexBuffer* fLinesIndexBuffer;
const GrIndexBuffer* fQuadsIndexBuffer;
// have to recreate geometry if stages in use changes :(
- GrDrawTarget::StageBitfield fPreviousStages;
+ GrDrawState::StageMask fPreviousStages;
int fPreviousRTHeight;
SkVector fPreviousTranslate;
GrIRect fClipRect;
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 9f82a15e6e..335b9f4354 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1551,7 +1551,7 @@ void GrContext::drawPath(const GrPaint& paint, const GrPath& path,
}
GrPathRenderer::AutoClearPath arp(pr, target, &path, fill, prAA, translate);
- GrDrawTarget::StageBitfield stageMask = paint.getActiveStageMask();
+ GrDrawState::StageMask stageMask = paint.getActiveStageMask();
if (doOSAA) {
bool needsStencil = pr->requiresStencilPass(target, path, fill);
@@ -1925,7 +1925,7 @@ void GrContext::setPaint(const GrPaint& paint, GrDrawTarget* target) {
int s = i + GrPaint::kFirstTextureStage;
target->setTexture(s, paint.getTexture(i));
ASSERT_OWNED_RESOURCE(paint.getTexture(i));
- target->setSamplerState(s, *paint.getTextureSampler(i));
+ target->setSamplerState(s, paint.getTextureSampler(i));
}
target->setFirstCoverageStage(GrPaint::kFirstMaskStage);
@@ -1934,7 +1934,7 @@ void GrContext::setPaint(const GrPaint& paint, GrDrawTarget* target) {
int s = i + GrPaint::kFirstMaskStage;
target->setTexture(s, paint.getMask(i));
ASSERT_OWNED_RESOURCE(paint.getMask(i));
- target->setSamplerState(s, *paint.getMaskSampler(i));
+ target->setSamplerState(s, paint.getMaskSampler(i));
}
target->setColor(paint.fColor);
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index b9d9360b4a..197ee061dc 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -227,8 +227,8 @@ static inline void append_countour_edge_indices(GrPathFill fillType,
*((*indices)++) = edgeV0Idx + 1;
}
-bool GrDefaultPathRenderer::createGeom(GrScalar srcSpaceTol,
- GrDrawTarget::StageBitfield stages) {
+bool GrDefaultPathRenderer::createGeom(GrScalar srcSpaceTol,
+ GrDrawState::StageMask stageMask) {
{
SK_TRACE_EVENT0("GrDefaultPathRenderer::createGeom");
@@ -246,7 +246,7 @@ bool GrDefaultPathRenderer::createGeom(GrScalar srcSpaceTol,
GrVertexLayout layout = 0;
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
- if ((1 << s) & stages) {
+ if ((1 << s) & stageMask) {
layout |= GrDrawTarget::StagePosAsTexCoordVertexLayoutBit(s);
}
}
@@ -377,11 +377,11 @@ FINISHED:
// setPath/clearPath block we won't assume geom was created on a subsequent
// drawPath in the same block.
fPreviousSrcTol = srcSpaceTol;
- fPreviousStages = stages;
+ fPreviousStages = stageMask;
return true;
}
-void GrDefaultPathRenderer::onDrawPath(GrDrawTarget::StageBitfield stages,
+void GrDefaultPathRenderer::onDrawPath(GrDrawState::StageMask stageMask,
bool stencilOnly) {
GrMatrix viewM = fTarget->getViewMatrix();
@@ -397,8 +397,8 @@ void GrDefaultPathRenderer::onDrawPath(GrDrawTarget::StageBitfield stages,
// won't change the stages in use inside a setPath / removePath pair. But
// it is a silly limitation of the GrDrawTarget design that should be fixed.
if (tol != fPreviousSrcTol ||
- stages != fPreviousStages) {
- if (!this->createGeom(tol, stages)) {
+ stageMask != fPreviousStages) {
+ if (!this->createGeom(tol, stageMask)) {
return;
}
}
@@ -525,12 +525,12 @@ void GrDefaultPathRenderer::onDrawPath(GrDrawTarget::StageBitfield stages,
fTarget->getViewInverse(&vmi)) {
vmi.mapRect(&bounds);
} else {
- if (stages) {
+ if (stageMask) {
if (!fTarget->getViewInverse(&vmi)) {
GrPrintf("Could not invert matrix.");
return;
}
- fTarget->preConcatSamplerMatrices(stages, vmi);
+ fTarget->preConcatSamplerMatrices(stageMask, vmi);
}
fTarget->setViewMatrix(GrMatrix::I());
}
@@ -539,7 +539,7 @@ void GrDefaultPathRenderer::onDrawPath(GrDrawTarget::StageBitfield stages,
bounds.offset(fTranslate);
}
GrDrawTarget::AutoGeometryPush agp(fTarget);
- fTarget->drawSimpleRect(bounds, NULL, stages);
+ fTarget->drawSimpleRect(bounds, NULL, stageMask);
} else {
if (passCount > 1) {
fTarget->enableState(GrDrawTarget::kNoColorWrites_StateBit);
@@ -560,8 +560,8 @@ void GrDefaultPathRenderer::onDrawPath(GrDrawTarget::StageBitfield stages,
}
}
-void GrDefaultPathRenderer::drawPath(GrDrawTarget::StageBitfield stages) {
- this->onDrawPath(stages, false);
+void GrDefaultPathRenderer::drawPath(GrDrawState::StageMask stageMask) {
+ this->onDrawPath(stageMask, false);
}
void GrDefaultPathRenderer::drawPathToStencil() {
diff --git a/src/gpu/GrDefaultPathRenderer.h b/src/gpu/GrDefaultPathRenderer.h
index 2a34a3d2ca..adfe7d2de1 100644
--- a/src/gpu/GrDefaultPathRenderer.h
+++ b/src/gpu/GrDefaultPathRenderer.h
@@ -29,7 +29,7 @@ public:
const SkPath& path,
GrPathFill fill) const SK_OVERRIDE;
- virtual void drawPath(GrDrawTarget::StageBitfield stages) SK_OVERRIDE;
+ virtual void drawPath(GrDrawState::StageMask stageMask) SK_OVERRIDE;
virtual void drawPathToStencil() SK_OVERRIDE;
protected:
@@ -37,10 +37,10 @@ protected:
private:
- void onDrawPath(GrDrawTarget::StageBitfield stages, bool stencilOnly);
+ void onDrawPath(GrDrawState::StageMask stages, bool stencilOnly);
bool createGeom(GrScalar srcSpaceTol,
- GrDrawTarget::StageBitfield stages);
+ GrDrawState::StageMask stages);
bool fSeparateStencil;
bool fStencilWrapOps;
@@ -50,7 +50,7 @@ private:
int fIndexCnt;
int fVertexCnt;
GrScalar fPreviousSrcTol;
- GrDrawTarget::StageBitfield fPreviousStages;
+ GrDrawState::StageMask fPreviousStages;
GrPrimitiveType fPrimitiveType;
bool fUseIndexedDraw;
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 8401772d92..90de1a3f7f 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -39,6 +39,12 @@ struct GrDrawState {
kMaxTexCoords = kNumStages
};
+ /**
+ * Bitfield used to indicate a set of stages.
+ */
+ typedef uint32_t StageMask;
+ GR_STATIC_ASSERT(sizeof(StageMask)*8 >= GrDrawState::kNumStages);
+
enum DrawFace {
kBoth_DrawFace,
kCCW_DrawFace,
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 20098fcada..7a84262d20 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -1057,10 +1057,10 @@ void GrDrawTarget::setEdgeAAData(const GrDrawState::Edge* edges, int numEdges) {
void GrDrawTarget::drawRect(const GrRect& rect,
const GrMatrix* matrix,
- StageBitfield stageEnableBitfield,
+ StageMask stageMask,
const GrRect* srcRects[],
const GrMatrix* srcMatrices[]) {
- GrVertexLayout layout = GetRectVertexLayout(stageEnableBitfield, srcRects);
+ GrVertexLayout layout = GetRectVertexLayout(stageMask, srcRects);
AutoReleaseGeometry geo(this, layout, 4, 0);
if (!geo.succeeded()) {
@@ -1074,13 +1074,13 @@ void GrDrawTarget::drawRect(const GrRect& rect,
drawNonIndexed(kTriangleFan_PrimitiveType, 0, 4);
}
-GrVertexLayout GrDrawTarget::GetRectVertexLayout(StageBitfield stageEnableBitfield,
+GrVertexLayout GrDrawTarget::GetRectVertexLayout(StageMask stageMask,
const GrRect* srcRects[]) {
GrVertexLayout layout = 0;
for (int i = 0; i < GrDrawState::kNumStages; ++i) {
int numTC = 0;
- if (stageEnableBitfield & (1 << i)) {
+ if (stageMask & (1 << i)) {
if (NULL != srcRects && NULL != srcRects[i]) {
layout |= StageTexCoordVertexLayoutBit(i, numTC);
++numTC;
@@ -1170,8 +1170,9 @@ void GrDrawTarget::AutoStateRestore::set(GrDrawTarget* target) {
////////////////////////////////////////////////////////////////////////////////
-GrDrawTarget::AutoDeviceCoordDraw::AutoDeviceCoordDraw(GrDrawTarget* target,
- int stageMask) {
+GrDrawTarget::AutoDeviceCoordDraw::AutoDeviceCoordDraw(
+ GrDrawTarget* target,
+ GrDrawState::StageMask stageMask) {
GrAssert(NULL != target);
fDrawTarget = target;
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 22cbbdb130..4bd9eee777 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -57,11 +57,7 @@ public:
int fMaxTextureSize;
};
- /**
- * Bitfield used to indicate which stages are in use.
- */
- typedef int StageBitfield;
- GR_STATIC_ASSERT(sizeof(StageBitfield)*8 >= GrDrawState::kNumStages);
+ typedef GrDrawState::StageMask StageMask;
/**
* Flags that affect rendering. Controlled using enable/disableState(). All
@@ -205,7 +201,7 @@ public:
* Shortcut for preConcatSamplerMatrix on all stages in mask with same
* matrix
*/
- void preConcatSamplerMatrices(int stageMask, const GrMatrix& matrix) {
+ void preConcatSamplerMatrices(StageMask stageMask, const GrMatrix& matrix) {
for (int i = 0; i < GrDrawState::kNumStages; ++i) {
if ((1 << i) & stageMask) {
this->preConcatSamplerMatrix(i, matrix);
@@ -221,7 +217,7 @@ public:
* @param matrix the matrix to concat
*/
void preConcatEnabledSamplerMatrices(const GrMatrix& matrix) {
- StageBitfield stageMask = this->enabledStages();
+ StageMask stageMask = this->enabledStages();
this->preConcatSamplerMatrices(stageMask, matrix);
}
@@ -825,8 +821,8 @@ public:
* drawNonIndexed.
* @param rect the rect to draw
* @param matrix optional matrix applied to rect (before viewMatrix)
- * @param stageEnableBitfield bitmask indicating which stages are enabled.
- * Bit i indicates whether stage i is enabled.
+ * @param stageMask bitmask indicating which stages are enabled.
+ * Bit i indicates whether stage i is enabled.
* @param srcRects specifies rects for stages enabled by stageEnableMask.
* if stageEnableMask bit i is 1, srcRects is not NULL,
* and srcRects[i] is not NULL, then srcRects[i] will be
@@ -840,7 +836,7 @@ public:
*/
virtual void drawRect(const GrRect& rect,
const GrMatrix* matrix,
- StageBitfield stageEnableBitfield,
+ StageMask stageMask,
const GrRect* srcRects[],
const GrMatrix* srcMatrices[]);
@@ -850,7 +846,7 @@ public:
*/
void drawSimpleRect(const GrRect& rect,
const GrMatrix* matrix,
- StageBitfield stageEnableBitfield) {
+ StageMask stageEnableBitfield) {
drawRect(rect, matrix, stageEnableBitfield, NULL, NULL);
}
@@ -931,7 +927,7 @@ public:
*/
class AutoDeviceCoordDraw : ::GrNoncopyable {
public:
- AutoDeviceCoordDraw(GrDrawTarget* target, int stageMask);
+ AutoDeviceCoordDraw(GrDrawTarget* target, StageMask stageMask);
~AutoDeviceCoordDraw();
private:
GrDrawTarget* fDrawTarget;
@@ -1291,8 +1287,8 @@ protected:
fCurrDrawState);
}
- StageBitfield enabledStages() const {
- StageBitfield mask = 0;
+ StageMask enabledStages() const {
+ StageMask mask = 0;
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
mask |= this->isStageEnabled(s) ? 1 : 0;
}
@@ -1341,7 +1337,7 @@ protected:
// Helpers for drawRect, protected so subclasses that override drawRect
// can use them.
- static GrVertexLayout GetRectVertexLayout(StageBitfield stageEnableBitfield,
+ static GrVertexLayout GetRectVertexLayout(StageMask stageEnableBitfield,
const GrRect* srcRects[]);
static void SetRectVertices(const GrRect& rect,
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 837d2c1db9..340cff18f3 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -70,7 +70,7 @@ void GrInOrderDrawBuffer::setQuadIndexBuffer(const GrIndexBuffer* indexBuffer) {
void GrInOrderDrawBuffer::drawRect(const GrRect& rect,
const GrMatrix* matrix,
- StageBitfield stageEnableBitfield,
+ StageMask stageMask,
const GrRect* srcRects[],
const GrMatrix* srcMatrices[]) {
@@ -83,7 +83,7 @@ void GrInOrderDrawBuffer::drawRect(const GrRect& rect,
if (fMaxQuads) {
bool appendToPreviousDraw = false;
- GrVertexLayout layout = GetRectVertexLayout(stageEnableBitfield, srcRects);
+ GrVertexLayout layout = GetRectVertexLayout(stageMask, srcRects);
AutoReleaseGeometry geo(this, layout, 4, 0);
if (!geo.succeeded()) {
GrPrintf("Failed to get space for vertices!\n");
@@ -179,7 +179,7 @@ void GrInOrderDrawBuffer::drawRect(const GrRect& rect,
this->enableState(kClip_StateBit);
}
} else {
- INHERITED::drawRect(rect, matrix, stageEnableBitfield, srcRects, srcMatrices);
+ INHERITED::drawRect(rect, matrix, stageMask, srcRects, srcMatrices);
}
}
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h
index 327352539e..f935be1d69 100644
--- a/src/gpu/GrInOrderDrawBuffer.h
+++ b/src/gpu/GrInOrderDrawBuffer.h
@@ -81,7 +81,7 @@ public:
// overrides from GrDrawTarget
virtual void drawRect(const GrRect& rect,
const GrMatrix* matrix = NULL,
- int stageEnableMask = 0,
+ StageMask stageEnableMask = 0,
const GrRect* srcRects[] = NULL,
const GrMatrix* srcMatrices[] = NULL);
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index a7205e576e..e24b98224c 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -137,7 +137,7 @@ public:
* use the remaining stages for its path
* filling algorithm.
*/
- virtual void drawPath(GrDrawTarget::StageBitfield stages) = 0;
+ virtual void drawPath(GrDrawState::StageMask stageMask) = 0;
/**
* Draws the path to the stencil buffer. Assume the writable stencil bits
diff --git a/src/gpu/GrTesselatedPathRenderer.cpp b/src/gpu/GrTesselatedPathRenderer.cpp
index 51cea10ae7..b6612d1d29 100644
--- a/src/gpu/GrTesselatedPathRenderer.cpp
+++ b/src/gpu/GrTesselatedPathRenderer.cpp
@@ -346,7 +346,7 @@ static size_t computeEdgesAndIntersect(const GrMatrix& matrix,
return edges->count();
}
-void GrTesselatedPathRenderer::drawPath(GrDrawTarget::StageBitfield stages) {
+void GrTesselatedPathRenderer::drawPath(GrDrawState::StageMask stageMask) {
GrDrawTarget::AutoStateRestore asr(fTarget);
// face culling doesn't make sense here
GrAssert(GrDrawState::kBoth_DrawFace == fTarget->getDrawFace());
@@ -362,7 +362,7 @@ void GrTesselatedPathRenderer::drawPath(GrDrawTarget::StageBitfield stages) {
GrVertexLayout layout = 0;
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
- if ((1 << s) & stages) {
+ if ((1 << s) & stageMask) {
layout |= GrDrawTarget::StagePosAsTexCoordVertexLayoutBit(s);
}
}
diff --git a/src/gpu/GrTesselatedPathRenderer.h b/src/gpu/GrTesselatedPathRenderer.h
index 18cead2826..e783958ca7 100644
--- a/src/gpu/GrTesselatedPathRenderer.h
+++ b/src/gpu/GrTesselatedPathRenderer.h
@@ -16,7 +16,7 @@ class GrTesselatedPathRenderer : public GrPathRenderer {
public:
GrTesselatedPathRenderer();
- virtual void drawPath(GrDrawTarget::StageBitfield stages);
+ virtual void drawPath(GrDrawState::StageMask stageMask);
virtual bool canDrawPath(const GrDrawTarget::Caps& targetCaps,
const GrPath& path,
GrPathFill fill,
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 06cc2a125f..657841c3a7 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -123,7 +123,7 @@ GrTextContext::GrTextContext(GrContext* context,
if (NULL != fPaint.getTexture(t)) {
if (invVMComputed || fOrigViewMatrix.invert(&invVM)) {
invVMComputed = true;
- fPaint.getTextureSampler(t)->preConcatMatrix(invVM);
+ fPaint.textureSampler(t)->preConcatMatrix(invVM);
}
}
}
@@ -131,7 +131,7 @@ GrTextContext::GrTextContext(GrContext* context,
if (NULL != fPaint.getMask(m)) {
if (invVMComputed || fOrigViewMatrix.invert(&invVM)) {
invVMComputed = true;
- fPaint.getMaskSampler(m)->preConcatMatrix(invVM);
+ fPaint.maskSampler(m)->preConcatMatrix(invVM);
}
}
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 02a83f20a6..0ad0a5c7b6 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -496,7 +496,7 @@ bool SkGpuDevice::skPaint2GrPaintShader(const SkPaint& skPaint,
}
return false;
}
- GrSamplerState* sampler = grPaint->getTextureSampler(kShaderTextureIdx);
+ GrSamplerState* sampler = grPaint->textureSampler(kShaderTextureIdx);
sampler->setSampleMode(sampleMode);
if (skPaint.isFilterBitmap()) {
sampler->setFilter(GrSamplerState::kBilinear_Filter);
@@ -755,12 +755,12 @@ static GrTexture* gaussianBlur(GrContext* context, GrTexture* srcTexture,
GrTexture* dstTexture = temp1->texture();
GrPaint paint;
paint.reset();
- paint.getTextureSampler(0)->setFilter(GrSamplerState::kBilinear_Filter);
+ paint.textureSampler(0)->setFilter(GrSamplerState::kBilinear_Filter);
for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
GrMatrix sampleM;
sampleM.setIDiv(srcTexture->width(), srcTexture->height());
- paint.getTextureSampler(0)->setMatrix(sampleM);
+ paint.textureSampler(0)->setMatrix(sampleM);
context->setRenderTarget(dstTexture->asRenderTarget());
SkRect dstRect(srcRect);
scaleRect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f,
@@ -821,10 +821,10 @@ static GrTexture* gaussianBlur(GrContext* context, GrTexture* srcTexture,
srcRect.fRight, srcRect.fTop, 1, srcRect.height());
context->clear(&clearRect, 0x0);
// FIXME: This should be mitchell, not bilinear.
- paint.getTextureSampler(0)->setFilter(GrSamplerState::kBilinear_Filter);
+ paint.textureSampler(0)->setFilter(GrSamplerState::kBilinear_Filter);
GrMatrix sampleM;
sampleM.setIDiv(srcTexture->width(), srcTexture->height());
- paint.getTextureSampler(0)->setMatrix(sampleM);
+ paint.textureSampler(0)->setMatrix(sampleM);
context->setRenderTarget(dstTexture->asRenderTarget());
paint.setTexture(0, srcTexture);
SkRect dstRect(srcRect);
@@ -930,10 +930,10 @@ static bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path,
if (!isNormalBlur) {
GrPaint paint;
paint.reset();
- paint.getTextureSampler(0)->setFilter(GrSamplerState::kNearest_Filter);
+ paint.textureSampler(0)->setFilter(GrSamplerState::kNearest_Filter);
GrMatrix sampleM;
sampleM.setIDiv(pathTexture->width(), pathTexture->height());
- paint.getTextureSampler(0)->setMatrix(sampleM);
+ paint.textureSampler(0)->setMatrix(sampleM);
// Blend pathTexture over blurTexture.
context->setRenderTarget(blurTexture->asRenderTarget());
paint.setTexture(0, pathTexture);
@@ -969,12 +969,12 @@ static bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path,
// we assume the last mask index is available for use
GrAssert(NULL == grp->getMask(MASK_IDX));
grp->setMask(MASK_IDX, blurTexture);
- grp->getMaskSampler(MASK_IDX)->setClampNoFilter();
+ grp->maskSampler(MASK_IDX)->setClampNoFilter();
GrMatrix m;
m.setTranslate(-finalRect.fLeft, -finalRect.fTop);
m.postIDiv(blurTexture->width(), blurTexture->height());
- grp->getMaskSampler(MASK_IDX)->setMatrix(m);
+ grp->maskSampler(MASK_IDX)->setMatrix(m);
context->drawRect(*grp, finalRect);
return true;
}
@@ -1037,7 +1037,7 @@ static bool drawWithMaskFilter(GrContext* context, const SkPath& path,
// we assume the last mask index is available for use
GrAssert(NULL == grp->getMask(MASK_IDX));
grp->setMask(MASK_IDX, texture);
- grp->getMaskSampler(MASK_IDX)->setClampNoFilter();
+ grp->maskSampler(MASK_IDX)->setClampNoFilter();
GrRect d;
d.setLTRB(GrIntToScalar(dstM.fBounds.fLeft),
@@ -1049,7 +1049,7 @@ static bool drawWithMaskFilter(GrContext* context, const SkPath& path,
m.setTranslate(-dstM.fBounds.fLeft*SK_Scalar1,
-dstM.fBounds.fTop*SK_Scalar1);
m.postIDiv(texture->width(), texture->height());
- grp->getMaskSampler(MASK_IDX)->setMatrix(m);
+ grp->maskSampler(MASK_IDX)->setMatrix(m);
context->drawRect(*grp, d);
return true;
@@ -1308,7 +1308,7 @@ void SkGpuDevice::drawBitmap(const SkDraw& draw,
if (!this->skPaint2GrPaintNoShader(paint, true, &grPaint, false)) {
return;
}
- GrSamplerState* sampler = grPaint.getTextureSampler(kBitmapTextureIdx);
+ GrSamplerState* sampler = grPaint.textureSampler(kBitmapTextureIdx);
if (paint.isFilterBitmap()) {
sampler->setFilter(GrSamplerState::kBilinear_Filter);
} else {
@@ -1395,7 +1395,7 @@ void SkGpuDevice::internalDrawBitmap(const SkDraw& draw,
return;
}
- GrSamplerState* sampler = grPaint->getTextureSampler(kBitmapTextureIdx);
+ GrSamplerState* sampler = grPaint->textureSampler(kBitmapTextureIdx);
sampler->setWrapX(GrSamplerState::kClamp_WrapMode);
sampler->setWrapY(GrSamplerState::kClamp_WrapMode);
@@ -1462,7 +1462,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
GrAutoMatrix avm(fContext, GrMatrix::I());
- GrSamplerState* sampler = grPaint.getTextureSampler(kBitmapTextureIdx);
+ GrSamplerState* sampler = grPaint.textureSampler(kBitmapTextureIdx);
GrTexture* texture;
sampler->setClampNoFilter();
@@ -1497,7 +1497,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* dev,
GrAutoMatrix avm(fContext, GrMatrix::I());
- grPaint.getTextureSampler(kBitmapTextureIdx)->setClampNoFilter();
+ grPaint.textureSampler(kBitmapTextureIdx)->setClampNoFilter();
GrRect dstRect = GrRect::MakeXYWH(GrIntToScalar(x),
GrIntToScalar(y),