f815301b1a
Release and debug builds draw differently on my machine, and if I tack #pragma clang optimize off onto cull_rect() in SkDashPath.cpp, they both draw like a debug build. I'm not very familiar with this code, so it may help my diagnosis to see what other bots draw. Bug: skia:9331 Change-Id: I1798503c0e5956ec767d8e0021ccca7a1d2a8ac3 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/233999 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
/*
|
|
* Copyright 2019 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/SkCanvas.h"
|
|
#include "include/effects/SkDashPathEffect.h"
|
|
|
|
// Reproduces skbug.com/9331, drawing differently in debug and release builds.
|
|
DEF_SIMPLE_GM(bug9331, canvas, 256, 256) {
|
|
SkRect clip = {0, 0, 200, 150};
|
|
{
|
|
SkPaint paint;
|
|
paint.setColor(0x44FF0000);
|
|
canvas->drawRect(clip, paint);
|
|
}
|
|
|
|
auto draw = [&](SkColor color, SkRect clip) {
|
|
SkScalar intervals[] = { 13, 17 };
|
|
SkScalar phase = 9;
|
|
|
|
SkPaint paint;
|
|
paint.setColor(color);
|
|
paint.setStyle(SkPaint::kStroke_Style);
|
|
paint.setStrokeWidth(10);
|
|
paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), phase));
|
|
|
|
canvas->save();
|
|
canvas->clipRect(clip);
|
|
canvas->drawRect({50,50, 150,150}, paint);
|
|
canvas->restore();
|
|
};
|
|
|
|
draw(0xFF000000, clip);
|
|
draw(0xFF0000FF, clip.makeOffset(0,150));
|
|
}
|