Mike Klein | 7cfcc1e | 2020-01-08 10:07:57 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 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 | |
| 8 | #include "gm/gm.h" |
| 9 | #include "include/core/SkBitmap.h" |
| 10 | #include "include/core/SkCanvas.h" |
| 11 | |
| 12 | DEF_SIMPLE_GM(bicubic, canvas, 300, 64) { |
| 13 | canvas->clear(SK_ColorBLACK); |
| 14 | |
| 15 | SkBitmap bmp; |
| 16 | bmp.allocN32Pixels(8, 1); |
| 17 | bmp.eraseColor(0); |
| 18 | *bmp.getAddr32(3, 0) = 0xFFFFFFFF; |
| 19 | |
| 20 | SkPaint paint; |
| 21 | paint.setFilterQuality(kHigh_SkFilterQuality); |
| 22 | |
| 23 | for (int i = 0; i < 64; ++i) { |
| 24 | float x = 1.0f + i/63.0f; |
| 25 | float y = i; |
| 26 | canvas->drawBitmapRect(bmp, SkRect::MakeXYWH(x, y, 512, 1), &paint); |
| 27 | } |
| 28 | } |