2015-09-23 19:46:24 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2019-05-01 21:28:53 +00:00
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "gm/gm.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkBitmap.h"
|
|
|
|
#include "include/core/SkCanvas.h"
|
|
|
|
#include "include/core/SkMatrix.h"
|
|
|
|
#include "include/core/SkRect.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "tools/Resources.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
|
2015-11-07 13:29:00 +00:00
|
|
|
// https://bug.skia.org/4374
|
2015-09-23 19:46:24 +00:00
|
|
|
DEF_SIMPLE_GM(draw_bitmap_rect_skbug4734, canvas, 64, 64) {
|
2021-01-24 03:07:05 +00:00
|
|
|
if (auto img = GetResourceAsImage("images/randPixels.png")) {
|
|
|
|
SkRect rect = SkRect::Make(img->bounds());
|
2015-09-23 19:46:24 +00:00
|
|
|
rect.inset(0.5, 1.5);
|
|
|
|
SkRect dst;
|
2020-05-21 16:11:27 +00:00
|
|
|
SkMatrix::Scale(8, 8).mapRect(&dst, rect);
|
2021-01-24 03:07:05 +00:00
|
|
|
canvas->drawImageRect(img, rect, dst, SkSamplingOptions(), nullptr,
|
|
|
|
SkCanvas::kStrict_SrcRectConstraint);
|
2015-09-23 19:46:24 +00:00
|
|
|
}
|
|
|
|
}
|