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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « tests/GrTextureMipMapInvalidationTest.cpp ('k') | tests/ReadPixelsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapDevice.h" 9 #include "SkBitmapDevice.h"
10 #include "SkBlurImageFilter.h" 10 #include "SkBlurImageFilter.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // 2 ) location and target at same value 254 // 2 ) location and target at same value
255 SkPoint3 target = SkPoint3::Make(location.fX, location.fY, location. fZ); 255 SkPoint3 target = SkPoint3::Make(location.fX, location.fY, location. fZ);
256 // 3 ) large negative specular exponent value 256 // 3 ) large negative specular exponent value
257 SkScalar specularExponent = -1000; 257 SkScalar specularExponent = -1000;
258 258
259 SkAutoTUnref<SkImageFilter> bmSrc(SkImageSource::Create(image)); 259 SkAutoTUnref<SkImageFilter> bmSrc(SkImageSource::Create(image));
260 SkPaint paint; 260 SkPaint paint;
261 paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular( 261 paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(
262 location, target, specularExponent, 180, 262 location, target, specularExponent, 180,
263 0xFFFFFFFF, SK_Scalar1, SK_Scalar1, SK_Scalar1, 263 0xFFFFFFFF, SK_Scalar1, SK_Scalar1, SK_Scalar1,
264 bmSrc))->unref(); 264 bmSrc, NULL))->unref();
265 SkCanvas canvas(result); 265 SkCanvas canvas(result);
266 SkRect r = SkRect::MakeWH(SkIntToScalar(kBitmapSize), 266 SkRect r = SkRect::MakeWH(SkIntToScalar(kBitmapSize),
267 SkIntToScalar(kBitmapSize)); 267 SkIntToScalar(kBitmapSize));
268 canvas.drawRect(r, paint); 268 canvas.drawRect(r, paint);
269 } 269 }
270 } 270 }
271 } 271 }
272 272
273 static void test_crop_rects(SkImageFilter::Proxy* proxy, skiatest::Reporter* rep orter) { 273 static void test_crop_rects(SkImageFilter::Proxy* proxy, skiatest::Reporter* rep orter) {
274 // Check that all filters offset to their absolute crop rect, 274 // Check that all filters offset to their absolute crop rect,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 { "color filter", SkColorFilterImageFilter::Create(cf.get()) }, 455 { "color filter", SkColorFilterImageFilter::Create(cf.get()) },
456 { "displacement map", SkDisplacementMapEffect::Create( 456 { "displacement map", SkDisplacementMapEffect::Create(
457 SkDisplacementMapEffect::kR_ChannelSelectorType, 457 SkDisplacementMapEffect::kR_ChannelSelectorType,
458 SkDisplacementMapEffect::kB_ChannelSelectorType, 458 SkDisplacementMapEffect::kB_ChannelSelectorType,
459 20.0f, gradientSource.get()) }, 459 20.0f, gradientSource.get()) },
460 { "blur", SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1) }, 460 { "blur", SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1) },
461 { "drop shadow", SkDropShadowImageFilter::Create( 461 { "drop shadow", SkDropShadowImageFilter::Create(
462 SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_ColorGREEN, 462 SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_ColorGREEN,
463 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode) }, 463 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode) },
464 { "diffuse lighting", SkLightingImageFilter::CreatePointLitDiffuse( 464 { "diffuse lighting", SkLightingImageFilter::CreatePointLitDiffuse(
465 location, SK_ColorGREEN, 0, 0) }, 465 location, SK_ColorGREEN, 0, 0, NULL, NULL) },
466 { "specular lighting", 466 { "specular lighting",
467 SkLightingImageFilter::CreatePointLitSpecular(location, SK_ColorGR EEN, 0, 0, 0) }, 467 SkLightingImageFilter::CreatePointLitSpecular(location, SK_ColorGR EEN, 0, 0, 0, NULL, NULL) },
468 { "matrix convolution", 468 { "matrix convolution",
469 SkMatrixConvolutionImageFilter::Create( 469 SkMatrixConvolutionImageFilter::Create(
470 kernelSize, kernel, gain, bias, SkIPoint::Make(1, 1), 470 kernelSize, kernel, gain, bias, SkIPoint::Make(1, 1),
471 SkMatrixConvolutionImageFilter::kRepeat_TileMode, false) }, 471 SkMatrixConvolutionImageFilter::kRepeat_TileMode, false) },
472 { "merge", SkMergeImageFilter::Create(nullptr, nullptr, SkXfermode::kSrc Over_Mode) }, 472 { "merge", SkMergeImageFilter::Create(nullptr, nullptr, SkXfermode::kSrc Over_Mode) },
473 { "merge with disjoint inputs", SkMergeImageFilter::Create( 473 { "merge with disjoint inputs", SkMergeImageFilter::Create(
474 rectShaderFilterLeft, rectShaderFilterRight, SkXfermode::kSrcOver_ Mode) }, 474 rectShaderFilterLeft, rectShaderFilterRight, SkXfermode::kSrcOver_ Mode) },
475 { "offset", SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1) }, 475 { "offset", SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1) },
476 { "dilate", SkDilateImageFilter::Create(3, 2) }, 476 { "dilate", SkDilateImageFilter::Create(3, 2) },
477 { "erode", SkErodeImageFilter::Create(2, 3) }, 477 { "erode", SkErodeImageFilter::Create(2, 3) },
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 REPORTER_ASSERT(reporter, offset.fX == 0); 1156 REPORTER_ASSERT(reporter, offset.fX == 0);
1157 REPORTER_ASSERT(reporter, offset.fY == 0); 1157 REPORTER_ASSERT(reporter, offset.fY == 0);
1158 REPORTER_ASSERT(reporter, result.width() == 20); 1158 REPORTER_ASSERT(reporter, result.width() == 20);
1159 REPORTER_ASSERT(reporter, result.height() == 30); 1159 REPORTER_ASSERT(reporter, result.height() == 30);
1160 } 1160 }
1161 1161
1162 DEF_TEST(ImageFilterCanComputeFastBounds, reporter) { 1162 DEF_TEST(ImageFilterCanComputeFastBounds, reporter) {
1163 1163
1164 SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1); 1164 SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1);
1165 SkAutoTUnref<SkImageFilter> lighting(SkLightingImageFilter::CreatePointLitDi ffuse( 1165 SkAutoTUnref<SkImageFilter> lighting(SkLightingImageFilter::CreatePointLitDi ffuse(
1166 location, SK_ColorGREEN, 0, 0)); 1166 location, SK_ColorGREEN, 0, 0, NULL, NULL));
1167 REPORTER_ASSERT(reporter, !lighting->canComputeFastBounds()); 1167 REPORTER_ASSERT(reporter, !lighting->canComputeFastBounds());
1168 1168
1169 SkAutoTUnref<SkImageFilter> gray(make_grayscale(nullptr, nullptr)); 1169 SkAutoTUnref<SkImageFilter> gray(make_grayscale(nullptr, nullptr));
1170 REPORTER_ASSERT(reporter, gray->canComputeFastBounds()); 1170 REPORTER_ASSERT(reporter, gray->canComputeFastBounds());
1171 { 1171 {
1172 SkColorFilter* grayCF; 1172 SkColorFilter* grayCF;
1173 REPORTER_ASSERT(reporter, gray->asAColorFilter(&grayCF)); 1173 REPORTER_ASSERT(reporter, gray->asAColorFilter(&grayCF));
1174 REPORTER_ASSERT(reporter, !grayCF->affectsTransparentBlack()); 1174 REPORTER_ASSERT(reporter, !grayCF->affectsTransparentBlack());
1175 grayCF->unref(); 1175 grayCF->unref();
1176 } 1176 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 SkSurface::kNo_Budgeted , 1303 SkSurface::kNo_Budgeted ,
1304 SkImageInfo::MakeN32Pre mul(1, 1), 1304 SkImageInfo::MakeN32Pre mul(1, 1),
1305 0, 1305 0,
1306 &props, 1306 &props,
1307 SkGpuDevice::kUninit_In itContents)); 1307 SkGpuDevice::kUninit_In itContents));
1308 SkImageFilter::DeviceProxy proxy(device); 1308 SkImageFilter::DeviceProxy proxy(device);
1309 1309
1310 test_negative_blur_sigma(&proxy, reporter); 1310 test_negative_blur_sigma(&proxy, reporter);
1311 } 1311 }
1312 #endif 1312 #endif
OLDNEW
« no previous file with comments | « tests/GrTextureMipMapInvalidationTest.cpp ('k') | tests/ReadPixelsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698