| OLD | NEW |
| 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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 bool fDrawCoverage; | 25 bool fDrawCoverage; |
| 26 public: | 26 public: |
| 27 DrawPathBench(bool drawCoverage) : fDrawCoverage(drawCoverage) { | 27 DrawPathBench(bool drawCoverage) : fDrawCoverage(drawCoverage) { |
| 28 fPaint.setAntiAlias(true); | 28 fPaint.setAntiAlias(true); |
| 29 fName.printf("draw_coverage_%s", drawCoverage ? "true" : "false"); | 29 fName.printf("draw_coverage_%s", drawCoverage ? "true" : "false"); |
| 30 | 30 |
| 31 fPath.moveTo(0, 0); | 31 fPath.moveTo(0, 0); |
| 32 fPath.quadTo(500, 0, 500, 500); | 32 fPath.quadTo(500, 0, 500, 500); |
| 33 fPath.quadTo(250, 0, 0, 500); | 33 fPath.quadTo(250, 0, 0, 500); |
| 34 | 34 |
| 35 fBitmap.setConfig(SkBitmap::kA8_Config, 500, 500); | 35 fBitmap.allocPixels(SkImageInfo::MakeA8(500, 500)); |
| 36 fBitmap.allocPixels(); | |
| 37 | 36 |
| 38 fIdentity.setIdentity(); | 37 fIdentity.setIdentity(); |
| 39 fRC.setRect(fPath.getBounds().round()); | 38 fRC.setRect(fPath.getBounds().round()); |
| 40 | 39 |
| 41 fDraw.fBitmap = &fBitmap; | 40 fDraw.fBitmap = &fBitmap; |
| 42 fDraw.fMatrix = &fIdentity; | 41 fDraw.fMatrix = &fIdentity; |
| 43 fDraw.fClip = &fRC.bwRgn(); | 42 fDraw.fClip = &fRC.bwRgn(); |
| 44 fDraw.fRC = &fRC; | 43 fDraw.fRC = &fRC; |
| 45 } | 44 } |
| 46 | 45 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 62 } | 61 } |
| 63 | 62 |
| 64 private: | 63 private: |
| 65 typedef SkBenchmark INHERITED; | 64 typedef SkBenchmark INHERITED; |
| 66 }; | 65 }; |
| 67 | 66 |
| 68 /////////////////////////////////////////////////////////////////////////////// | 67 /////////////////////////////////////////////////////////////////////////////// |
| 69 | 68 |
| 70 DEF_BENCH( return new DrawPathBench(false) ) | 69 DEF_BENCH( return new DrawPathBench(false) ) |
| 71 DEF_BENCH( return new DrawPathBench(true) ) | 70 DEF_BENCH( return new DrawPathBench(true) ) |
| OLD | NEW |