GPU-based Gaussian blur.

This is a first stab at implementing a GPU-based
Gaussian blur in Ganesh.  The convolution shader is implemented as a new
filtering mode.  There are several known issues:

- no support for blur types other than "normal"
- FBO truncation problem at high zoom values
- uses bilinear for upsampling instead of Mitchell

Review URL:  http://codereview.appspot.com/4645082/



git-svn-id: http://skia.googlecode.com/svn/trunk@1830 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp
index b75c917..092b0ba 100644
--- a/gpu/src/GrContext.cpp
+++ b/gpu/src/GrContext.cpp
@@ -1699,3 +1699,22 @@
     }
 }
 
+void GrContext::convolveRect(GrTexture* srcTexture,
+                             const SkRect& rect,
+                             float imageIncrement[2],
+                             const float* kernel,
+                             int kernelWidth) {
+    GrDrawTarget::AutoStateRestore asr(fGpu);
+    GrMatrix sampleM;
+    GrSamplerState sampler(GrSamplerState::kClamp_WrapMode, 
+                           GrSamplerState::kClamp_WrapMode,
+                           GrSamplerState::kConvolution_Filter);
+    sampler.setConvolutionParams(kernelWidth, kernel, imageIncrement);
+    sampleM.setScale(GR_Scalar1 / srcTexture->width(),
+                     GR_Scalar1 / srcTexture->height());
+    sampler.setMatrix(sampleM);
+    fGpu->setSamplerState(0, sampler);
+    fGpu->setViewMatrix(GrMatrix::I());
+    fGpu->setTexture(0, srcTexture);
+    fGpu->drawSimpleRect(rect, NULL, 1 << 0);
+}