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

Side by Side Diff: bench/CoverageBench.cpp

Issue 1168303006: Revert[2] SkDraw and all Blitters to use pixmap instead of bitmapi (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add dox to new test Created 5 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 | « no previous file | gm/fatpathfill.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 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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkDraw.h" 12 #include "SkDraw.h"
13 #include "SkMatrix.h" 13 #include "SkMatrix.h"
14 #include "SkPath.h" 14 #include "SkPath.h"
15 #include "SkRasterClip.h" 15 #include "SkRasterClip.h"
16 16
17 class DrawPathBench : public Benchmark { 17 class DrawPathBench : public Benchmark {
18 SkPaint fPaint; 18 SkPaint fPaint;
19 SkString fName; 19 SkString fName;
20 SkPath fPath; 20 SkPath fPath;
21 SkRasterClip fRC; 21 SkRasterClip fRC;
22 SkBitmap fBitmap; 22 SkAutoPixmapStorage fPixmap;
23 SkMatrix fIdentity; 23 SkMatrix fIdentity;
24 SkDraw fDraw; 24 SkDraw fDraw;
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.allocPixels(SkImageInfo::MakeA8(500, 500)); 35 fPixmap.alloc(SkImageInfo::MakeA8(500, 500));
36 36
37 fIdentity.setIdentity(); 37 fIdentity.setIdentity();
38 fRC.setRect(fPath.getBounds().round()); 38 fRC.setRect(fPath.getBounds().round());
39 39
40 fDraw.fBitmap = &fBitmap; 40 fDraw.fDst = fPixmap;
41 fDraw.fMatrix = &fIdentity; 41 fDraw.fMatrix = &fIdentity;
42 fDraw.fClip = &fRC.bwRgn(); 42 fDraw.fClip = &fRC.bwRgn();
43 fDraw.fRC = &fRC; 43 fDraw.fRC = &fRC;
44 } 44 }
45 45
46 protected: 46 protected:
47 const char* onGetName() override { 47 const char* onGetName() override {
48 return fName.c_str(); 48 return fName.c_str();
49 } 49 }
50 50
(...skipping 10 matching lines...) Expand all
61 } 61 }
62 62
63 private: 63 private:
64 typedef Benchmark INHERITED; 64 typedef Benchmark INHERITED;
65 }; 65 };
66 66
67 /////////////////////////////////////////////////////////////////////////////// 67 ///////////////////////////////////////////////////////////////////////////////
68 68
69 DEF_BENCH( return new DrawPathBench(false) ) 69 DEF_BENCH( return new DrawPathBench(false) )
70 DEF_BENCH( return new DrawPathBench(true) ) 70 DEF_BENCH( return new DrawPathBench(true) )
OLDNEW
« no previous file with comments | « no previous file | gm/fatpathfill.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698