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

Side by Side Diff: gm/clipdrawdraw.cpp

Issue 839883003: Add repro GM for GPU clipped-AA vs. non-AA drawRect discrepancy (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix nuisance change Created 5 years, 11 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 | gyp/gmslides.gypi » ('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 2014 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 #include "gm.h"
9
10 namespace skiagm {
11
12 // This GM exercises the use case found in crbug.com/423834.
13 // The following pattern:
14 // clipRect(r);
15 // drawRect(r, withAA);
16 // drawRect(r, noAA);
17 // can leave 1 pixel wide remnants of the first rect.
18 class ClipDrawDrawGM : public GM {
19 public:
20 ClipDrawDrawGM() {
21 this->setBGColor(0xFFCCCCCC);
22 }
23
24 protected:
25 SkString onShortName() SK_OVERRIDE {
26 return SkString("clipdrawdraw");
27 }
28
29 SkISize onISize() SK_OVERRIDE {
30 return SkISize::Make(512, 512);
31 }
32
33 // Vertical remnant
34 static void draw1(SkCanvas* canvas) {
35 SkPaint p;
36 p.setAntiAlias(true);
37
38 const SkRect rect = SkRect::MakeXYWH(8, 9, 404, 313);
39
40 canvas->save();
41
42 canvas->scale(0.5f, 0.5f);
43 canvas->translate(265, 265);
44
45 canvas->save();
46 canvas->clipRect(rect);
47 canvas->drawRect(rect, p);
48 canvas->restore();
49
50 p.setColor(SK_ColorWHITE);
51 p.setAntiAlias(false);
52 canvas->drawRect(rect, p);
53 canvas->restore();
54 }
55
56 // Horizontal remnant
57 static void draw2(SkCanvas* canvas) {
58 SkPaint p;
59 p.setAntiAlias(true);
60
61 const SkRect rect = SkRect::MakeXYWH(8, 9, 404, 313);
62
63 canvas->save();
64
65 canvas->translate(200.800003f, 172.299988f);
66 canvas->scale(0.8f, 0.8f);
67
68 canvas->save();
69 canvas->clipRect(rect);
70 canvas->drawRect(rect, p);
71 canvas->restore();
72
73 p.setColor(SK_ColorWHITE);
74 p.setAntiAlias(false);
75 canvas->drawRect(rect, p);
76 canvas->restore();
77 }
78
79 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
80 draw1(canvas);
81 draw2(canvas);
82 }
83
84 private:
85 typedef GM INHERITED;
86 };
87
88 //////////////////////////////////////////////////////////////////////////////
89
90 DEF_GM(return SkNEW(ClipDrawDrawGM);)
91
92 }
OLDNEW
« no previous file with comments | « no previous file | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698