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

Side by Side Diff: bench/BlurImageFilterBench.cpp

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Updating to ToT (10994) 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 | « no previous file | bench/DeferredCanvasBench.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 7
8 #include "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkBitmapDevice.h"
9 #include "SkBlurImageFilter.h" 10 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 11 #include "SkCanvas.h"
11 #include "SkDevice.h"
12 #include "SkPaint.h" 12 #include "SkPaint.h"
13 #include "SkRandom.h" 13 #include "SkRandom.h"
14 #include "SkShader.h" 14 #include "SkShader.h"
15 #include "SkString.h" 15 #include "SkString.h"
16 16
17 #define FILTER_WIDTH_SMALL 32 17 #define FILTER_WIDTH_SMALL 32
18 #define FILTER_HEIGHT_SMALL 32 18 #define FILTER_HEIGHT_SMALL 32
19 #define FILTER_WIDTH_LARGE 256 19 #define FILTER_WIDTH_LARGE 256
20 #define FILTER_HEIGHT_LARGE 256 20 #define FILTER_HEIGHT_LARGE 256
21 #define BLUR_SIGMA_SMALL SkFloatToScalar(1.0f) 21 #define BLUR_SIGMA_SMALL SkFloatToScalar(1.0f)
(...skipping 24 matching lines...) Expand all
46 paint.setImageFilter(new SkBlurImageFilter(fSigmaX, fSigmaY))->unref(); 46 paint.setImageFilter(new SkBlurImageFilter(fSigmaX, fSigmaY))->unref();
47 canvas->drawBitmap(fCheckerboard, 0, 0, &paint); 47 canvas->drawBitmap(fCheckerboard, 0, 0, &paint);
48 } 48 }
49 49
50 private: 50 private:
51 void make_checkerboard() { 51 void make_checkerboard() {
52 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; 52 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE;
53 const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE; 53 const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE;
54 fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, w, h); 54 fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, w, h);
55 fCheckerboard.allocPixels(); 55 fCheckerboard.allocPixels();
56 SkDevice device(fCheckerboard); 56 SkBitmapDevice device(fCheckerboard);
57 SkCanvas canvas(&device); 57 SkCanvas canvas(&device);
58 canvas.clear(0x00000000); 58 canvas.clear(0x00000000);
59 SkPaint darkPaint; 59 SkPaint darkPaint;
60 darkPaint.setColor(0xFF804020); 60 darkPaint.setColor(0xFF804020);
61 SkPaint lightPaint; 61 SkPaint lightPaint;
62 lightPaint.setColor(0xFF244484); 62 lightPaint.setColor(0xFF244484);
63 for (int y = 0; y < h; y += 16) { 63 for (int y = 0; y < h; y += 16) {
64 for (int x = 0; x < w; x += 16) { 64 for (int x = 0; x < w; x += 16) {
65 canvas.save(); 65 canvas.save();
66 canvas.translate(SkIntToScalar(x), SkIntToScalar(y)); 66 canvas.translate(SkIntToScalar(x), SkIntToScalar(y));
(...skipping 11 matching lines...) Expand all
78 bool fInitialized; 78 bool fInitialized;
79 SkBitmap fCheckerboard; 79 SkBitmap fCheckerboard;
80 SkScalar fSigmaX, fSigmaY; 80 SkScalar fSigmaX, fSigmaY;
81 typedef SkBenchmark INHERITED; 81 typedef SkBenchmark INHERITED;
82 }; 82 };
83 83
84 DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, true);) 84 DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, true);)
85 DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, false);) 85 DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, false);)
86 DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, true);) 86 DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, true);)
87 DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, false);) 87 DEF_BENCH(return new BlurImageFilterBench(p, BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, false);)
OLDNEW
« no previous file with comments | « no previous file | bench/DeferredCanvasBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698