| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkRect.h" | 10 #include "SkRect.h" |
| 11 #include "SkString.h" | 11 #include "SkString.h" |
| 12 | 12 |
| 13 class DrawLatticeBench : public Benchmark { | 13 class DrawLatticeBench : public Benchmark { |
| 14 public: | 14 public: |
| 15 DrawLatticeBench(int* xDivs, int xCount, int* yDivs, int yCount, const SkISi
ze& srcSize, | 15 DrawLatticeBench(int* xDivs, int xCount, int* yDivs, int yCount, const SkISi
ze& srcSize, |
| 16 const SkRect& dst, const char* desc) | 16 const SkRect& dst, const char* desc) |
| 17 : fSrcSize(srcSize) | 17 : fSrcSize(srcSize) |
| 18 , fDst(dst) | 18 , fDst(dst) |
| 19 { | 19 { |
| 20 fLattice.fXDivs = xDivs; | 20 fLattice.fXDivs = xDivs; |
| 21 fLattice.fXCount = xCount; | 21 fLattice.fXCount = xCount; |
| 22 fLattice.fYDivs = yDivs; | 22 fLattice.fYDivs = yDivs; |
| 23 fLattice.fYCount = yCount; | 23 fLattice.fYCount = yCount; |
| 24 fLattice.fFlags = nullptr; | 24 fLattice.fFlags = nullptr; |
| 25 fLattice.fBounds = nullptr; |
| 25 | 26 |
| 26 fName = SkStringPrintf("DrawLattice_%s", desc); | 27 fName = SkStringPrintf("DrawLattice_%s", desc); |
| 27 } | 28 } |
| 28 | 29 |
| 29 const char* onGetName() override { | 30 const char* onGetName() override { |
| 30 return fName.c_str(); | 31 return fName.c_str(); |
| 31 } | 32 } |
| 32 | 33 |
| 33 SkIPoint onGetSize() override { | 34 SkIPoint onGetSize() override { |
| 34 return SkIPoint::Make(1000, 1000); | 35 return SkIPoint::Make(1000, 1000); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 SkRect::MakeWH(500.0f, 500.0f), "Src100_Ds
t500_Rects9");) | 67 SkRect::MakeWH(500.0f, 500.0f), "Src100_Ds
t500_Rects9");) |
| 67 DEF_BENCH(return new DrawLatticeBench(gDivs9, 2, gDivs9, 2, SkISize::Make(100, 1
00), | 68 DEF_BENCH(return new DrawLatticeBench(gDivs9, 2, gDivs9, 2, SkISize::Make(100, 1
00), |
| 68 SkRect::MakeWH(1000.0f, 1000.0f), "Src100_
Dst1000_Rects9");) | 69 SkRect::MakeWH(1000.0f, 1000.0f), "Src100_
Dst1000_Rects9");) |
| 69 static int gDivs15[4] = { 15, 45, 55, 85, }; | 70 static int gDivs15[4] = { 15, 45, 55, 85, }; |
| 70 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), | 71 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), |
| 71 SkRect::MakeWH(250.0f, 250.0f), "Src100_Ds
t250_Rects15");) | 72 SkRect::MakeWH(250.0f, 250.0f), "Src100_Ds
t250_Rects15");) |
| 72 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), | 73 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), |
| 73 SkRect::MakeWH(500.0f, 500.0f), "Src100_Ds
t500_Rects15");) | 74 SkRect::MakeWH(500.0f, 500.0f), "Src100_Ds
t500_Rects15");) |
| 74 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), | 75 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), |
| 75 SkRect::MakeWH(1000.0f, 1000.0f), "Src100_
Dst1000_Rects15");) | 76 SkRect::MakeWH(1000.0f, 1000.0f), "Src100_
Dst1000_Rects15");) |
| OLD | NEW |