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 */
7
8 #include "gm/gm.h"
9 #include "include/core/SkBitmap.h"
10 #include "include/core/SkCanvas.h"
11 #include "include/core/SkMatrix.h"
12 #include "include/core/SkRect.h"
13 #include "tools/Resources.h"
14
15 // https://bug.skia.org/4374
DEF_SIMPLE_GM(draw_bitmap_rect_skbug4734, canvas, 64, 64)16 DEF_SIMPLE_GM(draw_bitmap_rect_skbug4734, canvas, 64, 64) {
17 if (auto img = GetResourceAsImage("images/randPixels.png")) {
18 SkRect rect = SkRect::Make(img->bounds());
19 rect.inset(0.5, 1.5);
20 SkRect dst;
21 SkMatrix::Scale(8, 8).mapRect(&dst, rect);
22 canvas->drawImageRect(img, rect, dst, SkSamplingOptions(), nullptr,
23 SkCanvas::kStrict_SrcRectConstraint);
24 }
25 }
26