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

Side by Side Diff: bench/XfermodeBench.cpp

Issue 23576015: Change old PRG to be SkLCGRandom; change new one to SkRandom (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix some spurious SkMWCRandoms Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « bench/VertBench.cpp ('k') | gm/arcofzorro.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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBenchmark.h" 9 #include "SkBenchmark.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 17 matching lines...) Expand all
28 SkASSERT(NULL != xferMode); 28 SkASSERT(NULL != xferMode);
29 fXfermode.reset(xferMode); 29 fXfermode.reset(xferMode);
30 fName.printf("Xfermode_%s", name); 30 fName.printf("Xfermode_%s", name);
31 } 31 }
32 32
33 protected: 33 protected:
34 virtual const char* onGetName() SK_OVERRIDE { return fName.c_str(); } 34 virtual const char* onGetName() SK_OVERRIDE { return fName.c_str(); }
35 35
36 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 36 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
37 SkISize size = canvas->getDeviceSize(); 37 SkISize size = canvas->getDeviceSize();
38 SkMWCRandom random; 38 SkRandom random;
39 for (int i = 0; i < kNumRects; ++i) { 39 for (int i = 0; i < kNumRects; ++i) {
40 SkPaint paint; 40 SkPaint paint;
41 paint.setXfermode(fXfermode.get()); 41 paint.setXfermode(fXfermode.get());
42 paint.setColor(random.nextU()); 42 paint.setColor(random.nextU());
43 SkScalar w = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo Scalar(kMaxSize)); 43 SkScalar w = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo Scalar(kMaxSize));
44 SkScalar h = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo Scalar(kMaxSize)); 44 SkScalar h = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo Scalar(kMaxSize));
45 SkRect rect = SkRect::MakeXYWH( 45 SkRect rect = SkRect::MakeXYWH(
46 random.nextUScalar1() * (size.fWidth - w), 46 random.nextUScalar1() * (size.fWidth - w),
47 random.nextUScalar1() * (size.fHeight - h), 47 random.nextUScalar1() * (size.fHeight - h),
48 w, 48 w,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 BENCH(SkXfermode::kExclusion_Mode) 100 BENCH(SkXfermode::kExclusion_Mode)
101 BENCH(SkXfermode::kMultiply_Mode) 101 BENCH(SkXfermode::kMultiply_Mode)
102 102
103 BENCH(SkXfermode::kHue_Mode) 103 BENCH(SkXfermode::kHue_Mode)
104 BENCH(SkXfermode::kSaturation_Mode) 104 BENCH(SkXfermode::kSaturation_Mode)
105 BENCH(SkXfermode::kColor_Mode) 105 BENCH(SkXfermode::kColor_Mode)
106 BENCH(SkXfermode::kLuminosity_Mode) 106 BENCH(SkXfermode::kLuminosity_Mode)
107 107
108 BENCH(SkLumaMaskXfermode::Create(SkXfermode::kSrcIn_Mode), "SrcInLuma") 108 BENCH(SkLumaMaskXfermode::Create(SkXfermode::kSrcIn_Mode), "SrcInLuma")
109 BENCH(SkLumaMaskXfermode::Create(SkXfermode::kDstIn_Mode), "DstInLuma") 109 BENCH(SkLumaMaskXfermode::Create(SkXfermode::kDstIn_Mode), "DstInLuma")
OLDNEW
« no previous file with comments | « bench/VertBench.cpp ('k') | gm/arcofzorro.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698