aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrContext.cpp32
-rw-r--r--src/gpu/GrGpu.cpp10
-rw-r--r--src/gpu/GrTextContext.cpp1
-rw-r--r--src/gpu/SkGpuDevice.cpp10
4 files changed, 21 insertions, 32 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 335b9f4354..de80f654a7 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -330,11 +330,11 @@ GrContext::TextureCacheEntry GrContext::createAndLockTexture(TextureKey key,
if (special) {
TextureCacheEntry clampEntry =
findAndLockTexture(key, desc.fWidth, desc.fHeight,
- GrSamplerState::ClampNoFilter());
+ GrSamplerState::ClampNearest());
if (NULL == clampEntry.texture()) {
clampEntry = createAndLockTexture(key,
- GrSamplerState::ClampNoFilter(),
+ GrSamplerState::ClampNearest(),
desc, srcData, rowBytes);
GrAssert(NULL != clampEntry.texture());
if (NULL == clampEntry.texture()) {
@@ -367,7 +367,6 @@ GrContext::TextureCacheEntry GrContext::createAndLockTexture(TextureKey key,
filter = GrSamplerState::kBilinear_Filter;
}
GrSamplerState stretchSampler(GrSamplerState::kClamp_WrapMode,
- GrSamplerState::kClamp_WrapMode,
filter);
fGpu->setSamplerState(0, stretchSampler);
@@ -434,7 +433,7 @@ inline void gen_scratch_tex_key_values(const GrGpu* gpu,
((uint64_t) desc.fConfig << 32);
// this code path isn't friendly to tiling with NPOT restricitons
// We just pass ClampNoFilter()
- gen_texture_key_values(gpu, GrSamplerState::ClampNoFilter(), descKey,
+ gen_texture_key_values(gpu, GrSamplerState::ClampNearest(), descKey,
desc.fWidth, desc.fHeight, true, v);
}
}
@@ -864,8 +863,7 @@ void GrContext::doOffscreenAAPass2(GrDrawTarget* target,
}
GrMatrix sampleM;
- GrSamplerState sampler(GrSamplerState::kClamp_WrapMode,
- GrSamplerState::kClamp_WrapMode, filter);
+ GrSamplerState sampler(GrSamplerState::kClamp_WrapMode, filter);
GrTexture* src = record->fOffscreen0.texture();
int scale;
@@ -1787,9 +1785,6 @@ bool GrContext::internalReadRenderTargetPixels(GrRenderTarget* target,
fGpu->setRenderTarget(target);
- GrSamplerState sampler;
- sampler.setClampNoFilter();
- sampler.setRAndBSwap(swapRAndB);
GrMatrix matrix;
if (flipY) {
matrix.setTranslate(SK_Scalar1 * left,
@@ -1799,7 +1794,11 @@ bool GrContext::internalReadRenderTargetPixels(GrRenderTarget* target,
matrix.setTranslate(SK_Scalar1 *left, SK_Scalar1 *top);
}
matrix.postIDiv(src->width(), src->height());
- sampler.setMatrix(matrix);
+ GrSamplerState sampler;
+ sampler.reset(GrSamplerState::kClamp_WrapMode,
+ GrSamplerState::kNearest_Filter,
+ matrix);
+ sampler.setRAndBSwap(swapRAndB);
fGpu->setSamplerState(0, sampler);
fGpu->setTexture(0, src);
GrRect rect;
@@ -1822,8 +1821,7 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst) {
GrDrawTarget::AutoStateRestore asr(fGpu);
reset_target_state(fGpu);
fGpu->setRenderTarget(dst);
- GrSamplerState sampler(GrSamplerState::kClamp_WrapMode,
- GrSamplerState::kClamp_WrapMode,
+ GrSamplerState sampler(GrSamplerState::kClamp_WrapMode,
GrSamplerState::kNearest_Filter);
GrMatrix sampleM;
sampleM.setIDiv(src->width(), src->height());
@@ -1899,10 +1897,11 @@ void GrContext::internalWriteRenderTargetPixels(GrRenderTarget* target,
fGpu->setRenderTarget(target);
fGpu->setTexture(0, texture);
- GrSamplerState sampler;
- sampler.setClampNoFilter();
matrix.setIDiv(texture->width(), texture->height());
- sampler.setMatrix(matrix);
+ GrSamplerState sampler;
+ sampler.reset(GrSamplerState::kClamp_WrapMode,
+ GrSamplerState::kNearest_Filter,
+ matrix);
sampler.setRAndBSwap(swapRAndB);
fGpu->setSamplerState(0, sampler);
@@ -2145,8 +2144,7 @@ void GrContext::convolve(GrTexture* texture,
GrDrawTarget::AutoStateRestore asr(fGpu);
GrMatrix sampleM;
- GrSamplerState sampler(GrSamplerState::kClamp_WrapMode,
- GrSamplerState::kClamp_WrapMode,
+ GrSamplerState sampler(GrSamplerState::kClamp_WrapMode,
GrSamplerState::kConvolution_Filter);
sampler.setConvolutionParams(kernelWidth, kernel, imageIncrement);
sampleM.setIDiv(texture->width(), texture->height());
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 764ccd3eaf..1583630ecd 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -960,13 +960,5 @@ void GrGpu::printStats() const {
}
////////////////////////////////////////////////////////////////////////////////
-const GrSamplerState GrSamplerState::gClampNoFilter(
- GrSamplerState::kClamp_WrapMode,
- GrSamplerState::kClamp_WrapMode,
- GrSamplerState::kNormal_SampleMode,
- GrMatrix::I(),
- GrSamplerState::kNearest_Filter);
-
-
-
+const GrSamplerState GrSamplerState::gClampNearest;
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 657841c3a7..4b78d4a8c7 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -34,7 +34,6 @@ void GrTextContext::flushGlyphs() {
filter = GrSamplerState::kBilinear_Filter;
}
GrSamplerState sampler(GrSamplerState::kRepeat_WrapMode,
- GrSamplerState::kRepeat_WrapMode,
filter);
fDrawTarget->setSamplerState(kGlyphMaskStage, sampler);
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 0ad0a5c7b6..5daf42cd91 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -195,7 +195,7 @@ SkGpuDevice::SkGpuDevice(GrContext* context, SkBitmap::Config config, int width,
TexType type = (kSaveLayer_Usage == usage) ?
kSaveLayerDeviceRenderTarget_TexType :
kDeviceRenderTarget_TexType;
- fCache = this->lockCachedTexture(bm, GrSamplerState::ClampNoFilter(), type);
+ fCache = this->lockCachedTexture(bm, GrSamplerState::ClampNearest(), type);
fTexture = fCache.texture();
if (fTexture) {
SkASSERT(NULL != fTexture->asRenderTarget());
@@ -969,7 +969,7 @@ 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->maskSampler(MASK_IDX)->setClampNoFilter();
+ grp->maskSampler(MASK_IDX)->reset();
GrMatrix m;
m.setTranslate(-finalRect.fLeft, -finalRect.fTop);
@@ -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->maskSampler(MASK_IDX)->setClampNoFilter();
+ grp->maskSampler(MASK_IDX)->reset();
GrRect d;
d.setLTRB(GrIntToScalar(dstM.fBounds.fLeft),
@@ -1465,7 +1465,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
GrSamplerState* sampler = grPaint.textureSampler(kBitmapTextureIdx);
GrTexture* texture;
- sampler->setClampNoFilter();
+ sampler->reset();
SkAutoCachedTexture act(this, bitmap, *sampler, &texture);
grPaint.setTexture(kBitmapTextureIdx, texture);
@@ -1497,7 +1497,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* dev,
GrAutoMatrix avm(fContext, GrMatrix::I());
- grPaint.textureSampler(kBitmapTextureIdx)->setClampNoFilter();
+ grPaint.textureSampler(kBitmapTextureIdx)->reset();
GrRect dstRect = GrRect::MakeXYWH(GrIntToScalar(x),
GrIntToScalar(y),