diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-18 19:52:53 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-18 19:52:53 +0000 |
commit | 1e95d715d06c5125ef6e5439e953fd0353be92b2 (patch) | |
tree | 598a3ce8443e2571478bc8006a247906a28899ec /gm | |
parent | 7f1ffa6b4280f8104a273eca0b4b5898dd2f9e68 (diff) |
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
Diffstat (limited to 'gm')
-rw-r--r-- | gm/imageblur.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gm/imageblur.cpp b/gm/imageblur.cpp index c8dd5d760c..f326f4598b 100644 --- a/gm/imageblur.cpp +++ b/gm/imageblur.cpp @@ -32,16 +32,17 @@ protected: SkPaint paint; paint.setImageFilter(new SkBlurImageFilter(24.0f, 0.0f))->unref(); canvas->saveLayer(NULL, &paint); - paint.setAntiAlias(true); const char* str = "The quick brown fox jumped over the lazy dog."; srand(1234); + SkPaint textPaint; + textPaint.setAntiAlias(true); for (int i = 0; i < 25; ++i) { int x = rand() % WIDTH; int y = rand() % HEIGHT; - paint.setColor(rand() % 0x1000000 | 0xFF000000); - paint.setTextSize(SkIntToScalar(rand() % 300)); + textPaint.setColor(rand() % 0x1000000 | 0xFF000000); + textPaint.setTextSize(SkIntToScalar(rand() % 300)); canvas->drawText(str, strlen(str), SkIntToScalar(x), - SkIntToScalar(y), paint); + SkIntToScalar(y), textPaint); } canvas->restore(); } |