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

Side by Side Diff: samplecode/SampleFilterFuzz.cpp

Issue 298093006: Fixing windows warnings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 "SkBicubicImageFilter.h" 9 #include "SkBicubicImageFilter.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 static SkScalar make_scalar(bool positiveOnly = false) { 93 static SkScalar make_scalar(bool positiveOnly = false) {
94 return make_number(positiveOnly); 94 return make_number(positiveOnly);
95 } 95 }
96 96
97 static SkRect make_rect() { 97 static SkRect make_rect() {
98 return SkRect::MakeWH(SkIntToScalar(R(static_cast<float>(kBitmapSize))), 98 return SkRect::MakeWH(SkIntToScalar(R(static_cast<float>(kBitmapSize))),
99 SkIntToScalar(R(static_cast<float>(kBitmapSize)))); 99 SkIntToScalar(R(static_cast<float>(kBitmapSize))));
100 } 100 }
101 101
102 static SkRegion make_region() { 102 static SkRegion make_region() {
103 SkIRect iRegion = SkIRect::MakeXYWH(SkIntToScalar(R(static_cast<float>(kBitm apSize))), 103 SkIRect iRegion = SkIRect::MakeXYWH(R(static_cast<float>(kBitmapSize)),
104 SkIntToScalar(R(static_cast<float>(kBitm apSize))), 104 R(static_cast<float>(kBitmapSize)),
105 SkIntToScalar(R(static_cast<float>(kBitm apSize))), 105 R(static_cast<float>(kBitmapSize)),
106 SkIntToScalar(R(static_cast<float>(kBitm apSize)))); 106 R(static_cast<float>(kBitmapSize)));
107 return SkRegion(iRegion); 107 return SkRegion(iRegion);
108 } 108 }
109 109
110 static SkMatrix make_matrix() { 110 static SkMatrix make_matrix() {
111 SkMatrix m; 111 SkMatrix m;
112 for (int i = 0; i < 9; ++i) { 112 for (int i = 0; i < 9; ++i) {
113 m[i] = make_scalar(); 113 m[i] = make_scalar();
114 } 114 }
115 return m; 115 return m;
116 } 116 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 case MATRIX_CONVOLUTION: 286 case MATRIX_CONVOLUTION:
287 { 287 {
288 SkImageFilter::CropRect cropR(SkRect::MakeWH(SkIntToScalar(kBitmapSize), 288 SkImageFilter::CropRect cropR(SkRect::MakeWH(SkIntToScalar(kBitmapSize),
289 SkIntToScalar(kBitmapSize)) ); 289 SkIntToScalar(kBitmapSize)) );
290 SkISize size = SkISize::Make(R(10)+1, R(10)+1); 290 SkISize size = SkISize::Make(R(10)+1, R(10)+1);
291 int arraySize = size.width() * size.height(); 291 int arraySize = size.width() * size.height();
292 SkTArray<SkScalar> kernel(arraySize); 292 SkTArray<SkScalar> kernel(arraySize);
293 for (int i = 0; i < arraySize; ++i) { 293 for (int i = 0; i < arraySize; ++i) {
294 kernel.push_back() = make_scalar(); 294 kernel.push_back() = make_scalar();
295 } 295 }
296 SkIPoint kernelOffset = SkIPoint::Make(R(size.width()), R(size.height()) ); 296 SkIPoint kernelOffset = SkIPoint::Make(R(SkIntToScalar(size.width())),
297 R(SkIntToScalar(size.height())));
297 filter = SkMatrixConvolutionImageFilter::Create(size, 298 filter = SkMatrixConvolutionImageFilter::Create(size,
298 kernel.begin(), 299 kernel.begin(),
299 make_scalar(), 300 make_scalar(),
300 make_scalar(), 301 make_scalar(),
301 kernelOffset, 302 kernelOffset,
302 (SkMatrixConvolutionImag eFilter::TileMode)R(3), 303 (SkMatrixConvolutionImag eFilter::TileMode)R(3),
303 R(2) == 1, 304 R(2) == 1,
304 make_image_filter(), 305 make_image_filter(),
305 &cropR); 306 &cropR);
306 } 307 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 } 482 }
482 483
483 private: 484 private:
484 typedef SkView INHERITED; 485 typedef SkView INHERITED;
485 }; 486 };
486 487
487 ////////////////////////////////////////////////////////////////////////////// 488 //////////////////////////////////////////////////////////////////////////////
488 489
489 static SkView* MyFactory() { return new ImageFilterFuzzView; } 490 static SkView* MyFactory() { return new ImageFilterFuzzView; }
490 static SkViewRegister reg(MyFactory); 491 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698