Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
draw_bitmap_rect_skbug4374.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkRect.h"
#include "tools/DecodeUtils.h"
#include "tools/GpuToolUtils.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"

Go to the source code of this file.

Functions

 DEF_SIMPLE_GM (draw_bitmap_rect_skbug4734, canvas, 64, 64)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( draw_bitmap_rect_skbug4734  ,
canvas  ,
64  ,
64   
)

Definition at line 19 of file draw_bitmap_rect_skbug4374.cpp.

19 {
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,
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
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
static SkRect Make(const SkISize &size)
Definition SkRect.h:669