| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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(); ) |
| OLD | NEW |