Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkSVGImage.cpp File Reference
#include "include/core/SkCanvas.h"
#include "include/core/SkImage.h"
#include "modules/svg/include/SkSVGAttributeParser.h"
#include "modules/svg/include/SkSVGImage.h"
#include "modules/svg/include/SkSVGRenderContext.h"
#include "modules/svg/include/SkSVGValue.h"
#include "src/utils/SkOSPath.h"

Go to the source code of this file.

Functions

static sk_sp< SkImageLoadImage (const sk_sp< skresources::ResourceProvider > &rp, const SkSVGIRI &href)
 

Function Documentation

◆ LoadImage()

static sk_sp< SkImage > LoadImage ( const sk_sp< skresources::ResourceProvider > &  rp,
const SkSVGIRI href 
)
static

Definition at line 34 of file SkSVGImage.cpp.

35 {
36 // TODO: It may be better to use the SVG 'id' attribute as the asset id, to allow
37 // clients to perform asset substitution based on element id.
39 switch (href.type()) {
41 imageAsset = rp->loadImageAsset("", href.iri().c_str(), "");
42 break;
44 const auto path = SkOSPath::Dirname(href.iri().c_str());
45 const auto name = SkOSPath::Basename(href.iri().c_str());
46 imageAsset = rp->loadImageAsset(path.c_str(), name.c_str(), /* id */ name.c_str());
47 break;
48 }
49 default:
50 SkDebugf("error loading image: unhandled iri type %d\n", (int)href.type());
51 return nullptr;
52 }
53
54 return imageAsset ? imageAsset->getFrameData(0).image : nullptr;
55}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static SkString Basename(const char *fullPath)
Definition SkOSPath.cpp:23
static SkString Dirname(const char *fullPath)
Definition SkOSPath.cpp:36
const SkSVGStringType & iri() const
Definition SkSVGTypes.h:164
Type type() const
Definition SkSVGTypes.h:163
const char * c_str() const
Definition SkString.h:133
virtual sk_sp< ImageAsset > loadImageAsset(const char[], const char[], const char[]) const
const char * name
Definition fuchsia.cc:50
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57