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

Side by Side Diff: bench/BitmapScaleBench.cpp

Issue 1601093003: Valgrind is not a fan of uninitialized Src pixels. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 7
8 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 class PixmapScalerBench: public Benchmark { 118 class PixmapScalerBench: public Benchmark {
119 SkBitmapScaler::ResizeMethod fMethod; 119 SkBitmapScaler::ResizeMethod fMethod;
120 SkString fName; 120 SkString fName;
121 SkBitmap fSrc, fDst; 121 SkBitmap fSrc, fDst;
122 122
123 public: 123 public:
124 PixmapScalerBench(SkBitmapScaler::ResizeMethod method, const char suffix[]) : fMethod(method) { 124 PixmapScalerBench(SkBitmapScaler::ResizeMethod method, const char suffix[]) : fMethod(method) {
125 fName.printf("pixmapscaler_%s", suffix); 125 fName.printf("pixmapscaler_%s", suffix);
126 } 126 }
127 127
128 protected: 128 protected:
129 const char* onGetName() override { 129 const char* onGetName() override {
130 return fName.c_str(); 130 return fName.c_str();
131 } 131 }
132 132
133 SkIPoint onGetSize() override { return{ 100, 100 }; } 133 SkIPoint onGetSize() override { return{ 100, 100 }; }
134 134
135 bool isSuitableFor(Backend backend) override { 135 bool isSuitableFor(Backend backend) override {
136 return backend == kNonRendering_Backend; 136 return backend == kNonRendering_Backend;
137 } 137 }
138 138
139 void onDelayedSetup() override { 139 void onDelayedSetup() override {
140 fSrc.allocN32Pixels(640, 480); 140 fSrc.allocN32Pixels(640, 480);
141 fSrc.eraseColor(SK_ColorWHITE);
141 fDst.allocN32Pixels(300, 250); 142 fDst.allocN32Pixels(300, 250);
142 } 143 }
143 144
144 void onDraw(int loops, SkCanvas*) override { 145 void onDraw(int loops, SkCanvas*) override {
145 SkPixmap src, dst; 146 SkPixmap src, dst;
146 fSrc.peekPixels(&src); 147 fSrc.peekPixels(&src);
147 fDst.peekPixels(&dst); 148 fDst.peekPixels(&dst);
148 for (int i = 0; i < loops * 16; i++) { 149 for (int i = 0; i < loops * 16; i++) {
149 SkBitmapScaler::Resize(dst, src, fMethod); 150 SkBitmapScaler::Resize(dst, src, fMethod);
150 } 151 }
151 } 152 }
152 153
153 private: 154 private:
154 typedef Benchmark INHERITED; 155 typedef Benchmark INHERITED;
155 }; 156 };
156 DEF_BENCH( return new PixmapScalerBench(SkBitmapScaler::RESIZE_LANCZOS3, "lanczo s"); ) 157 DEF_BENCH( return new PixmapScalerBench(SkBitmapScaler::RESIZE_LANCZOS3, "lanczo s"); )
157 DEF_BENCH( return new PixmapScalerBench(SkBitmapScaler::RESIZE_MITCHELL, "mitche ll"); ) 158 DEF_BENCH( return new PixmapScalerBench(SkBitmapScaler::RESIZE_MITCHELL, "mitche ll"); )
158 DEF_BENCH( return new PixmapScalerBench(SkBitmapScaler::RESIZE_HAMMING, "hammin g"); ) 159 DEF_BENCH( return new PixmapScalerBench(SkBitmapScaler::RESIZE_HAMMING, "hammin g"); )
159 DEF_BENCH( return new PixmapScalerBench(SkBitmapScaler::RESIZE_TRIANGLE, "triang le"); ) 160 DEF_BENCH( return new PixmapScalerBench(SkBitmapScaler::RESIZE_TRIANGLE, "triang le"); )
160 DEF_BENCH( return new PixmapScalerBench(SkBitmapScaler::RESIZE_BOX, "box"); ) 161 DEF_BENCH( return new PixmapScalerBench(SkBitmapScaler::RESIZE_BOX, "box"); )
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