| 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/DecodeUtils.h" |
| 14 |
#include "tools/GpuToolUtils.h" |
| 15 |
#include "tools/Resources.h" |
| 16 |
#include "tools/ToolUtils.h" |
| 17 |
|
| 18 |
// skbug.com/40035524 |
| 19 |
DEF_SIMPLE_GM(draw_bitmap_rect_skbug4734, canvas, 64, 64) { |
| 20 |
auto img = ToolUtils::MakeTextureImage(canvas, |
| 21 |
ToolUtils::GetResourceAsImage("images/randPixels.png")); |
| 22 |
if (img) { |
| 23 |
SkRect rect = SkRect::Make(img->bounds()); |
| 24 |
rect.inset(0.5, 1.5); |
| 25 |
SkRect dst; |
| 26 |
SkMatrix::Scale(8, 8).mapRect(&dst, rect); |
| 27 |
canvas->drawImageRect(img, rect, dst, SkSamplingOptions(), nullptr, |
| 28 |
SkCanvas::kStrict_SrcRectConstraint); |
| 29 |
} |
| 30 |
} |