| Index: gm/dropshadowimagefilter.cpp
|
| diff --git a/gm/imagefilterscropped.cpp b/gm/dropshadowimagefilter.cpp
|
| similarity index 73%
|
| copy from gm/imagefilterscropped.cpp
|
| copy to gm/dropshadowimagefilter.cpp
|
| index 8f023f7208e209b22403c4642f4cc8b207a6340d..6cffd5bb4a006a3ff809946f69d8533f371503fc 100644
|
| --- a/gm/imagefilterscropped.cpp
|
| +++ b/gm/dropshadowimagefilter.cpp
|
| @@ -1,21 +1,15 @@
|
| /*
|
| - * Copyright 2011 Google Inc.
|
| + * Copyright 2013 Google Inc.
|
| *
|
| * Use of this source code is governed by a BSD-style license that can be
|
| * found in the LICENSE file.
|
| */
|
|
|
| #include "gm.h"
|
| -#include "SkCanvas.h"
|
| #include "SkColorFilter.h"
|
| -#include "SkColorPriv.h"
|
| -#include "SkShader.h"
|
|
|
| -#include "SkBlurImageFilter.h"
|
| #include "SkColorFilterImageFilter.h"
|
| -#include "SkMergeImageFilter.h"
|
| -#include "SkOffsetImageFilter.h"
|
| -#include "SkTestImageFilters.h"
|
| +#include "SkDropShadowImageFilter.h"
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| @@ -31,12 +25,12 @@ static void draw_paint(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
|
|
|
| static void draw_path(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
|
| SkPaint paint;
|
| - paint.setColor(SK_ColorMAGENTA);
|
| + paint.setColor(SK_ColorGREEN);
|
| paint.setImageFilter(imf);
|
| paint.setAntiAlias(true);
|
| canvas->save();
|
| canvas->clipRect(r);
|
| - canvas->drawCircle(r.centerX(), r.centerY(), r.width()*2/5, paint);
|
| + canvas->drawCircle(r.centerX(), r.centerY(), r.width()/3, paint);
|
| canvas->restore();
|
| }
|
|
|
| @@ -99,17 +93,17 @@ static void draw_sprite(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| -class ImageFiltersCroppedGM : public skiagm::GM {
|
| +class DropShadowImageFilterGM : public skiagm::GM {
|
| public:
|
| - ImageFiltersCroppedGM () {}
|
| + DropShadowImageFilterGM () {}
|
|
|
| protected:
|
|
|
| virtual SkString onShortName() {
|
| - return SkString("imagefilterscropped");
|
| + return SkString("dropshadowimagefilter");
|
| }
|
|
|
| - virtual SkISize onISize() { return SkISize::Make(400, 640); }
|
| + virtual SkISize onISize() { return SkISize::Make(400, 700); }
|
|
|
| void draw_frame(SkCanvas* canvas, const SkRect& r) {
|
| SkPaint paint;
|
| @@ -132,25 +126,21 @@ protected:
|
| };
|
|
|
| SkAutoTUnref<SkColorFilter> cf(
|
| - SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
|
| - SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge);
|
| - SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge);
|
| -
|
| - SkAutoTUnref<SkImageFilter> offset(new SkOffsetImageFilter(
|
| - SkIntToScalar(-10), SkIntToScalar(-10)));
|
| -
|
| - SkAutoTUnref<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(), offset.get()));
|
| + SkColorFilter::CreateModeFilter(SK_ColorMAGENTA, SkXfermode::kSrcIn_Mode));
|
| + SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get()));
|
| + SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)),
|
| + SkImageFilter::CropRect::kHasAll_CropEdge);
|
| + SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -100, 10, 10)),
|
| + SkImageFilter::CropRect::kHasAll_CropEdge);
|
|
|
| SkImageFilter* filters[] = {
|
| NULL,
|
| - SkColorFilterImageFilter::Create(cf.get(), NULL, &cropRect),
|
| - new SkBlurImageFilter(1.0f, 1.0f, NULL, &cropRect),
|
| - new SkBlurImageFilter(8.0f, 0.0f, NULL, &cropRect),
|
| - new SkBlurImageFilter(0.0f, 8.0f, NULL, &cropRect),
|
| - new SkBlurImageFilter(8.0f, 8.0f, NULL, &cropRect),
|
| - new SkMergeImageFilter(NULL, cfOffset.get(), SkXfermode::kSrcOver_Mode, &cropRect),
|
| - new SkBlurImageFilter(8.0f, 8.0f, NULL, &bogusRect),
|
| - SkColorFilterImageFilter::Create(cf.get(), NULL, &bogusRect),
|
| + new SkDropShadowImageFilter(7.0f, 0.0f, 0.0f, 3.0f, SK_ColorBLUE),
|
| + new SkDropShadowImageFilter(0.0f, 7.0f, 3.0f, 0.0f, SK_ColorBLUE),
|
| + new SkDropShadowImageFilter(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE),
|
| + new SkDropShadowImageFilter(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, cfif),
|
| + new SkDropShadowImageFilter(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, NULL, &cropRect),
|
| + new SkDropShadowImageFilter(7.0f, 7.0f, 3.0f, 3.0f, SK_ColorBLUE, NULL, &bogusRect),
|
| };
|
|
|
| SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
|
| @@ -180,5 +170,5 @@ private:
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| -static skiagm::GM* MyFactory(void*) { return new ImageFiltersCroppedGM; }
|
| +static skiagm::GM* MyFactory(void*) { return new DropShadowImageFilterGM; }
|
| static skiagm::GMRegistry reg(MyFactory);
|
|
|