Remove static initiazled gClampNearest in gpu backend
Review URL: http://codereview.appspot.com/5487044/
git-svn-id: http://skia.googlecode.com/svn/trunk@2851 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index df2ac22..bf00fa3 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -59,7 +59,7 @@
SkGpuDevice::SkAutoCachedTexture::
SkAutoCachedTexture(SkGpuDevice* device,
const SkBitmap& bitmap,
- const GrSamplerState& sampler,
+ const GrSamplerState* sampler,
GrTexture** texture) {
GrAssert(texture);
*texture = this->set(device, bitmap, sampler);
@@ -70,7 +70,7 @@
GrTexture* SkGpuDevice::SkAutoCachedTexture::set(SkGpuDevice* device,
const SkBitmap& bitmap,
- const GrSamplerState& sampler) {
+ const GrSamplerState* sampler) {
if (fTex.texture()) {
fDevice->unlockCachedTexture(fTex);
}
@@ -195,7 +195,7 @@
TexType type = (kSaveLayer_Usage == usage) ?
kSaveLayerDeviceRenderTarget_TexType :
kDeviceRenderTarget_TexType;
- fCache = this->lockCachedTexture(bm, GrSamplerState::ClampNearest(), type);
+ fCache = this->lockCachedTexture(bm, NULL, type);
fTexture = fCache.texture();
if (fTexture) {
SkASSERT(NULL != fTexture->asRenderTarget());
@@ -515,7 +515,7 @@
twoPointParams[2] < 0);
}
- GrTexture* texture = act->set(this, bitmap, *sampler);
+ GrTexture* texture = act->set(this, bitmap, sampler);
if (NULL == texture) {
SkDebugf("Couldn't convert bitmap to texture.\n");
return false;
@@ -1407,7 +1407,7 @@
sampler->setMatrix(GrMatrix::I());
GrTexture* texture;
- SkAutoCachedTexture act(this, bitmap, *sampler, &texture);
+ SkAutoCachedTexture act(this, bitmap, sampler, &texture);
if (NULL == texture) {
return;
}
@@ -1470,7 +1470,7 @@
GrTexture* texture;
sampler->reset();
- SkAutoCachedTexture act(this, bitmap, *sampler, &texture);
+ SkAutoCachedTexture act(this, bitmap, sampler, &texture);
grPaint.setTexture(kBitmapTextureIdx, texture);
@@ -1755,7 +1755,7 @@
///////////////////////////////////////////////////////////////////////////////
SkGpuDevice::TexCache SkGpuDevice::lockCachedTexture(const SkBitmap& bitmap,
- const GrSamplerState& sampler,
+ const GrSamplerState* sampler,
TexType type) {
GrContext::TextureCacheEntry entry;
GrContext* ctx = this->context();
@@ -1787,11 +1787,12 @@
entry = ctx->findAndLockTexture(key, bitmap.width(),
bitmap.height(), sampler);
if (NULL == entry.texture()) {
- entry = sk_gr_create_bitmap_texture(ctx, key, sampler,
+ entry = sk_gr_create_bitmap_texture(ctx, key, sampler,
bitmap);
}
} else {
- entry = sk_gr_create_bitmap_texture(ctx, gUNCACHED_KEY, sampler, bitmap);
+ entry = sk_gr_create_bitmap_texture(ctx, gUNCACHED_KEY,
+ sampler, bitmap);
}
if (NULL == entry.texture()) {
GrPrintf("---- failed to create texture for cache [%d %d]\n",
@@ -1810,7 +1811,7 @@
GrContext::TextureKey key = bitmap.getGenerationID();
key |= ((uint64_t) bitmap.pixelRefOffset()) << 32;
return this->context()->isTextureInCache(key, bitmap.width(),
- bitmap.height(), sampler);
+ bitmap.height(), &sampler);
}