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

Side by Side Diff: tools/VisualBench/VisualSKPBench.cpp

Issue 2018603003: Remove VisualBench and its Android implementation. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « tools/VisualBench/VisualSKPBench.h ('k') | tools/VisualBench/VisualStreamTimingModule.h » ('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 2015 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
9 #include "VisualSKPBench.h"
10
11 #if SK_SUPPORT_GPU
12 #include "GrContext.h"
13 #endif
14
15 VisualSKPBench::VisualSKPBench(const char* name, const SkPicture* pic)
16 : fPic(SkRef(pic))
17 , fCullRect(fPic->cullRect().roundOut())
18 , fName(name) {
19 fUniqueName.printf("%s", name);
20 }
21
22 const char* VisualSKPBench::onGetName() {
23 return fName.c_str();
24 }
25
26 const char* VisualSKPBench::onGetUniqueName() {
27 return fUniqueName.c_str();
28 }
29
30 bool VisualSKPBench::isSuitableFor(Backend backend) {
31 return backend != kNonRendering_Backend;
32 }
33
34 SkIPoint VisualSKPBench::onGetSize() {
35 return SkIPoint::Make(fCullRect.width(), fCullRect.height());
36 }
37
38 void VisualSKPBench::onDraw(int loops, SkCanvas* canvas) {
39 bool isOffset = SkToBool(fCullRect.left() | fCullRect.top());
40 if (isOffset) {
41 canvas->save();
42 canvas->translate(SkIntToScalar(-fCullRect.left()), SkIntToScalar(-fCull Rect.top()));
43 }
44
45 for (int i = 0; i < loops; i++) {
46 canvas->drawPicture(fPic);
47 #if SK_SUPPORT_GPU
48 // Ensure the GrContext doesn't batch across draw loops.
49 if (GrContext* context = canvas->getGrContext()) {
50 context->flush();
51 }
52 #endif
53 }
54
55 if (isOffset) {
56 canvas->restore();
57 }
58 }
OLDNEW
« no previous file with comments | « tools/VisualBench/VisualSKPBench.h ('k') | tools/VisualBench/VisualStreamTimingModule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698