[GPU] tile when large bitmap pased drawBitmap and only a small fraction is used
Review URL: http://codereview.appspot.com/5450048/
git-svn-id: http://skia.googlecode.com/svn/trunk@2760 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 2106a02..bc52159 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -116,6 +116,15 @@
int width,
int height,
const GrSamplerState&);
+ /**
+ * Determines whether a texture is in the cache. If the texture is found it
+ * will not be locked or returned. This call does not affect the priority of
+ * the texture for deletion.
+ */
+ bool isTextureInCache(TextureKey key,
+ int width,
+ int height,
+ const GrSamplerState&) const;
/**
* Create a new entry, based on the specified key and texture, and return
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index c34cd43..3afea5e 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -122,6 +122,8 @@
TexCache lockCachedTexture(const SkBitmap& bitmap,
const GrSamplerState& sampler,
TexType type = kBitmap_TexType);
+ bool isBitmapInTextureCache(const SkBitmap& bitmap,
+ const GrSamplerState& sampler) const;
void unlockCachedTexture(TexCache);
class SkAutoCachedTexture {
@@ -196,6 +198,10 @@
bool bindDeviceAsTexture(GrPaint* paint);
void prepareRenderTarget(const SkDraw&);
+ bool shouldTileBitmap(const SkBitmap& bitmap,
+ const GrSamplerState& sampler,
+ const SkIRect* srcRectPtr,
+ int* tileSize) const;
void internalDrawBitmap(const SkDraw&, const SkBitmap&,
const SkIRect&, const SkMatrix&, GrPaint* grPaint);