diff options
author | mtklein <mtklein@chromium.org> | 2015-11-03 09:45:03 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-03 09:45:03 -0800 |
commit | 444d91fec1b51b53a77e79a47a63a944f64b32f8 (patch) | |
tree | 16a57d398a83ca0c2de69d895497dc1022a7368f /src | |
parent | 98cad6219b430eddf5528473311279f21dbd2e10 (diff) |
SkRemote: saveLayer
https://gold.skia.org/search2?issue=1432593002&unt=true&query=source_type%3Dgm&master=false&include=true
BUG=skia:
Review URL: https://codereview.chromium.org/1432593002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkRemote.cpp | 19 | ||||
-rw-r--r-- | src/core/SkRemote.h | 11 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/core/SkRemote.cpp b/src/core/SkRemote.cpp index dd0b25d62c..236a1a8c24 100644 --- a/src/core/SkRemote.cpp +++ b/src/core/SkRemote.cpp @@ -165,7 +165,15 @@ namespace SkRemote { SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) override { - // TODO + SkPath path; + if (bounds) { + path.addRect(*bounds); + } + const SkPaint defaultPaint; + if (!paint) { + paint = &defaultPaint; + } + fEncoder->saveLayer(this->id(path), this->commonIDs(*paint), flags); return kNoLayer_SaveLayerStrategy; } @@ -473,6 +481,12 @@ namespace SkRemote { void save() override { fCanvas->save(); } void restore() override { fCanvas->restore(); } + void saveLayer(ID bounds, CommonIDs common, SkCanvas::SaveFlags flags) override { + SkPaint paint; + this->applyCommon(common, &paint); + SkRect rect; + fCanvas->saveLayer(fPath.find(bounds).isRect(&rect) ? &rect : nullptr, &paint, flags); + } void setMatrix(ID matrix) override { fCanvas->setMatrix(fMatrix.find(matrix)); } @@ -636,6 +650,9 @@ namespace SkRemote { void save() override { fWrapped-> save(); } void restore() override { fWrapped->restore(); } + void saveLayer(ID bounds, CommonIDs common, SkCanvas::SaveFlags flags) override { + fWrapped->saveLayer(bounds, common, flags); + } void setMatrix(ID matrix) override { fWrapped->setMatrix(matrix); } diff --git a/src/core/SkRemote.h b/src/core/SkRemote.h index 5fb20242fe..b33309449c 100644 --- a/src/core/SkRemote.h +++ b/src/core/SkRemote.h @@ -81,17 +81,18 @@ namespace SkRemote { virtual void undefine(ID) = 0; - virtual void save() = 0; - virtual void restore() = 0; - - virtual void setMatrix(ID matrix) = 0; - // TODO: do these all belong here in CommonIDs? struct CommonIDs { ID misc, patheffect, shader, xfermode, maskfilter, colorfilter, rasterizer, looper, imagefilter, annotation; }; + virtual void save() = 0; + virtual void restore() = 0; + virtual void saveLayer(ID bounds, CommonIDs, SkCanvas::SaveFlags) = 0; + + virtual void setMatrix(ID matrix) = 0; + virtual void clipPath(ID path, SkRegion::Op, bool aa) = 0; virtual void fillPath(ID path, CommonIDs) = 0; virtual void strokePath(ID path, CommonIDs, ID stroke) = 0; |