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

Side by Side Diff: bench/BitmapBench.cpp

Issue 345263005: add rowbytes option to allocPixels (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | include/core/SkBitmap.h » ('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 2011 Google Inc. 2 * Copyright 2011 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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (fIsVolatile) 100 if (fIsVolatile)
101 fName.append("_volatile"); 101 fName.append("_volatile");
102 102
103 return fName.c_str(); 103 return fName.c_str();
104 } 104 }
105 105
106 virtual void onPreDraw() { 106 virtual void onPreDraw() {
107 SkBitmap bm; 107 SkBitmap bm;
108 108
109 if (kIndex_8_SkColorType == fColorType) { 109 if (kIndex_8_SkColorType == fColorType) {
110 bm.setInfo(SkImageInfo::MakeN32(W, H, fAlphaType)); 110 bm.allocPixels(SkImageInfo::MakeN32(W, H, fAlphaType));
111 } else { 111 } else {
112 bm.setInfo(SkImageInfo::Make(W, H, fColorType, fAlphaType)); 112 bm.allocPixels(SkImageInfo::Make(W, H, fColorType, fAlphaType));
113 } 113 }
114
115 bm.allocPixels();
116 bm.eraseColor(kOpaque_SkAlphaType == fAlphaType ? SK_ColorBLACK : 0); 114 bm.eraseColor(kOpaque_SkAlphaType == fAlphaType ? SK_ColorBLACK : 0);
117 115
118 onDrawIntoBitmap(bm); 116 onDrawIntoBitmap(bm);
119 117
120 if (kIndex_8_SkColorType == fColorType) { 118 if (kIndex_8_SkColorType == fColorType) {
121 convertToIndex666(bm, &fBitmap, fAlphaType); 119 convertToIndex666(bm, &fBitmap, fAlphaType);
122 } else { 120 } else {
123 fBitmap = bm; 121 fBitmap = bm;
124 } 122 }
125 123
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, t rue, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); ) 370 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kOpaque_SkAlphaType, t rue, false, kScale_Flag | kRotate_Flag | kBilerp_Flag); )
373 371
374 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, f alse, false, kScale_Flag | kBilerp_Flag | kBicubic_Flag); ) 372 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, f alse, false, kScale_Flag | kBilerp_Flag | kBicubic_Flag); )
375 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, f alse, false, kScale_Flag | kRotate_Flag | kBilerp_Flag | kBicubic_Flag); ) 373 DEF_BENCH( return new FilterBitmapBench(kN32_SkColorType, kPremul_SkAlphaType, f alse, false, kScale_Flag | kRotate_Flag | kBilerp_Flag | kBicubic_Flag); )
376 374
377 // source alpha tests -> S32A_Opaque_BlitRow32_{arm,neon} 375 // source alpha tests -> S32A_Opaque_BlitRow32_{arm,neon}
378 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kOpaque_Sou rceAlpha, kN32_SkColorType); ) 376 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kOpaque_Sou rceAlpha, kN32_SkColorType); )
379 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTransparen t_SourceAlpha, kN32_SkColorType); ) 377 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTransparen t_SourceAlpha, kN32_SkColorType); )
380 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTwoStripes _SourceAlpha, kN32_SkColorType); ) 378 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kTwoStripes _SourceAlpha, kN32_SkColorType); )
381 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kThreeStrip es_SourceAlpha, kN32_SkColorType); ) 379 DEF_BENCH( return new SourceAlphaBitmapBench(SourceAlphaBitmapBench::kThreeStrip es_SourceAlpha, kN32_SkColorType); )
OLDNEW
« no previous file with comments | « no previous file | include/core/SkBitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698