[skotty] Initial solid layer support
TBR= Change-Id: Ib78ff693a1c79873248563502635aed93a90f963 Reviewed-on: https://skia-review.googlesource.com/92624 Commit-Queue: Florin Malita <fmalita@chromium.org> Reviewed-by: Florin Malita <fmalita@chromium.org>
This commit is contained in:
parent
7195faccb9
commit
0e66fbab10
@ -16,6 +16,7 @@
|
||||
#include "SkMakeUnique.h"
|
||||
#include "SkOSPath.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkParse.h"
|
||||
#include "SkPath.h"
|
||||
#include "SkPoint.h"
|
||||
#include "SkSGColor.h"
|
||||
@ -598,11 +599,24 @@ sk_sp<sksg::RenderNode> AttachCompLayer(const Json::Value& layer, AttachContext*
|
||||
return AttachComposition(**comp, ctx);
|
||||
}
|
||||
|
||||
sk_sp<sksg::RenderNode> AttachSolidLayer(const Json::Value& layer, AttachContext*) {
|
||||
SkASSERT(layer.isObject());
|
||||
sk_sp<sksg::RenderNode> AttachSolidLayer(const Json::Value& jlayer, AttachContext*) {
|
||||
SkASSERT(jlayer.isObject());
|
||||
|
||||
LOG("?? Solid layer stub\n");
|
||||
return nullptr;
|
||||
const auto size = SkSize::Make(ParseScalar(jlayer["sw"], -1),
|
||||
ParseScalar(jlayer["sh"], -1));
|
||||
const auto hex = ParseString(jlayer["sc"], "");
|
||||
uint32_t c;
|
||||
if (size.isEmpty() ||
|
||||
!hex.startsWith("#") ||
|
||||
!SkParse::FindHex(hex.c_str() + 1, &c)) {
|
||||
LogFail(jlayer, "Could not parse solid layer");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const SkColor color = 0xff000000 | c;
|
||||
|
||||
return sksg::Draw::Make(sksg::Rect::Make(SkRect::MakeSize(size)),
|
||||
sksg::Color::Make(color));
|
||||
}
|
||||
|
||||
sk_sp<sksg::RenderNode> AttachImageAsset(const Json::Value& jimage, AttachContext* ctx) {
|
||||
|
Loading…
Reference in New Issue
Block a user