halcanary | 5cd406f | 2015-09-23 12:46:24 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 | */ |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "gm/gm.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 9 | #include "include/core/SkBitmap.h" |
| 10 | #include "include/core/SkCanvas.h" |
| 11 | #include "include/core/SkMatrix.h" |
| 12 | #include "include/core/SkRect.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 13 | #include "tools/Resources.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 14 | |
halcanary | 6950de6 | 2015-11-07 05:29:00 -0800 | [diff] [blame] | 15 | // https://bug.skia.org/4374 |
halcanary | 5cd406f | 2015-09-23 12:46:24 -0700 | [diff] [blame] | 16 | DEF_SIMPLE_GM(draw_bitmap_rect_skbug4734, canvas, 64, 64) { |
| 17 | SkBitmap source; |
Hal Canary | c465d13 | 2017-12-08 10:21:31 -0500 | [diff] [blame] | 18 | if (GetResourceAsBitmap("images/randPixels.png", &source)) { |
halcanary | 5cd406f | 2015-09-23 12:46:24 -0700 | [diff] [blame] | 19 | SkRect rect = SkRect::Make(source.bounds()); |
| 20 | rect.inset(0.5, 1.5); |
| 21 | SkRect dst; |
| 22 | SkMatrix::MakeScale(8.0f).mapRect(&dst, rect); |
| 23 | canvas->drawBitmapRect(source, rect, dst, nullptr); |
| 24 | } |
| 25 | } |