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

Side by Side Diff: bench/ReadPixBench.cpp

Issue 322963002: hide SkBitmap::setConfig (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 | « bench/PictureRecordBench.cpp ('k') | bench/RectBench.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 2012 The Android Open Source Project 3 * Copyright 2012 The Android Open Source Project
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 25 matching lines...) Expand all
36 36
37 paint.setColor(SK_ColorBLUE); 37 paint.setColor(SK_ColorBLUE);
38 38
39 canvas->drawCircle(SkIntToScalar(size.width()/2), 39 canvas->drawCircle(SkIntToScalar(size.width()/2),
40 SkIntToScalar(size.height()/2), 40 SkIntToScalar(size.height()/2),
41 SkIntToScalar(size.width()/2), 41 SkIntToScalar(size.width()/2),
42 paint); 42 paint);
43 43
44 SkBitmap bitmap; 44 SkBitmap bitmap;
45 45
46 bitmap.setConfig(SkBitmap::kARGB_8888_Config, kWindowSize, kWindowSize); 46 bitmap.setInfo(SkImageInfo::MakeN32Premul(kWindowSize, kWindowSize));
47 47
48 for (int i = 0; i < loops; i++) { 48 for (int i = 0; i < loops; i++) {
49 for (int x = 0; x < kNumStepsX; ++x) { 49 for (int x = 0; x < kNumStepsX; ++x) {
50 for (int y = 0; y < kNumStepsY; ++y) { 50 for (int y = 0; y < kNumStepsY; ++y) {
51 canvas->readPixels(&bitmap, x * offX, y * offY); 51 canvas->readPixels(&bitmap, x * offX, y * offY);
52 } 52 }
53 } 53 }
54 } 54 }
55 } 55 }
56 56
57 private: 57 private:
58 static const int kNumStepsX = 30; 58 static const int kNumStepsX = 30;
59 static const int kNumStepsY = 30; 59 static const int kNumStepsY = 30;
60 static const int kWindowSize = 5; 60 static const int kWindowSize = 5;
61 61
62 typedef SkBenchmark INHERITED; 62 typedef SkBenchmark INHERITED;
63 }; 63 };
64 64
65 //////////////////////////////////////////////////////////////////////////////// 65 ////////////////////////////////////////////////////////////////////////////////
66 66
67 DEF_BENCH( return new ReadPixBench(); ) 67 DEF_BENCH( return new ReadPixBench(); )
OLDNEW
« no previous file with comments | « bench/PictureRecordBench.cpp ('k') | bench/RectBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698