Flutter Engine
The Flutter Engine
SkSurface_Null.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
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
16
17class SkCanvas;
18class SkPaint;
19class SkPixmap;
20struct SkIRect;
22
24public:
26
27 // From SkSurface_Base.h
29
30protected:
31 SkCanvas* onNewCanvas() override {
32 return new SkNoDrawCanvas(this->width(), this->height());
33 }
35 return SkSurfaces::Null(info.width(), info.height());
36 }
37 sk_sp<SkImage> onNewImageSnapshot(const SkIRect* subsetOrNull) override { return nullptr; }
38 void onWritePixels(const SkPixmap&, int x, int y) override {}
39 void onDraw(SkCanvas*, SkScalar, SkScalar, const SkSamplingOptions&, const SkPaint*) override {}
40 bool onCopyOnWrite(ContentChangeMode) override { return true; }
42 // Not really, but we have to return *something*
44 }
45 SkImageInfo imageInfo() const override {
46 return SkImageInfo::MakeUnknown(this->width(), this->height());
47 }
48};
49
50namespace SkSurfaces {
51
53 if (width < 1 || height < 1) {
54 return nullptr;
55 }
57}
58
59}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static sk_sp< const SkCapabilities > RasterBackend()
bool onCopyOnWrite(ContentChangeMode) override
void onDraw(SkCanvas *, SkScalar, SkScalar, const SkSamplingOptions &, const SkPaint *) override
void onWritePixels(const SkPixmap &, int x, int y) override
sk_sp< SkSurface > onNewSurface(const SkImageInfo &info) override
sk_sp< SkImage > onNewImageSnapshot(const SkIRect *subsetOrNull) override
SkSurface_Base::Type type() const override
SkCanvas * onNewCanvas() override
sk_sp< const SkCapabilities > onCapabilities() override
SkNullSurface(int width, int height)
SkImageInfo imageInfo() const override
ContentChangeMode
Definition: SkSurface.h:203
int width() const
Definition: SkSurface.h:178
int height() const
Definition: SkSurface.h:184
float SkScalar
Definition: extension.cpp:12
double y
double x
SK_API sk_sp< SkSurface > Null(int width, int height)
int32_t height
int32_t width
Definition: SkRect.h:32
static SkImageInfo MakeUnknown()
Definition: SkImageInfo.h:357