c0bd9f9fe5
Current strategy: everything from the top Things to look at first are the manual changes: - added tools/rewrite_includes.py - removed -Idirectives from BUILD.gn - various compile.sh simplifications - tweak tools/embed_resources.py - update gn/find_headers.py to write paths from the top - update gn/gn_to_bp.py SkUserConfig.h layout so that #include "include/config/SkUserConfig.h" always gets the header we want. No-Presubmit: true Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
/*
|
|
* Copyright 2015 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "gm/gm.h"
|
|
#include "include/core/SkPath.h"
|
|
|
|
DEF_SIMPLE_GM(PlusMergesAA, canvas, 256, 256) {
|
|
SkPaint p;
|
|
p.setColor(SK_ColorRED);
|
|
p.setAntiAlias(true); // <-- crucial to the test that we use AA
|
|
|
|
// Draw a two red squares.
|
|
canvas->drawRect(SkRect::MakeWH(100, 100), p);
|
|
canvas->drawRect(SkRect::MakeXYWH(150, 0, 100, 100), p);
|
|
|
|
p.setColor(0xf000ff00);
|
|
|
|
// We'll draw a green square on top of each using two triangles.
|
|
SkPath upperLeft;
|
|
upperLeft.lineTo(100, 0);
|
|
upperLeft.lineTo(0, 100);
|
|
upperLeft.lineTo(0, 0);
|
|
|
|
SkPath bottomRight;
|
|
bottomRight.moveTo(100, 0);
|
|
bottomRight.lineTo(100, 100);
|
|
bottomRight.lineTo(0, 100);
|
|
bottomRight.lineTo(100, 0);
|
|
|
|
// The left square is drawn simply with SrcOver. It will show a red seam.
|
|
canvas->drawPath(upperLeft, p);
|
|
canvas->drawPath(bottomRight, p);
|
|
|
|
// Using Plus on the right should merge the AA of seam together completely covering the red.
|
|
canvas->saveLayer(nullptr, nullptr);
|
|
p.setBlendMode(SkBlendMode::kPlus);
|
|
canvas->translate(150, 0);
|
|
canvas->drawPath(upperLeft, p);
|
|
canvas->drawPath(bottomRight, p);
|
|
canvas->restore();
|
|
}
|