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

Unified Diff: tests/ShaderImageFilterTest.cpp

Issue 1575233004: Delete SkRectShaderImageFilter (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « src/ports/SkGlobalInitialization_default.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ShaderImageFilterTest.cpp
diff --git a/tests/ShaderImageFilterTest.cpp b/tests/ShaderImageFilterTest.cpp
deleted file mode 100644
index 45fb5ca9a1d340ca41ef3e8300539789897346de..0000000000000000000000000000000000000000
--- a/tests/ShaderImageFilterTest.cpp
+++ /dev/null
@@ -1,61 +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 "SkCanvas.h"
-#include "SkGradientShader.h"
-#include "SkRectShaderImageFilter.h"
-#include "SkShader.h"
-#include "Test.h"
-
-DEF_TEST(ShaderImageFilter, reporter) {
- int w = 10, h = 10;
- SkRect r = SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h)); // Make small 10x10 gradient
-
- SkBitmap filterResult, shaderResult;
-
- filterResult.allocN32Pixels(w, h);
- SkCanvas canvasFilter(filterResult);
- canvasFilter.clear(0x00000000);
-
- shaderResult.allocN32Pixels(w, h);
- SkCanvas canvasShader(shaderResult);
- canvasShader.clear(0x00000000);
-
- SkPoint center = SkPoint::Make(SkIntToScalar(5), SkIntToScalar(5));
- SkColor colors[] = {SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN};
- SkScalar pos[] = {0, SK_ScalarHalf, SK_Scalar1};
- SkScalar radius = SkIntToScalar(5);
-
- // Test using the image filter
- {
- SkShader* s = SkGradientShader::CreateRadial(
- center, radius, colors, pos, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode);
- SkPaint paint;
- SkImageFilter::CropRect cr(r);
- paint.setImageFilter(SkRectShaderImageFilter::Create(s, &cr))->unref();
- canvasFilter.drawRect(r, paint);
- s->unref();
- }
-
- // Test using the shader directly
- {
- SkShader* s = SkGradientShader::CreateRadial(
- center, radius, colors, pos, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode);
- SkPaint paint;
- paint.setShader(s)->unref();
- canvasShader.drawRect(r, paint);
- }
-
- // Assert that both paths yielded the same result
- for (int y = 0; y < r.height(); ++y) {
- const SkPMColor* filterPtr = filterResult.getAddr32(0, y);
- const SkPMColor* shaderPtr = shaderResult.getAddr32(0, y);
- for (int x = 0; x < r.width(); ++x, ++filterPtr, ++shaderPtr) {
- REPORTER_ASSERT(reporter, *filterPtr == *shaderPtr);
- }
- }
-}
« no previous file with comments | « src/ports/SkGlobalInitialization_default.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698