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

Side by Side Diff: bench/DrawLatticeBench.cpp

Issue 2255963002: Batched implementation of drawLattice() for GPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Speculative reland Created 4 years, 4 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 | include/gpu/GrDrawContext.h » ('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 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"
(...skipping 11 matching lines...) Expand all
22 fLattice.fYDivs = yDivs; 22 fLattice.fYDivs = yDivs;
23 fLattice.fYCount = yCount; 23 fLattice.fYCount = yCount;
24 24
25 fName = SkStringPrintf("DrawLattice_%s", desc); 25 fName = SkStringPrintf("DrawLattice_%s", desc);
26 } 26 }
27 27
28 const char* onGetName() override { 28 const char* onGetName() override {
29 return fName.c_str(); 29 return fName.c_str();
30 } 30 }
31 31
32 SkIPoint onGetSize() override {
33 return SkIPoint::Make(1000, 1000);
34 }
35
32 bool isSuitableFor(Backend backend) override { 36 bool isSuitableFor(Backend backend) override {
33 return kRaster_Backend == backend || kGPU_Backend == backend; 37 return kRaster_Backend == backend || kGPU_Backend == backend;
34 } 38 }
35 39
36 void onDelayedSetup() override { 40 void onDelayedSetup() override {
37 fBitmap.allocN32Pixels(fSrcSize.width(), fSrcSize.height()); 41 fBitmap.allocN32Pixels(fSrcSize.width(), fSrcSize.height());
38 fBitmap.eraseColor(0x880000FF); 42 fBitmap.eraseColor(0x880000FF);
39 } 43 }
40 44
41 void onDraw(int loops, SkCanvas* canvas) override { 45 void onDraw(int loops, SkCanvas* canvas) override {
42 for (int i = 0; i < loops; i++) { 46 for (int i = 0; i < loops; i++) {
43 canvas->drawBitmapLattice(fBitmap, fLattice, fDst); 47 canvas->drawBitmapLattice(fBitmap, fLattice, fDst);
44 } 48 }
45 } 49 }
46 50
47 private: 51 private:
48 SkISize fSrcSize; 52 SkISize fSrcSize;
49 SkCanvas::Lattice fLattice; 53 SkCanvas::Lattice fLattice;
50 SkRect fDst; 54 SkRect fDst;
51 SkString fName; 55 SkString fName;
52 SkBitmap fBitmap; 56 SkBitmap fBitmap;
53 57
54 typedef Benchmark INHERITED; 58 typedef Benchmark INHERITED;
55 }; 59 };
56 60
57 static int gDivs[2] = { 250, 750, }; 61 static int gDivs9[2] = { 25, 75, };
58 DEF_BENCH(return new DrawLatticeBench(gDivs, 2, gDivs, 2, SkISize::Make(1000, 10 00), 62 DEF_BENCH(return new DrawLatticeBench(gDivs9, 2, gDivs9, 2, SkISize::Make(100, 1 00),
59 SkRect::MakeWH(4000.0f, 4000.0f), "Standar dNine");) 63 SkRect::MakeWH(250.0f, 250.0f), "Src100_Ds t250_Rects9");)
64 DEF_BENCH(return new DrawLatticeBench(gDivs9, 2, gDivs9, 2, SkISize::Make(100, 1 00),
65 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 SkRect::MakeWH(1000.0f, 1000.0f), "Src100_ Dst1000_Rects9");)
68 static int gDivs15[4] = { 15, 45, 55, 85, };
69 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 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 DEF_BENCH(return new DrawLatticeBench(gDivs15, 4, gDivs15, 4, SkISize::Make(100, 100),
74 SkRect::MakeWH(1000.0f, 1000.0f), "Src100_ Dst1000_Rects15");)
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrDrawContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698