| 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 | 25 |
| 25 fName = SkStringPrintf("DrawLattice_%s", desc); | 26 fName = SkStringPrintf("DrawLattice_%s", desc); |
| 26 } | 27 } |
| 27 | 28 |
| 28 const char* onGetName() override { | 29 const char* onGetName() override { |
| 29 return fName.c_str(); | 30 return fName.c_str(); |
| 30 } | 31 } |
| 31 | 32 |
| 32 SkIPoint onGetSize() override { | 33 SkIPoint onGetSize() override { |
| 33 return SkIPoint::Make(1000, 1000); | 34 return SkIPoint::Make(1000, 1000); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 SkRect::MakeWH(500.0f, 500.0f), "Src100_Ds
t500_Rects9");) | 66 SkRect::MakeWH(500.0f, 500.0f), "Src100_Ds
t500_Rects9");) |
| 66 DEF_BENCH(return new DrawLatticeBench(gDivs9, 2, gDivs9, 2, SkISize::Make(100, 1
00), | 67 DEF_BENCH(return new DrawLatticeBench(gDivs9, 2, gDivs9, 2, SkISize::Make(100, 1
00), |
| 67 SkRect::MakeWH(1000.0f, 1000.0f), "Src100_
Dst1000_Rects9");) | 68 SkRect::MakeWH(1000.0f, 1000.0f), "Src100_
Dst1000_Rects9");) |
| 68 static int gDivs15[4] = { 15, 45, 55, 85, }; | 69 static int gDivs15[4] = { 15, 45, 55, 85, }; |
| 69 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), | 70 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), |
| 70 SkRect::MakeWH(250.0f, 250.0f), "Src100_Ds
t250_Rects15");) | 71 SkRect::MakeWH(250.0f, 250.0f), "Src100_Ds
t250_Rects15");) |
| 71 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), | 72 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), |
| 72 SkRect::MakeWH(500.0f, 500.0f), "Src100_Ds
t500_Rects15");) | 73 SkRect::MakeWH(500.0f, 500.0f), "Src100_Ds
t500_Rects15");) |
| 73 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), | 74 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100,
100), |
| 74 SkRect::MakeWH(1000.0f, 1000.0f), "Src100_
Dst1000_Rects15");) | 75 SkRect::MakeWH(1000.0f, 1000.0f), "Src100_
Dst1000_Rects15");) |
| OLD | NEW |