xform saveLayer() backdrop
Just noticed this TODO is easy now. This doesn't seem to change any GMs, and definitely isn't used by Chrome or Android... this is just for completeness. It's also definitely correct to unfurl pictures. Change-Id: Ida6e43788d1de7a9452dad47aea8a5fbe41a1f46 Reviewed-on: https://skia-review.googlesource.com/14276 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Matt Sarett <msarett@google.com>
This commit is contained in:
parent
63e843d891
commit
e908b94d2f
@ -9,8 +9,9 @@
|
||||
#include "SkColorSpaceXformCanvas.h"
|
||||
#include "SkColorSpaceXformer.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "SkImage_Base.h"
|
||||
#include "SkImageFilter.h"
|
||||
#include "SkImagePriv.h"
|
||||
#include "SkImage_Base.h"
|
||||
#include "SkMakeUnique.h"
|
||||
#include "SkNoDrawCanvas.h"
|
||||
#include "SkSurface.h"
|
||||
@ -208,7 +209,6 @@ public:
|
||||
fXformer->apply(paint));
|
||||
}
|
||||
|
||||
// TODO: May not be ideal to unfurl pictures.
|
||||
void onDrawPicture(const SkPicture* pic,
|
||||
const SkMatrix* matrix,
|
||||
const SkPaint* paint) override {
|
||||
@ -219,10 +219,11 @@ public:
|
||||
}
|
||||
|
||||
SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override {
|
||||
sk_sp<SkImageFilter> backdrop = rec.fBackdrop ? fXformer->apply(rec.fBackdrop) : nullptr;
|
||||
fTarget->saveLayer({
|
||||
rec.fBounds,
|
||||
fXformer->apply(rec.fPaint),
|
||||
rec.fBackdrop, // TODO: this is an image filter
|
||||
backdrop.get(),
|
||||
rec.fSaveLayerFlags,
|
||||
});
|
||||
return kNoLayer_SaveLayerStrategy;
|
||||
|
@ -63,6 +63,10 @@ sk_sp<SkColorFilter> SkColorSpaceXformer::apply(const SkColorFilter* colorFilter
|
||||
return sk_ref_sp(const_cast<SkColorFilter*>(colorFilter));
|
||||
}
|
||||
|
||||
sk_sp<SkImageFilter> SkColorSpaceXformer::apply(const SkImageFilter* imageFilter) {
|
||||
return imageFilter->makeColorSpace(this);
|
||||
}
|
||||
|
||||
void SkColorSpaceXformer::apply(SkColor* xformed, const SkColor* srgb, int n) {
|
||||
SkAssertResult(fFromSRGB->apply(SkColorSpaceXform::kBGRA_8888_ColorFormat, xformed,
|
||||
SkColorSpaceXform::kBGRA_8888_ColorFormat, srgb,
|
||||
@ -112,7 +116,7 @@ const SkPaint& SkColorSpaceXformer::apply(const SkPaint& src) {
|
||||
}
|
||||
|
||||
if (auto imageFilter = src.getImageFilter()) {
|
||||
auto replacement = imageFilter->makeColorSpace(this);
|
||||
auto replacement = this->apply(imageFilter);
|
||||
if (replacement.get() != imageFilter) {
|
||||
get_dst()->setImageFilter(std::move(replacement));
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public:
|
||||
sk_sp<SkImage> apply(const SkImage* src);
|
||||
sk_sp<SkImage> apply(const SkBitmap& bitmap);
|
||||
sk_sp<SkColorFilter> apply(const SkColorFilter* filter);
|
||||
sk_sp<SkImageFilter> apply(const SkImageFilter* filter);
|
||||
const SkPaint* apply(const SkPaint* src);
|
||||
const SkPaint& apply(const SkPaint& src);
|
||||
void apply(SkColor dst[], const SkColor src[], int n);
|
||||
|
Loading…
Reference in New Issue
Block a user