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

Side by Side Diff: samplecode/SampleFilterFuzz.cpp

Issue 1229693009: Add new SkPoint3 class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More Chromium staging Created 5 years, 5 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 | « include/effects/SkPoint3.h ('k') | samplecode/SampleLighting.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 #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"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkColorCubeFilter.h" 12 #include "SkColorCubeFilter.h"
13 #include "SkColorFilter.h" 13 #include "SkColorFilter.h"
14 #include "SkColorFilterImageFilter.h" 14 #include "SkColorFilterImageFilter.h"
15 #include "SkComposeImageFilter.h" 15 #include "SkComposeImageFilter.h"
16 #include "SkData.h" 16 #include "SkData.h"
17 #include "SkDisplacementMapEffect.h" 17 #include "SkDisplacementMapEffect.h"
18 #include "SkDropShadowImageFilter.h" 18 #include "SkDropShadowImageFilter.h"
19 #include "SkFlattenableSerialization.h" 19 #include "SkFlattenableSerialization.h"
20 #include "SkLightingImageFilter.h" 20 #include "SkLightingImageFilter.h"
21 #include "SkMagnifierImageFilter.h" 21 #include "SkMagnifierImageFilter.h"
22 #include "SkMatrixConvolutionImageFilter.h" 22 #include "SkMatrixConvolutionImageFilter.h"
23 #include "SkMergeImageFilter.h" 23 #include "SkMergeImageFilter.h"
24 #include "SkMorphologyImageFilter.h" 24 #include "SkMorphologyImageFilter.h"
25 #include "SkOffsetImageFilter.h" 25 #include "SkOffsetImageFilter.h"
26 #include "SkPerlinNoiseShader.h" 26 #include "SkPerlinNoiseShader.h"
27 #include "SkPictureImageFilter.h" 27 #include "SkPictureImageFilter.h"
28 #include "SkPictureRecorder.h" 28 #include "SkPictureRecorder.h"
29 #include "SkPoint3.h"
29 #include "SkRandom.h" 30 #include "SkRandom.h"
30 #include "SkRectShaderImageFilter.h" 31 #include "SkRectShaderImageFilter.h"
31 #include "SkTestImageFilters.h" 32 #include "SkTestImageFilters.h"
32 #include "SkTileImageFilter.h" 33 #include "SkTileImageFilter.h"
33 #include "SkView.h" 34 #include "SkView.h"
34 #include "SkXfermodeImageFilter.h" 35 #include "SkXfermodeImageFilter.h"
35 #include <stdio.h> 36 #include <stdio.h>
36 #include <time.h> 37 #include <time.h>
37 38
38 //#define SK_ADD_RANDOM_BIT_FLIPS 39 //#define SK_ADD_RANDOM_BIT_FLIPS
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 static SkColor make_color() { 122 static SkColor make_color() {
122 return (R(2) == 1) ? 0xFFC0F0A0 : 0xFF000090; 123 return (R(2) == 1) ? 0xFFC0F0A0 : 0xFF000090;
123 } 124 }
124 125
125 static SkDropShadowImageFilter::ShadowMode make_shadow_mode() { 126 static SkDropShadowImageFilter::ShadowMode make_shadow_mode() {
126 return (R(2) == 1) ? SkDropShadowImageFilter::kDrawShadowAndForeground_Shado wMode : 127 return (R(2) == 1) ? SkDropShadowImageFilter::kDrawShadowAndForeground_Shado wMode :
127 SkDropShadowImageFilter::kDrawShadowOnly_ShadowMode; 128 SkDropShadowImageFilter::kDrawShadowOnly_ShadowMode;
128 } 129 }
129 130
130 static SkPoint3 make_point() { 131 static SkPoint3 make_point() {
131 return SkPoint3(make_scalar(), make_scalar(), make_scalar(true)); 132 return SkPoint3::Make(make_scalar(), make_scalar(), make_scalar(true));
132 } 133 }
133 134
134 static SkDisplacementMapEffect::ChannelSelectorType make_channel_selector_type() { 135 static SkDisplacementMapEffect::ChannelSelectorType make_channel_selector_type() {
135 return static_cast<SkDisplacementMapEffect::ChannelSelectorType>(R(4)+1); 136 return static_cast<SkDisplacementMapEffect::ChannelSelectorType>(R(4)+1);
136 } 137 }
137 138
138 static bool valid_for_raster_canvas(const SkImageInfo& info) { 139 static bool valid_for_raster_canvas(const SkImageInfo& info) {
139 switch (info.colorType()) { 140 switch (info.colorType()) {
140 case kAlpha_8_SkColorType: 141 case kAlpha_8_SkColorType:
141 case kRGB_565_SkColorType: 142 case kRGB_565_SkColorType:
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 case POINT_LIGHT: 351 case POINT_LIGHT:
351 filter = (R(2) == 1) ? 352 filter = (R(2) == 1) ?
352 SkLightingImageFilter::CreatePointLitDiffuse(make_point(), 353 SkLightingImageFilter::CreatePointLitDiffuse(make_point(),
353 make_color(), make_scalar(), make_scalar(), make_image_filter() ) : 354 make_color(), make_scalar(), make_scalar(), make_image_filter() ) :
354 SkLightingImageFilter::CreatePointLitSpecular(make_point(), 355 SkLightingImageFilter::CreatePointLitSpecular(make_point(),
355 make_color(), make_scalar(), make_scalar(), SkIntToScalar(R(10) ), 356 make_color(), make_scalar(), make_scalar(), SkIntToScalar(R(10) ),
356 make_image_filter()); 357 make_image_filter());
357 break; 358 break;
358 case SPOT_LIGHT: 359 case SPOT_LIGHT:
359 filter = (R(2) == 1) ? 360 filter = (R(2) == 1) ?
360 SkLightingImageFilter::CreateSpotLitDiffuse(SkPoint3(0, 0, 0), 361 SkLightingImageFilter::CreateSpotLitDiffuse(SkPoint3::Make(0, 0 , 0),
361 make_point(), make_scalar(), make_scalar(), make_color(), 362 make_point(), make_scalar(), make_scalar(), make_color(),
362 make_scalar(), make_scalar(), make_image_filter()) : 363 make_scalar(), make_scalar(), make_image_filter()) :
363 SkLightingImageFilter::CreateSpotLitSpecular(SkPoint3(0, 0, 0), 364 SkLightingImageFilter::CreateSpotLitSpecular(SkPoint3::Make(0, 0, 0),
364 make_point(), make_scalar(), make_scalar(), make_color(), 365 make_point(), make_scalar(), make_scalar(), make_color(),
365 make_scalar(), make_scalar(), SkIntToScalar(R(10)), make_image_ filter()); 366 make_scalar(), make_scalar(), SkIntToScalar(R(10)), make_image_ filter());
366 break; 367 break;
367 case NOISE: 368 case NOISE:
368 { 369 {
369 SkAutoTUnref<SkShader> shader((R(2) == 1) ? 370 SkAutoTUnref<SkShader> shader((R(2) == 1) ?
370 SkPerlinNoiseShader::CreateFractalNoise( 371 SkPerlinNoiseShader::CreateFractalNoise(
371 make_scalar(true), make_scalar(true), R(10.0f), make_scalar()) : 372 make_scalar(true), make_scalar(true), R(10.0f), make_scalar()) :
372 SkPerlinNoiseShader::CreateTurbulence( 373 SkPerlinNoiseShader::CreateTurbulence(
373 make_scalar(true), make_scalar(true), R(10.0f), make_scalar())); 374 make_scalar(true), make_scalar(true), R(10.0f), make_scalar()));
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } 514 }
514 515
515 private: 516 private:
516 typedef SkView INHERITED; 517 typedef SkView INHERITED;
517 }; 518 };
518 519
519 ////////////////////////////////////////////////////////////////////////////// 520 //////////////////////////////////////////////////////////////////////////////
520 521
521 static SkView* MyFactory() { return new ImageFilterFuzzView; } 522 static SkView* MyFactory() { return new ImageFilterFuzzView; }
522 static SkViewRegister reg(MyFactory); 523 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/effects/SkPoint3.h ('k') | samplecode/SampleLighting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698