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

Side by Side Diff: bench/PictureRecordBench.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/MergeBench.cpp ('k') | bench/ReadPixBench.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 2012 Google Inc. 2 * Copyright 2012 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 #include "SkBenchmark.h" 7 #include "SkBenchmark.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 paint.setColor(color); 78 paint.setColor(color);
79 canvas->drawPaint(paint); 79 canvas->drawPaint(paint);
80 80
81 // set a matrix on the canvas 81 // set a matrix on the canvas
82 SkMatrix matrix; 82 SkMatrix matrix;
83 matrix.setRotate(SkIntToScalar(i % 360)); 83 matrix.setRotate(SkIntToScalar(i % 360));
84 canvas->setMatrix(matrix); 84 canvas->setMatrix(matrix);
85 85
86 // create a simple bitmap 86 // create a simple bitmap
87 SkBitmap bitmap; 87 SkBitmap bitmap;
88 bitmap.setConfig(SkBitmap::kRGB_565_Config, 10, 10); 88 bitmap.allocPixels(SkImageInfo::Make(10, 10,
89 bitmap.allocPixels(); 89 kRGB_565_SkColorType, kOpaque_S kAlphaType));
90 90
91 // draw a single color into the bitmap 91 // draw a single color into the bitmap
92 SkCanvas bitmapCanvas(bitmap); 92 SkCanvas bitmapCanvas(bitmap);
93 bitmapCanvas.drawColor(SkColorSetA(color, i % 255)); 93 bitmapCanvas.drawColor(SkColorSetA(color, i % 255));
94 94
95 // draw the bitmap onto the canvas 95 // draw the bitmap onto the canvas
96 canvas->drawBitmapMatrix(bitmap, matrix); 96 canvas->drawBitmapMatrix(bitmap, matrix);
97 97
98 canvas->restore(); 98 canvas->restore();
99 canvas->translate(translateDelta.fX, translateDelta.fY); 99 canvas->translate(translateDelta.fX, translateDelta.fY);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 private: 169 private:
170 SkPaint fPaint [ObjCount]; 170 SkPaint fPaint [ObjCount];
171 typedef PictureRecordBench INHERITED; 171 typedef PictureRecordBench INHERITED;
172 }; 172 };
173 173
174 /////////////////////////////////////////////////////////////////////////////// 174 ///////////////////////////////////////////////////////////////////////////////
175 175
176 DEF_BENCH( return new DictionaryRecordBench(); ) 176 DEF_BENCH( return new DictionaryRecordBench(); )
177 DEF_BENCH( return new UniquePaintDictionaryRecordBench(); ) 177 DEF_BENCH( return new UniquePaintDictionaryRecordBench(); )
178 DEF_BENCH( return new RecurringPaintDictionaryRecordBench(); ) 178 DEF_BENCH( return new RecurringPaintDictionaryRecordBench(); )
OLDNEW
« no previous file with comments | « bench/MergeBench.cpp ('k') | bench/ReadPixBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698