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

Side by Side Diff: bench/CoverageBench.cpp

Issue 50673005: Revert "Revert "speed up A8 by creating a new entry-point in SkDraw that blits the path's coverage … (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gyp/bench.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkBenchmark.h"
9 #include "SkBitmap.h"
10 #include "SkCanvas.h"
11 #include "SkColorPriv.h"
12 #include "SkDraw.h"
13 #include "SkMatrix.h"
14 #include "SkPath.h"
15 #include "SkRasterClip.h"
16
17 class DrawPathBench : public SkBenchmark {
18 SkPaint fPaint;
19 SkString fName;
20 SkPath fPath;
21 SkRasterClip fRC;
22 SkBitmap fBitmap;
23 SkMatrix fIdentity;
24 SkDraw fDraw;
25 bool fDrawCoverage;
26 public:
27 DrawPathBench(bool drawCoverage) : fDrawCoverage(drawCoverage) {
28 fPaint.setAntiAlias(true);
29 fName.printf("draw_coverage_%s", drawCoverage ? "true" : "false");
30
31 fPath.moveTo(0, 0);
32 fPath.quadTo(500, 0, 500, 500);
33 fPath.quadTo(250, 0, 0, 500);
34
35 fBitmap.setConfig(SkBitmap::kA8_Config, 500, 500);
36 fBitmap.allocPixels();
37
38 fIdentity.setIdentity();
39 fRC.setRect(fPath.getBounds().round());
40
41 fDraw.fBitmap = &fBitmap;
42 fDraw.fMatrix = &fIdentity;
43 fDraw.fClip = &fRC.bwRgn();
44 fDraw.fRC = &fRC;
45 }
46
47 protected:
48 virtual const char* onGetName() SK_OVERRIDE {
49 return fName.c_str();
50 }
51
52 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
53 if (fDrawCoverage) {
54 for (int i = 0; i < this->getLoops(); ++i) {
55 fDraw.drawPathCoverage(fPath, fPaint);
56 }
57 } else {
58 for (int i = 0; i < this->getLoops(); ++i) {
59 fDraw.drawPath(fPath, fPaint);
60 }
61 }
62 }
63
64 private:
65 typedef SkBenchmark INHERITED;
66 };
67
68 ///////////////////////////////////////////////////////////////////////////////
69
70 DEF_BENCH( return new DrawPathBench(false) )
71 DEF_BENCH( return new DrawPathBench(true) )
OLDNEW
« no previous file with comments | « no previous file | gyp/bench.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698