From 7cfcc1e86a54bb8ae03ffb0425ebd6765fff3c08 Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Wed, 8 Jan 2020 10:07:57 -0600 Subject: [PATCH] add Brian's fiddle as gm/bicubic Change-Id: I748ab57274c360261e957d43a08366e62350110b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263056 Commit-Queue: Mike Klein Reviewed-by: Brian Salomon --- gm/bicubic.cpp | 28 ++++++++++++++++++++++++++++ gn/gm.gni | 1 + 2 files changed, 29 insertions(+) create mode 100644 gm/bicubic.cpp diff --git a/gm/bicubic.cpp b/gm/bicubic.cpp new file mode 100644 index 0000000000..643146c4eb --- /dev/null +++ b/gm/bicubic.cpp @@ -0,0 +1,28 @@ +/* + * Copyright 2020 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/SkBitmap.h" +#include "include/core/SkCanvas.h" + +DEF_SIMPLE_GM(bicubic, canvas, 300, 64) { + canvas->clear(SK_ColorBLACK); + + SkBitmap bmp; + bmp.allocN32Pixels(8, 1); + bmp.eraseColor(0); + *bmp.getAddr32(3, 0) = 0xFFFFFFFF; + + SkPaint paint; + paint.setFilterQuality(kHigh_SkFilterQuality); + + for (int i = 0; i < 64; ++i) { + float x = 1.0f + i/63.0f; + float y = i; + canvas->drawBitmapRect(bmp, SkRect::MakeXYWH(x, y, 512, 1), &paint); + } +} diff --git a/gn/gm.gni b/gn/gm.gni index 927c190b7a..5c126ed80e 100644 --- a/gn/gm.gni +++ b/gn/gm.gni @@ -31,6 +31,7 @@ gm_sources = [ "$_gm/badpaint.cpp", "$_gm/beziereffects.cpp", "$_gm/beziers.cpp", + "$_gm/bicubic.cpp", "$_gm/bigblurs.cpp", "$_gm/bigmatrix.cpp", "$_gm/bigrect.cpp",