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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/gmslides.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/clipdrawdraw.cpp
diff --git a/gm/clipdrawdraw.cpp b/gm/clipdrawdraw.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7d5cd9591ed2e097422d4f82d6dfdba85cde4e15
--- /dev/null
+++ b/gm/clipdrawdraw.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "gm.h"
+
+namespace skiagm {
+
+// This GM exercises the use case found in crbug.com/423834.
+// The following pattern:
+// clipRect(r);
+// drawRect(r, withAA);
+// drawRect(r, noAA);
+// can leave 1 pixel wide remnants of the first rect.
+class ClipDrawDrawGM : public GM {
+public:
+ ClipDrawDrawGM() {
+ this->setBGColor(0xFFCCCCCC);
+ }
+
+protected:
+ SkString onShortName() SK_OVERRIDE {
+ return SkString("clipdrawdraw");
+ }
+
+ SkISize onISize() SK_OVERRIDE {
+ return SkISize::Make(512, 512);
+ }
+
+ // Vertical remnant
+ static void draw1(SkCanvas* canvas) {
+ SkPaint p;
+ p.setAntiAlias(true);
+
+ const SkRect rect = SkRect::MakeXYWH(8, 9, 404, 313);
+
+ canvas->save();
+
+ canvas->scale(0.5f, 0.5f);
+ canvas->translate(265, 265);
+
+ canvas->save();
+ canvas->clipRect(rect);
+ canvas->drawRect(rect, p);
+ canvas->restore();
+
+ p.setColor(SK_ColorWHITE);
+ p.setAntiAlias(false);
+ canvas->drawRect(rect, p);
+ canvas->restore();
+ }
+
+ // Horizontal remnant
+ static void draw2(SkCanvas* canvas) {
+ SkPaint p;
+ p.setAntiAlias(true);
+
+ const SkRect rect = SkRect::MakeXYWH(8, 9, 404, 313);
+
+ canvas->save();
+
+ canvas->translate(200.800003f, 172.299988f);
+ canvas->scale(0.8f, 0.8f);
+
+ canvas->save();
+ canvas->clipRect(rect);
+ canvas->drawRect(rect, p);
+ canvas->restore();
+
+ p.setColor(SK_ColorWHITE);
+ p.setAntiAlias(false);
+ canvas->drawRect(rect, p);
+ canvas->restore();
+ }
+
+ void onDraw(SkCanvas* canvas) SK_OVERRIDE {
+ draw1(canvas);
+ draw2(canvas);
+ }
+
+private:
+ typedef GM INHERITED;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+DEF_GM(return SkNEW(ClipDrawDrawGM);)
+
+}
« 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