Flutter Engine
The Flutter Engine
Functions
SkDocument.cpp File Reference
#include "include/core/SkDocument.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkRect.h"
#include "include/private/base/SkAssert.h"

Go to the source code of this file.

Functions

static SkCanvastrim (SkCanvas *canvas, SkScalar width, SkScalar height, const SkRect *content)
 

Function Documentation

◆ trim()

static SkCanvas * trim ( SkCanvas canvas,
SkScalar  width,
SkScalar  height,
const SkRect content 
)
static

Definition at line 19 of file SkDocument.cpp.

20 {
21 if (content && canvas) {
22 SkRect inner = *content;
23 if (!inner.intersect({0, 0, width, height})) {
24 return nullptr;
25 }
26 canvas->clipRect(inner);
27 canvas->translate(inner.x(), inner.y());
28 }
29 return canvas;
30}
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
union flutter::testing::@2836::KeyboardChange::@76 content
bool intersect(const SkRect &r)
Definition: SkRect.cpp:114
constexpr float x() const
Definition: SkRect.h:720
constexpr float y() const
Definition: SkRect.h:727