xref: /third_party/skia/gm/draw_bitmap_rect_skbug4374.cpp
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/skia/gm/
1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2015 Google Inc.
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci#include "gm/gm.h"
9cb93a386Sopenharmony_ci#include "include/core/SkBitmap.h"
10cb93a386Sopenharmony_ci#include "include/core/SkCanvas.h"
11cb93a386Sopenharmony_ci#include "include/core/SkMatrix.h"
12cb93a386Sopenharmony_ci#include "include/core/SkRect.h"
13cb93a386Sopenharmony_ci#include "tools/Resources.h"
14cb93a386Sopenharmony_ci
15cb93a386Sopenharmony_ci// https://bug.skia.org/4374
16cb93a386Sopenharmony_ciDEF_SIMPLE_GM(draw_bitmap_rect_skbug4734, canvas, 64, 64) {
17cb93a386Sopenharmony_ci    if (auto img = GetResourceAsImage("images/randPixels.png")) {
18cb93a386Sopenharmony_ci        SkRect rect = SkRect::Make(img->bounds());
19cb93a386Sopenharmony_ci        rect.inset(0.5, 1.5);
20cb93a386Sopenharmony_ci        SkRect dst;
21cb93a386Sopenharmony_ci        SkMatrix::Scale(8, 8).mapRect(&dst, rect);
22cb93a386Sopenharmony_ci        canvas->drawImageRect(img, rect, dst, SkSamplingOptions(), nullptr,
23cb93a386Sopenharmony_ci                              SkCanvas::kStrict_SrcRectConstraint);
24cb93a386Sopenharmony_ci    }
25cb93a386Sopenharmony_ci}
26

Indexes created Thu Nov 07 10:32:03 CST 2024