• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "tools/ToolUtils.h"
15 
16 // https://bug.skia.org/4374
17 DEF_SIMPLE_GM(draw_bitmap_rect_skbug4734, canvas, 64, 64) {
18     auto img = ToolUtils::MakeTextureImage(canvas, GetResourceAsImage("images/randPixels.png"));
19     if (img) {
20         SkRect rect = SkRect::Make(img->bounds());
21         rect.inset(0.5, 1.5);
22         SkRect dst;
23         SkMatrix::Scale(8, 8).mapRect(&dst, rect);
24         canvas->drawImageRect(img, rect, dst, SkSamplingOptions(), nullptr,
25                               SkCanvas::kStrict_SrcRectConstraint);
26     }
27 }
28