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

Side by Side Diff: gm/drawregion.cpp

Issue 2282983003: Reduce CPU overhead on drawRegion() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update bench Created 4 years, 3 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 | src/gpu/batches/GrRegionBatch.cpp » ('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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 void onOnceBeforeDraw() override { 31 void onOnceBeforeDraw() override {
32 for (int x = 50; x < 250; x+=2) { 32 for (int x = 50; x < 250; x+=2) {
33 for (int y = 50; y < 250; y+=2) { 33 for (int y = 50; y < 250; y+=2) {
34 fRegion.op(x, y, x + 1, y + 1, SkRegion::kUnion_Op); 34 fRegion.op(x, y, x + 1, y + 1, SkRegion::kUnion_Op);
35 } 35 }
36 } 36 }
37 } 37 }
38 38
39 void onDraw(SkCanvas* canvas) override { 39 void onDraw(SkCanvas* canvas) override {
40 canvas->translate(10, 10);
msarett 2016/08/26 18:41:55 Applying the view matrix is a no-op when it's iden
41
40 SkPaint paint; 42 SkPaint paint;
41 paint.setStyle(SkPaint::kFill_Style); 43 paint.setStyle(SkPaint::kFill_Style);
42 paint.setColor(0xFFFF00FF); 44 paint.setColor(0xFFFF00FF);
43 canvas->drawRect(SkRect::MakeLTRB(50.0f, 50.0f, 250.0f, 250.0f), paint); 45 canvas->drawRect(SkRect::MakeLTRB(50.0f, 50.0f, 250.0f, 250.0f), paint);
44 46
45 paint.setColor(0xFF00FFFF); 47 paint.setColor(0xFF00FFFF);
46 canvas->drawRegion(fRegion, paint); 48 canvas->drawRegion(fRegion, paint);
47 } 49 }
48 50
49 SkRegion fRegion; 51 SkRegion fRegion;
50 52
51 private: 53 private:
52 typedef skiagm::GM INHERITED; 54 typedef skiagm::GM INHERITED;
53 }; 55 };
54 DEF_GM( return new DrawRegionGM; ) 56 DEF_GM( return new DrawRegionGM; )
OLDNEW
« no previous file with comments | « no previous file | src/gpu/batches/GrRegionBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698