Clean up the use of AutoScratchTexture in the gaussian blur and morphology
filters.  Instead of passing in AutoScratchTextures for temporaries, we allocate
them inside the function and detach() after rendering.  Since the functions now
return a ref()'ed texture, we no longer ref() the result in filter_texture().

Also, the imageblur gm was passing a paint with an image filter both to
saveLayer()/restore(), and to every text draw call.  Back when only restore()
was applying filters, this was fine, but since we're now applying filters on all
draw calls, this means we're double-blurring in this GM.

I've reverted the Mac baselines for the imageblur GM to their previous versions;
hopefully this will be correct.



git-svn-id: http://skia.googlecode.com/svn/trunk@4659 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index a199beb..f905825 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -591,18 +591,16 @@
     /**
      * Applies a 2D Gaussian blur to a given texture.
      * @param srcTexture      The source texture to be blurred.
-     * @param temp1           A scratch texture.  Must not be NULL.
-     * @param temp2           A scratch texture.  May be NULL, in which case
-     *                        srcTexture is overwritten with intermediate
-     *                        results.
+     * @param canClobberSrc   If true, srcTexture may be overwritten, and
+     *                        may be returned as the result.
      * @param rect            The destination rectangle.
      * @param sigmaX          The blur's standard deviation in X.
      * @param sigmaY          The blur's standard deviation in Y.
-     * @return the blurred texture, which may be temp1, temp2 or srcTexture.
+     * @return the blurred texture, which may be srcTexture ref'ed, or a
+     * new texture.  It is the caller's responsibility to unref this texture.
      */
      GrTexture* gaussianBlur(GrTexture* srcTexture,
-                             GrAutoScratchTexture* temp1,
-                             GrAutoScratchTexture* temp2,
+                             bool canClobberSrc,
                              const SkRect& rect,
                              float sigmaX, float sigmaY);
 
@@ -618,18 +616,16 @@
      * Applies a 2D morphology to a given texture.
      * @param srcTexture      The source texture to be blurred.
      * @param rect            The destination rectangle.
-     * @param temp1           A scratch texture.  Must not be NULL.
-     * @param temp2           A scratch texture.  Must not be NULL.
      * @param filter          The morphology filter.  Must be kDilate_Filter or
      *                        kErode_Filter.
      * @param radius          The morphology radius in X and Y.  The filter is
      *                        applied to a fWidth by fHeight rectangle of
      *                        pixels.
-     * @return the morphed texture, which may be temp1, temp2 or srcTexture.
+     * @return the morphed texture, which may be srcTexture ref'ed, or a
+     * new texture.  It is the caller's responsibility to unref this texture.
      */
     GrTexture* applyMorphology(GrTexture* srcTexture,
                                const GrRect& rect,
-                               GrTexture* temp1, GrTexture* temp2,
                                MorphologyType type,
                                SkISize radius);