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

Side by Side Diff: bench/XfermodeBench.cpp

Issue 1043413002: experimental speedup some xfermodes with Sk4f (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comment Created 5 years, 8 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 | src/core/SkXfermode.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 "Benchmark.h" 9 #include "Benchmark.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 28 matching lines...) Expand all
39 paint.setXfermode(fXfermode.get()); 39 paint.setXfermode(fXfermode.get());
40 paint.setColor(random.nextU()); 40 paint.setColor(random.nextU());
41 SkScalar w = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo Scalar(kMaxSize)); 41 SkScalar w = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo Scalar(kMaxSize));
42 SkScalar h = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo Scalar(kMaxSize)); 42 SkScalar h = random.nextRangeScalar(SkIntToScalar(kMinSize), SkIntTo Scalar(kMaxSize));
43 SkRect rect = SkRect::MakeXYWH( 43 SkRect rect = SkRect::MakeXYWH(
44 random.nextUScalar1() * (size.fWidth - w), 44 random.nextUScalar1() * (size.fWidth - w),
45 random.nextUScalar1() * (size.fHeight - h), 45 random.nextUScalar1() * (size.fHeight - h),
46 w, 46 w,
47 h 47 h
48 ); 48 );
49 canvas->drawRect(rect, paint); 49 for (int j = 0; j < 1000; ++j) {
50 canvas->drawRect(rect, paint);
51 }
50 } 52 }
51 } 53 }
52 54
53 private: 55 private:
54 enum { 56 enum {
55 kMinSize = 50, 57 kMinSize = 50,
56 kMaxSize = 100, 58 kMaxSize = 100,
57 }; 59 };
58 SkAutoTUnref<SkXfermode> fXfermode; 60 SkAutoTUnref<SkXfermode> fXfermode;
59 SkString fName; 61 SkString fName;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 BENCH(SkXfermode::kDifference_Mode) 120 BENCH(SkXfermode::kDifference_Mode)
119 BENCH(SkXfermode::kExclusion_Mode) 121 BENCH(SkXfermode::kExclusion_Mode)
120 BENCH(SkXfermode::kMultiply_Mode) 122 BENCH(SkXfermode::kMultiply_Mode)
121 123
122 BENCH(SkXfermode::kHue_Mode) 124 BENCH(SkXfermode::kHue_Mode)
123 BENCH(SkXfermode::kSaturation_Mode) 125 BENCH(SkXfermode::kSaturation_Mode)
124 BENCH(SkXfermode::kColor_Mode) 126 BENCH(SkXfermode::kColor_Mode)
125 BENCH(SkXfermode::kLuminosity_Mode) 127 BENCH(SkXfermode::kLuminosity_Mode)
126 128
127 DEF_BENCH(return new XferCreateBench;) 129 DEF_BENCH(return new XferCreateBench;)
OLDNEW
« no previous file with comments | « no previous file | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698