Flutter Engine
The Flutter Engine
SkCanvas_Raster.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
12#include "src/core/SkDevice.h"
14#include "src/text/GlyphRun.h" // IWYU pragma: keep
15
16#include <memory>
17#include <utility>
18
19class SkBitmap;
20class SkSurfaceProps;
21
22#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
26
27#endif
28
30 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)), fProps(props) {
31 this->init(sk_make_sp<SkBitmapDevice>(bitmap, fProps));
32}
33
35 std::unique_ptr<SkRasterHandleAllocator> alloc,
37 const SkSurfaceProps* props)
38 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage))
39 , fProps(SkSurfacePropsCopyOrDefault(props))
40 , fAllocator(std::move(alloc)) {
41 this->init(sk_make_sp<SkBitmapDevice>(bitmap, fProps, hndl));
42}
43
44SkCanvas::SkCanvas(const SkBitmap& bitmap) : SkCanvas(bitmap, nullptr, nullptr, nullptr) {}
45
46#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
47SkCanvas::SkCanvas(const SkBitmap& bitmap, ColorBehavior)
48 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
49 SkBitmap tmp(bitmap);
50 *const_cast<SkImageInfo*>(&tmp.info()) = tmp.info().makeColorSpace(nullptr);
51 this->init(sk_make_sp<SkBitmapDevice>(tmp, fProps));
52}
53#endif
54
static SkSurfaceProps SkSurfacePropsCopyOrDefault(const SkSurfaceProps *props)
Definition: SkSurfacePriv.h:15
static bool init()
Definition: bitmap.py:1
Definition: ref_ptr.h:256
SkImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const