Flutter Engine
The Flutter Engine
draw_bitmap_rect_skbug4374.cpp
Go to the documentation of this file.
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"
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// https://bug.skia.org/4374
19DEF_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;
27 canvas->drawImageRect(img, rect, dst, SkSamplingOptions(), nullptr,
29 }
30}
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
Definition: SkCanvas.h:1542
static SkMatrix Scale(SkScalar sx, SkScalar sy)
Definition: SkMatrix.h:75
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
Definition: SkMatrix.cpp:1141
DEF_SIMPLE_GM(draw_bitmap_rect_skbug4734, canvas, 64, 64)
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
sk_sp< SkImage > MakeTextureImage(SkCanvas *canvas, sk_sp< SkImage > orig)
sk_sp< SkImage > GetResourceAsImage(const char *resource)
Definition: DecodeUtils.h:25
dst
Definition: cp.py:12
SkSamplingOptions(SkFilterMode::kLinear))
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669