Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: gm/testimagefilters.cpp

Issue 2094083002: remove DownSample imagefilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/imagefiltersgraph.cpp ('k') | gyp/effects.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/testimagefilters.cpp
diff --git a/gm/testimagefilters.cpp b/gm/testimagefilters.cpp
deleted file mode 100644
index c6742b2a60347b5a2fb5895460b9b8d2c6406395..0000000000000000000000000000000000000000
--- a/gm/testimagefilters.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright 2011 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 "SkComposeImageFilter.h"
-#include "SkMergeImageFilter.h"
-#include "SkOffsetImageFilter.h"
-#include "SkTestImageFilters.h"
-
-#define FILTER_WIDTH SkIntToScalar(150)
-#define FILTER_HEIGHT SkIntToScalar(200)
-
-static sk_sp<SkImageFilter> make0() {
- return SkDownSampleImageFilter::Make(SK_Scalar1 / 5, nullptr);
-}
-
-static sk_sp<SkImageFilter> make1() {
- return SkOffsetImageFilter::Make(SkIntToScalar(16), SkIntToScalar(16), nullptr);
-}
-
-static sk_sp<SkImageFilter> make2() {
- sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
- return SkColorFilterImageFilter::Make(std::move(cf), nullptr);
-}
-
-static sk_sp<SkImageFilter> make3() {
- return SkBlurImageFilter::Make(8, 0, nullptr);
-}
-
-static sk_sp<SkImageFilter> make4() {
- sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Make(SkIntToScalar(16),
- SkIntToScalar(16),
- nullptr));
- sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Make(SK_Scalar1 / 5, nullptr));
- return SkComposeImageFilter::Make(std::move(outer), std::move(inner));
-}
-
-static sk_sp<SkImageFilter> make5() {
- sk_sp<SkImageFilter> first(SkOffsetImageFilter::Make(SkIntToScalar(16),
- SkIntToScalar(16),
- nullptr));
- sk_sp<SkImageFilter> second(SkDownSampleImageFilter::Make(SK_Scalar1 / 5, nullptr));
- return SkMergeImageFilter::Make(std::move(first), std::move(second));
-}
-
-static sk_sp<SkImageFilter> make6() {
- sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Make(SkIntToScalar(16),
- SkIntToScalar(16),
- nullptr));
- sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Make(SK_Scalar1 / 5, nullptr));
- sk_sp<SkImageFilter> compose(SkComposeImageFilter::Make(std::move(outer), std::move(inner)));
-
- sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode::kSrcIn_Mode));
- sk_sp<SkImageFilter> blue(SkColorFilterImageFilter::Make(std::move(cf), nullptr));
-
- return SkMergeImageFilter::Make(std::move(compose), std::move(blue));
-}
-
-static sk_sp<SkImageFilter> make7() {
- sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Make(SkIntToScalar(16),
- SkIntToScalar(16),
- nullptr));
- sk_sp<SkImageFilter> inner(make3());
- sk_sp<SkImageFilter> compose(SkComposeImageFilter::Make(std::move(outer), std::move(inner)));
-
- sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode::kSrcIn_Mode));
- sk_sp<SkImageFilter> blue(SkColorFilterImageFilter::Make(std::move(cf), nullptr));
-
- return SkMergeImageFilter::Make(std::move(compose), std::move(blue));
-}
-
-static void draw0(SkCanvas* canvas) {
- SkPaint p;
- p.setAntiAlias(true);
- SkRect r = SkRect::MakeWH(FILTER_WIDTH, FILTER_HEIGHT);
- r.inset(SK_Scalar1 * 12, SK_Scalar1 * 12);
- p.setColor(SK_ColorRED);
- canvas->drawOval(r, p);
-}
-
-class TestImageFiltersGM : public skiagm::GM {
-public:
- TestImageFiltersGM () {}
-
-protected:
-
- SkString onShortName() override {
- return SkString("testimagefilters");
- }
-
- SkISize onISize() override { return SkISize::Make(700, 460); }
-
- void onDraw(SkCanvas* canvas) override {
-// this->drawSizeBounds(canvas, 0xFFCCCCCC);
-
- static sk_sp<SkImageFilter> (*gFilterProc[])() = {
- make0, make1, make2, make3, make4, make5, make6, make7
- };
-
- const SkRect bounds = SkRect::MakeWH(FILTER_WIDTH, FILTER_HEIGHT);
-
- const SkScalar dx = bounds.width() * 8 / 7;
- const SkScalar dy = bounds.height() * 8 / 7;
-
- canvas->translate(SkIntToScalar(8), SkIntToScalar(8));
-
- for (int i = 0; i < (int)SK_ARRAY_COUNT(gFilterProc); ++i) {
- int ix = i % 4;
- int iy = i / 4;
-
- SkAutoCanvasRestore acr(canvas, true);
- canvas->translate(ix * dx, iy * dy);
-
- SkPaint p;
- p.setStyle(SkPaint::kStroke_Style);
- canvas->drawRect(bounds, p);
-
- SkPaint paint;
- paint.setImageFilter(gFilterProc[i]());
- canvas->saveLayer(&bounds, &paint);
- draw0(canvas);
- }
- }
-
-private:
- typedef GM INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-DEF_GM( return new TestImageFiltersGM; )
« no previous file with comments | « gm/imagefiltersgraph.cpp ('k') | gyp/effects.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698