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

Side by Side Diff: samplecode/SampleFilterFuzz.cpp

Issue 646213004: Adding an option to render only the shadow in SkDropShadowImageFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added dropshadowimagefilter to ignored-tests Created 6 years, 1 month 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 | « include/effects/SkDropShadowImageFilter.h ('k') | src/core/SkReadBuffer.h » ('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 #include "SampleCode.h" 7 #include "SampleCode.h"
8 #include "SkAlphaThresholdFilter.h" 8 #include "SkAlphaThresholdFilter.h"
9 #include "SkBitmapSource.h" 9 #include "SkBitmapSource.h"
10 #include "SkBlurImageFilter.h" 10 #include "SkBlurImageFilter.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 static SkXfermode::Mode make_xfermode() { 117 static SkXfermode::Mode make_xfermode() {
118 return static_cast<SkXfermode::Mode>(R(SkXfermode::kLastMode+1)); 118 return static_cast<SkXfermode::Mode>(R(SkXfermode::kLastMode+1));
119 } 119 }
120 120
121 static SkColor make_color() { 121 static SkColor make_color() {
122 return (R(2) == 1) ? 0xFFC0F0A0 : 0xFF000090; 122 return (R(2) == 1) ? 0xFFC0F0A0 : 0xFF000090;
123 } 123 }
124 124
125 static SkDropShadowImageFilter::ShadowMode make_shadow_mode() {
126 return (R(2) == 1) ? SkDropShadowImageFilter::kDrawShadowAndForeground_Shado wMode :
127 SkDropShadowImageFilter::kDrawShadowOnly_ShadowMode;
128 }
129
125 static SkPoint3 make_point() { 130 static SkPoint3 make_point() {
126 return SkPoint3(make_scalar(), make_scalar(), make_scalar(true)); 131 return SkPoint3(make_scalar(), make_scalar(), make_scalar(true));
127 } 132 }
128 133
129 static SkDisplacementMapEffect::ChannelSelectorType make_channel_selector_type() { 134 static SkDisplacementMapEffect::ChannelSelectorType make_channel_selector_type() {
130 return static_cast<SkDisplacementMapEffect::ChannelSelectorType>(R(4)+1); 135 return static_cast<SkDisplacementMapEffect::ChannelSelectorType>(R(4)+1);
131 } 136 }
132 137
133 static bool valid_for_raster_canvas(const SkImageInfo& info) { 138 static bool valid_for_raster_canvas(const SkImageInfo& info) {
134 switch (info.colorType()) { 139 switch (info.colorType()) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 SkPerlinNoiseShader::CreateFractalNoise( 338 SkPerlinNoiseShader::CreateFractalNoise(
334 make_scalar(true), make_scalar(true), R(10.0f), make_scalar()) : 339 make_scalar(true), make_scalar(true), R(10.0f), make_scalar()) :
335 SkPerlinNoiseShader::CreateTurbulence( 340 SkPerlinNoiseShader::CreateTurbulence(
336 make_scalar(true), make_scalar(true), R(10.0f), make_scalar())); 341 make_scalar(true), make_scalar(true), R(10.0f), make_scalar()));
337 SkImageFilter::CropRect cropR(SkRect::MakeWH(SkIntToScalar(kBitmapSize), 342 SkImageFilter::CropRect cropR(SkRect::MakeWH(SkIntToScalar(kBitmapSize),
338 SkIntToScalar(kBitmapSize)) ); 343 SkIntToScalar(kBitmapSize)) );
339 filter = SkRectShaderImageFilter::Create(shader, &cropR); 344 filter = SkRectShaderImageFilter::Create(shader, &cropR);
340 } 345 }
341 break; 346 break;
342 case DROP_SHADOW: 347 case DROP_SHADOW:
343 filter = SkDropShadowImageFilter::Create(make_scalar(), make_scalar(), 348 filter = SkDropShadowImageFilter::Create(make_scalar(), make_scalar(), m ake_scalar(true),
344 make_scalar(true), make_scalar(true), make_color(), make_im age_filter()); 349 make_scalar(true), make_color(), make_shadow_mode(), make_im age_filter(),
350 NULL, 0);
345 break; 351 break;
346 case MORPHOLOGY: 352 case MORPHOLOGY:
347 if (R(2) == 1) { 353 if (R(2) == 1) {
348 filter = SkDilateImageFilter::Create(R(static_cast<float>(kBitmapSiz e)), 354 filter = SkDilateImageFilter::Create(R(static_cast<float>(kBitmapSiz e)),
349 R(static_cast<float>(kBitmapSize)), make_image_filter()); 355 R(static_cast<float>(kBitmapSize)), make_image_filter());
350 } else { 356 } else {
351 filter = SkErodeImageFilter::Create(R(static_cast<float>(kBitmapSize )), 357 filter = SkErodeImageFilter::Create(R(static_cast<float>(kBitmapSize )),
352 R(static_cast<float>(kBitmapSize)), make_image_filter()); 358 R(static_cast<float>(kBitmapSize)), make_image_filter());
353 } 359 }
354 break; 360 break;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 481 }
476 482
477 private: 483 private:
478 typedef SkView INHERITED; 484 typedef SkView INHERITED;
479 }; 485 };
480 486
481 ////////////////////////////////////////////////////////////////////////////// 487 //////////////////////////////////////////////////////////////////////////////
482 488
483 static SkView* MyFactory() { return new ImageFilterFuzzView; } 489 static SkView* MyFactory() { return new ImageFilterFuzzView; }
484 static SkViewRegister reg(MyFactory); 490 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/effects/SkDropShadowImageFilter.h ('k') | src/core/SkReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698