Brian Salomon | 09181ef | 2018-11-14 13:39:51 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "gm/gm.h" |
| 9 | #include "include/core/SkCanvas.h" |
| 10 | #include "include/core/SkPaint.h" |
Brian Salomon | 09181ef | 2018-11-14 13:39:51 -0500 | [diff] [blame] | 11 | |
| 12 | // The root cause of this bug was that when dual source blending was not supported and we made a |
| 13 | // copy of the destination to perform blending we would clip the copy bounds to the current clip. |
| 14 | // However, it is possible for anti-aliased that are fully contained by the clip in a geometric |
| 15 | // sense to actually draw outside the clip in pixel space because we don't consider aa bloat when |
| 16 | // determining if the draw is contained by the clip. |
| 17 | DEF_SIMPLE_GM(crbug_892988, canvas, 256, 256) { |
| 18 | SkPaint paint1; |
| 19 | paint1.setStyle(SkPaint::kStroke_Style); |
| 20 | paint1.setStrokeWidth(1.f); |
| 21 | paint1.setAntiAlias(true); |
| 22 | canvas->drawRect(SkRect::MakeLTRB(11.5, 0.5, 245.5, 245.5), paint1); |
| 23 | canvas->clipRect(SkRect::MakeLTRB(12, 1, 244, 244), true); |
| 24 | SkPaint paint2; |
| 25 | // Use src mode with a non-opaque color to produce a blend that can't be handled with |
| 26 | // simple blend coefficients. |
| 27 | paint2.setColor(0xF0FFFFFF); |
| 28 | paint2.setBlendMode(SkBlendMode::kSrc); |
| 29 | paint2.setAntiAlias(true); |
| 30 | canvas->drawRect(SkRect::MakeLTRB(12, 1, 244, 244), paint2); |
| 31 | } |