Remove SkDrawFilter.
Change-Id: I0204a9522e828c87bb7c6c20ae34ce51161442af Reviewed-on: https://skia-review.googlesource.com/137895 Reviewed-by: Herb Derby <herb@google.com> Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
0859252397
commit
2c312c4f58
@ -6321,14 +6321,6 @@ Document_PDF, use annotations.
|
||||
|
||||
##
|
||||
|
||||
#Method SkDrawFilter* getDrawFilter() const
|
||||
#Deprecated soon
|
||||
##
|
||||
|
||||
#Method virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter)
|
||||
#Deprecated soon
|
||||
##
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
#Method virtual bool isClipEmpty() const
|
||||
|
@ -285,11 +285,6 @@ FT_Load_Glyph
|
||||
##
|
||||
##
|
||||
|
||||
#Topic Draw_Filter
|
||||
#Class SkDrawFilter
|
||||
##
|
||||
##
|
||||
|
||||
#Topic Draw_Layer
|
||||
##
|
||||
|
||||
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "gm.h"
|
||||
#include "SkBlurMask.h"
|
||||
#include "SkCanvas.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkMaskFilter.h"
|
||||
#include "SkPaint.h"
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
|
||||
/**
|
||||
* Initial test coverage for SkDrawFilter.
|
||||
* Draws two rectangles; if draw filters are broken, they will match.
|
||||
* If draw filters are working correctly, the first will be blue and blurred,
|
||||
* the second red and sharp.
|
||||
*/
|
||||
|
||||
namespace {
|
||||
class TestFilter : public SkDrawFilter {
|
||||
public:
|
||||
bool filter(SkPaint* p, Type) override {
|
||||
p->setColor(SK_ColorRED);
|
||||
p->setMaskFilter(nullptr);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class DrawFilterGM : public skiagm::GM {
|
||||
sk_sp<SkMaskFilter> fBlur;
|
||||
|
||||
protected:
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(320, 240);
|
||||
}
|
||||
|
||||
SkString onShortName() override {
|
||||
return SkString("drawfilter");
|
||||
}
|
||||
|
||||
void onOnceBeforeDraw() override {
|
||||
fBlur = SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||
SkBlurMask::ConvertRadiusToSigma(10.0f));
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkPaint p;
|
||||
p.setColor(SK_ColorBLUE);
|
||||
p.setMaskFilter(fBlur);
|
||||
SkRect r = { 20, 20, 100, 100 };
|
||||
canvas->setDrawFilter(nullptr);
|
||||
canvas->drawRect(r, p);
|
||||
canvas->setDrawFilter(new TestFilter)->unref();
|
||||
canvas->translate(120.0f, 40.0f);
|
||||
canvas->drawRect(r, p);
|
||||
canvas->setDrawFilter(nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
DEF_GM( return new DrawFilterGM; )
|
||||
|
||||
#endif
|
@ -394,7 +394,6 @@ skia_core_sources = [
|
||||
"$_include/core/SkDeque.h",
|
||||
"$_include/core/SkDocument.h",
|
||||
"$_include/core/SkDrawable.h",
|
||||
"$_include/core/SkDrawFilter.h",
|
||||
"$_include/core/SkDrawLooper.h",
|
||||
"$_include/core/SkFlattenable.h",
|
||||
"$_include/core/SkFontArguments.h",
|
||||
|
@ -26,7 +26,6 @@ skia_effects_sources = [
|
||||
"$_src/effects/SkOverdrawColorFilter.cpp",
|
||||
"$_src/effects/SkPackBits.cpp",
|
||||
"$_src/effects/SkPackBits.h",
|
||||
"$_src/effects/SkPaintFlagsDrawFilter.cpp",
|
||||
"$_src/effects/SkShaderMaskFilter.cpp",
|
||||
"$_src/effects/SkTableColorFilter.cpp",
|
||||
"$_src/effects/SkTableMaskFilter.cpp",
|
||||
@ -67,7 +66,6 @@ skia_effects_sources = [
|
||||
"$_include/effects/SkLayerDrawLooper.h",
|
||||
"$_include/effects/SkLumaColorFilter.h",
|
||||
"$_include/effects/SkOverdrawColorFilter.h",
|
||||
"$_include/effects/SkPaintFlagsDrawFilter.h",
|
||||
"$_include/effects/SkPerlinNoiseShader.h",
|
||||
"$_include/effects/SkTableColorFilter.h",
|
||||
"$_include/effects/SkTableMaskFilter.h",
|
||||
|
@ -113,7 +113,6 @@ gm_sources = [
|
||||
"$_gm/drawatlas.cpp",
|
||||
"$_gm/drawatlascolor.cpp",
|
||||
"$_gm/drawbitmaprect.cpp",
|
||||
"$_gm/drawfilter.cpp",
|
||||
"$_gm/drawlooper.cpp",
|
||||
"$_gm/drawminibitmaprect.cpp",
|
||||
"$_gm/drawregion.cpp",
|
||||
|
@ -56,7 +56,6 @@ tests_sources = [
|
||||
"$_tests/DiscardableMemoryPoolTest.cpp",
|
||||
"$_tests/DiscardableMemoryTest.cpp",
|
||||
"$_tests/DrawBitmapRectTest.cpp",
|
||||
"$_tests/DrawFilterTest.cpp",
|
||||
"$_tests/DrawOpAtlasTest.cpp",
|
||||
"$_tests/DrawPathTest.cpp",
|
||||
"$_tests/DrawTextTest.cpp",
|
||||
|
@ -35,7 +35,6 @@ class SkClipStack;
|
||||
class SkData;
|
||||
class SkDraw;
|
||||
class SkDrawable;
|
||||
class SkDrawFilter;
|
||||
struct SkDrawShadowRec;
|
||||
class SkGlyphRunBuilder;
|
||||
class SkImage;
|
||||
@ -492,9 +491,9 @@ public:
|
||||
*/
|
||||
bool writePixels(const SkBitmap& bitmap, int x, int y);
|
||||
|
||||
/** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms).
|
||||
Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
|
||||
restoring the SkMatrix, clip, and SkDrawFilter to their state when save() was called.
|
||||
/** Saves SkMatrix and clip.
|
||||
Calling restore() discards changes to SkMatrix and clip, restoring the SkMatrix and clip to
|
||||
their state when save() was called.
|
||||
|
||||
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(), setMatrix(),
|
||||
and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), clipPath(), clipRegion().
|
||||
@ -508,10 +507,8 @@ public:
|
||||
*/
|
||||
int save();
|
||||
|
||||
/** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
|
||||
and allocates a SkBitmap for subsequent drawing.
|
||||
Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
|
||||
and draws the SkBitmap.
|
||||
/** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
|
||||
Calling restore() discards changes to SkMatrix and clip, and draws the SkBitmap.
|
||||
|
||||
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
|
||||
setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
|
||||
@ -531,10 +528,8 @@ public:
|
||||
*/
|
||||
int saveLayer(const SkRect* bounds, const SkPaint* paint);
|
||||
|
||||
/** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
|
||||
and allocates a SkBitmap for subsequent drawing.
|
||||
Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
|
||||
and draws the SkBitmap.
|
||||
/** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
|
||||
Calling restore() discards changes to SkMatrix and clip, and draws the SkBitmap.
|
||||
|
||||
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
|
||||
setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
|
||||
@ -556,12 +551,10 @@ public:
|
||||
return this->saveLayer(&bounds, paint);
|
||||
}
|
||||
|
||||
/** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
|
||||
and allocates a SkBitmap for subsequent drawing.
|
||||
/** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
|
||||
LCD text is preserved when the layer is drawn to the prior layer.
|
||||
|
||||
Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
|
||||
and draws layer.
|
||||
Calling restore() discards changes to SkMatrix and clip, and draws layer.
|
||||
|
||||
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
|
||||
setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
|
||||
@ -585,11 +578,10 @@ public:
|
||||
*/
|
||||
int saveLayerPreserveLCDTextRequests(const SkRect* bounds, const SkPaint* paint);
|
||||
|
||||
/** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
|
||||
and allocates SkBitmap for subsequent drawing.
|
||||
/** Saves SkMatrix and clip, and allocates SkBitmap for subsequent drawing.
|
||||
|
||||
Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
|
||||
and blends layer with alpha opacity onto prior layer.
|
||||
Calling restore() discards changes to SkMatrix and clip, and blends layer with alpha opacity
|
||||
onto prior layer.
|
||||
|
||||
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
|
||||
setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
|
||||
@ -716,10 +708,9 @@ public:
|
||||
SaveLayerFlags fSaveLayerFlags = 0;
|
||||
};
|
||||
|
||||
/** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
|
||||
and allocates SkBitmap for subsequent drawing.
|
||||
/** Saves SkMatrix and clip, and allocates SkBitmap for subsequent drawing.
|
||||
|
||||
Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
|
||||
Calling restore() discards changes to SkMatrix and clip,
|
||||
and blends SkBitmap with alpha opacity onto the prior layer.
|
||||
|
||||
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
|
||||
@ -735,14 +726,14 @@ public:
|
||||
*/
|
||||
int saveLayer(const SaveLayerRec& layerRec);
|
||||
|
||||
/** Removes changes to SkMatrix, clip, and SkDrawFilter since SkCanvas state was
|
||||
last saved. The state is removed from the stack.
|
||||
/** Removes changes to SkMatrix and clip since SkCanvas state was last saved.
|
||||
The state is removed from the stack.
|
||||
|
||||
Does nothing if the stack is empty.
|
||||
*/
|
||||
void restore();
|
||||
|
||||
/** Returns the number of saved states, each containing: SkMatrix, clip, and SkDrawFilter.
|
||||
/** Returns the number of saved states, each containing: SkMatrix and clip.
|
||||
Equals the number of save() calls less the number of restore() calls plus one.
|
||||
The save count of a new canvas is one.
|
||||
|
||||
@ -750,7 +741,7 @@ public:
|
||||
*/
|
||||
int getSaveCount() const;
|
||||
|
||||
/** Restores state to SkMatrix, clip, and SkDrawFilter values when save(), saveLayer(),
|
||||
/** Restores state to SkMatrix and clip values when save(), saveLayer(),
|
||||
saveLayerPreserveLCDTextRequests(), or saveLayerAlpha() returned saveCount.
|
||||
|
||||
Does nothing if saveCount is greater than state stack count.
|
||||
@ -2388,16 +2379,6 @@ public:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
/** To be deprecated soon.
|
||||
*/
|
||||
SkDrawFilter* getDrawFilter() const;
|
||||
|
||||
/** To be deprecated soon.
|
||||
*/
|
||||
virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter);
|
||||
#endif
|
||||
|
||||
/** Returns true if clip is empty; that is, nothing will draw.
|
||||
|
||||
May do work when called; it should not be called
|
||||
|
@ -1,53 +0,0 @@
|
||||
|
||||
/*
|
||||
* Copyright 2011 The Android Open Source Project
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SkDrawFilter_DEFINED
|
||||
#define SkDrawFilter_DEFINED
|
||||
|
||||
#include "SkRefCnt.h"
|
||||
|
||||
class SkCanvas;
|
||||
class SkPaint;
|
||||
|
||||
/**
|
||||
* DEPRECATED - use SkPaintFilterCanvas instead.
|
||||
*
|
||||
* Right before something is being draw, filter() is called with the
|
||||
* paint. The filter may modify the paint as it wishes, which will then be
|
||||
* used for the actual drawing. Note: this modification only lasts for the
|
||||
* current draw, as a temporary copy of the paint is used.
|
||||
*/
|
||||
class SK_API SkDrawFilter : public SkRefCnt {
|
||||
public:
|
||||
enum Type {
|
||||
kPaint_Type,
|
||||
kPoint_Type,
|
||||
kLine_Type,
|
||||
kBitmap_Type,
|
||||
kRect_Type,
|
||||
kRRect_Type,
|
||||
kOval_Type,
|
||||
kPath_Type,
|
||||
kText_Type,
|
||||
};
|
||||
|
||||
static constexpr int kTypeCount = kText_Type + 1;
|
||||
|
||||
/**
|
||||
* Called with the paint that will be used to draw the specified type.
|
||||
* The implementation may modify the paint as they wish. If filter()
|
||||
* returns false, the draw will be skipped.
|
||||
*/
|
||||
virtual bool filter(SkPaint*, Type) = 0;
|
||||
|
||||
private:
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2008 The Android Open Source Project
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef SkPaintFlagsDrawFilter_DEFINED
|
||||
#define SkPaintFlagsDrawFilter_DEFINED
|
||||
|
||||
#include "SkDrawFilter.h"
|
||||
|
||||
class SK_API SkPaintFlagsDrawFilter : public SkDrawFilter {
|
||||
public:
|
||||
SkPaintFlagsDrawFilter(uint32_t clearFlags, uint32_t setFlags);
|
||||
|
||||
bool filter(SkPaint*, Type) override;
|
||||
|
||||
private:
|
||||
uint16_t fClearFlags; // user specified
|
||||
uint16_t fSetFlags; // user specified
|
||||
};
|
||||
|
||||
#endif
|
@ -22,13 +22,6 @@ public:
|
||||
virtual void removeCanvas(SkCanvas*);
|
||||
virtual void removeAll();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// These are forwarded to the N canvases we're referencing
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
SkDrawFilter* setDrawFilter(SkDrawFilter*) override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
SkTDArray<SkCanvas*> fList;
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "SkTime.h"
|
||||
#include "SkTypeface.h"
|
||||
#include "SkUtils.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkClipOpPriv.h"
|
||||
|
||||
static void make_paint(SkPaint* paint, const SkMatrix& localMatrix) {
|
||||
@ -97,20 +96,6 @@ static void test_fade(SkCanvas* canvas) {
|
||||
canvas->drawRect(r, paint);
|
||||
}
|
||||
|
||||
class RedFilter : public SkDrawFilter {
|
||||
public:
|
||||
bool filter(SkPaint* p, SkDrawFilter::Type) override {
|
||||
fColor = p->getColor();
|
||||
if (fColor == SK_ColorRED) {
|
||||
p->setColor(SK_ColorGREEN);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
SkColor fColor;
|
||||
};
|
||||
|
||||
class LayersView : public SkView {
|
||||
public:
|
||||
LayersView() {}
|
||||
|
@ -74,8 +74,7 @@ protected:
|
||||
|
||||
/** These are called inside the per-device-layer loop for each draw call.
|
||||
When these are called, we have already applied any saveLayer operations,
|
||||
and are handling any looping from the paint, and any effects from the
|
||||
DrawFilter.
|
||||
and are handling any looping from the paint.
|
||||
*/
|
||||
void drawPaint(const SkPaint& paint) override;
|
||||
void drawPoints(SkCanvas::PointMode mode, size_t count,
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "SkClipStack.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkDraw.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkDrawLooper.h"
|
||||
#include "SkDrawable.h"
|
||||
#include "SkGlyphCache.h"
|
||||
@ -219,7 +218,6 @@ struct DeviceCM {
|
||||
*/
|
||||
class SkCanvas::MCRec {
|
||||
public:
|
||||
SkDrawFilter* fFilter; // the current filter (or null)
|
||||
DeviceCM* fLayer;
|
||||
/* If there are any layers in the stack, this points to the top-most
|
||||
one that is at or below this level in the stack (so we know what
|
||||
@ -233,7 +231,6 @@ public:
|
||||
int fDeferredSaveCount;
|
||||
|
||||
MCRec() {
|
||||
fFilter = nullptr;
|
||||
fLayer = nullptr;
|
||||
fTopLayer = nullptr;
|
||||
fMatrix.reset();
|
||||
@ -243,7 +240,6 @@ public:
|
||||
inc_rec();
|
||||
}
|
||||
MCRec(const MCRec& prev) : fRasterClip(prev.fRasterClip), fMatrix(prev.fMatrix) {
|
||||
fFilter = SkSafeRef(prev.fFilter);
|
||||
fLayer = nullptr;
|
||||
fTopLayer = prev.fTopLayer;
|
||||
fDeferredSaveCount = 0;
|
||||
@ -252,7 +248,6 @@ public:
|
||||
inc_rec();
|
||||
}
|
||||
~MCRec() {
|
||||
SkSafeUnref(fFilter);
|
||||
delete fLayer;
|
||||
dec_rec();
|
||||
}
|
||||
@ -371,11 +366,6 @@ public:
|
||||
AutoDrawLooper(SkCanvas* canvas, const SkPaint& paint, bool skipLayerForImageFilter = false,
|
||||
const SkRect* rawBounds = nullptr) : fOrigPaint(paint) {
|
||||
fCanvas = canvas;
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
fFilter = canvas->getDrawFilter();
|
||||
#else
|
||||
fFilter = nullptr;
|
||||
#endif
|
||||
fPaint = &fOrigPaint;
|
||||
fSaveCount = canvas->getSaveCount();
|
||||
fTempLayerForImageFilter = false;
|
||||
@ -425,7 +415,7 @@ public:
|
||||
} else {
|
||||
fLooperContext = nullptr;
|
||||
// can we be marked as simple?
|
||||
fIsSimple = !fFilter && !fTempLayerForImageFilter;
|
||||
fIsSimple = !fTempLayerForImageFilter;
|
||||
}
|
||||
}
|
||||
|
||||
@ -442,14 +432,14 @@ public:
|
||||
return *fPaint;
|
||||
}
|
||||
|
||||
bool next(SkDrawFilter::Type drawType) {
|
||||
bool next() {
|
||||
if (fDone) {
|
||||
return false;
|
||||
} else if (fIsSimple) {
|
||||
fDone = true;
|
||||
return !fPaint->nothingToDraw();
|
||||
} else {
|
||||
return this->doNext(drawType);
|
||||
return this->doNext();
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,7 +448,6 @@ private:
|
||||
SkLazyPaint fLazyPaintPerLooper; // per-draw-looper storage, so the looper can modify it
|
||||
SkCanvas* fCanvas;
|
||||
const SkPaint& fOrigPaint;
|
||||
SkDrawFilter* fFilter;
|
||||
const SkPaint* fPaint;
|
||||
int fSaveCount;
|
||||
bool fTempLayerForImageFilter;
|
||||
@ -467,13 +456,13 @@ private:
|
||||
SkDrawLooper::Context* fLooperContext;
|
||||
SkSTArenaAlloc<48> fAlloc;
|
||||
|
||||
bool doNext(SkDrawFilter::Type drawType);
|
||||
bool doNext();
|
||||
};
|
||||
|
||||
bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
|
||||
bool AutoDrawLooper::doNext() {
|
||||
fPaint = nullptr;
|
||||
SkASSERT(!fIsSimple);
|
||||
SkASSERT(fLooperContext || fFilter || fTempLayerForImageFilter);
|
||||
SkASSERT(fLooperContext || fTempLayerForImageFilter);
|
||||
|
||||
SkPaint* paint = fLazyPaintPerLooper.set(fLazyPaintInit.isValid() ?
|
||||
*fLazyPaintInit.get() : fOrigPaint);
|
||||
@ -489,20 +478,10 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
|
||||
fDone = true;
|
||||
return false;
|
||||
}
|
||||
if (fFilter) {
|
||||
if (!fFilter->filter(paint, drawType)) {
|
||||
fDone = true;
|
||||
return false; // can we really do this, if we haven't finished fLooperContext?
|
||||
}
|
||||
if (nullptr == fLooperContext) {
|
||||
// no looper means we only draw once
|
||||
fDone = true;
|
||||
}
|
||||
}
|
||||
fPaint = paint;
|
||||
|
||||
// if we only came in here for the imagefilter, mark us as done
|
||||
if (!fLooperContext && !fFilter) {
|
||||
if (!fLooperContext) {
|
||||
fDone = true;
|
||||
}
|
||||
return true;
|
||||
@ -513,26 +492,26 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
|
||||
#define LOOPER_BEGIN_DRAWBITMAP(paint, skipLayerForFilter, bounds) \
|
||||
this->predrawNotify(); \
|
||||
AutoDrawLooper looper(this, paint, skipLayerForFilter, bounds); \
|
||||
while (looper.next(SkDrawFilter::kBitmap_Type)) { \
|
||||
while (looper.next()) { \
|
||||
SkDrawIter iter(this);
|
||||
|
||||
|
||||
#define LOOPER_BEGIN_DRAWDEVICE(paint, type) \
|
||||
#define LOOPER_BEGIN_DRAWDEVICE(paint) \
|
||||
this->predrawNotify(); \
|
||||
AutoDrawLooper looper(this, paint, true); \
|
||||
while (looper.next(type)) { \
|
||||
while (looper.next()) { \
|
||||
SkDrawIter iter(this);
|
||||
|
||||
#define LOOPER_BEGIN(paint, type, bounds) \
|
||||
#define LOOPER_BEGIN(paint, bounds) \
|
||||
this->predrawNotify(); \
|
||||
AutoDrawLooper looper(this, paint, false, bounds); \
|
||||
while (looper.next(type)) { \
|
||||
while (looper.next()) { \
|
||||
SkDrawIter iter(this);
|
||||
|
||||
#define LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, type, bounds, auxOpaque) \
|
||||
#define LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, bounds, auxOpaque) \
|
||||
this->predrawNotify(bounds, &paint, auxOpaque); \
|
||||
AutoDrawLooper looper(this, paint, false, bounds); \
|
||||
while (looper.next(type)) { \
|
||||
while (looper.next()) { \
|
||||
SkDrawIter iter(this);
|
||||
|
||||
#define LOOPER_END }
|
||||
@ -692,18 +671,6 @@ SkCanvas::~SkCanvas() {
|
||||
dec_canvas();
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
SkDrawFilter* SkCanvas::getDrawFilter() const {
|
||||
return fMCRec->fFilter;
|
||||
}
|
||||
|
||||
SkDrawFilter* SkCanvas::setDrawFilter(SkDrawFilter* filter) {
|
||||
this->checkForDeferredSave();
|
||||
SkRefCnt_SafeAssign(fMCRec->fFilter, filter);
|
||||
return filter;
|
||||
}
|
||||
#endif
|
||||
|
||||
SkMetaData& SkCanvas::getMetaData() {
|
||||
// metadata users are rare, so we lazily allocate it. If that changes we
|
||||
// can decide to just make it a field in the device (rather than a ptr)
|
||||
@ -1255,7 +1222,7 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y, const SkPa
|
||||
paint = &tmp;
|
||||
}
|
||||
|
||||
LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type)
|
||||
LOOPER_BEGIN_DRAWDEVICE(*paint)
|
||||
|
||||
while (iter.next()) {
|
||||
SkBaseDevice* dstDev = iter.fDevice;
|
||||
@ -1945,7 +1912,7 @@ void SkCanvas::onDrawShadowRec(const SkPath& path, const SkDrawShadowRec& rec) {
|
||||
SkPaint paint;
|
||||
const SkRect& pathBounds = path.getBounds();
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, &pathBounds)
|
||||
LOOPER_BEGIN(paint, &pathBounds)
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawShadow(path, rec);
|
||||
}
|
||||
@ -1967,7 +1934,7 @@ void SkCanvas::onDrawPaint(const SkPaint& paint) {
|
||||
}
|
||||
|
||||
void SkCanvas::internalDrawPaint(const SkPaint& paint) {
|
||||
LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, SkDrawFilter::kPaint_Type, nullptr, false)
|
||||
LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, nullptr, false)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawPaint(looper.paint());
|
||||
@ -2003,7 +1970,7 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
|
||||
SkASSERT(pts != nullptr);
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kPoint_Type, bounds)
|
||||
LOOPER_BEGIN(paint, bounds)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawPoints(mode, count, pts, looper.paint());
|
||||
@ -2014,9 +1981,6 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
|
||||
static bool needs_autodrawlooper(SkCanvas* canvas, const SkPaint& paint) {
|
||||
return ((intptr_t)paint.getImageFilter() |
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
(intptr_t)canvas->getDrawFilter() |
|
||||
#endif
|
||||
(intptr_t)paint.getLooper() ) != 0;
|
||||
}
|
||||
|
||||
@ -2030,7 +1994,7 @@ void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
|
||||
}
|
||||
|
||||
if (needs_autodrawlooper(this, paint)) {
|
||||
LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, SkDrawFilter::kRect_Type, &r, false)
|
||||
LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, &r, false)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawRect(r, looper.paint());
|
||||
@ -2055,7 +2019,7 @@ void SkCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, ®ionRect)
|
||||
LOOPER_BEGIN(paint, ®ionRect)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawRegion(region, looper.paint());
|
||||
@ -2073,7 +2037,7 @@ void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, &oval)
|
||||
LOOPER_BEGIN(paint, &oval)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawOval(oval, looper.paint());
|
||||
@ -2094,7 +2058,7 @@ void SkCanvas::onDrawArc(const SkRect& oval, SkScalar startAngle,
|
||||
}
|
||||
}
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, &oval)
|
||||
LOOPER_BEGIN(paint, &oval)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawArc(oval, startAngle, sweepAngle, useCenter, looper.paint());
|
||||
@ -2121,7 +2085,7 @@ void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, &rrect.getBounds())
|
||||
LOOPER_BEGIN(paint, &rrect.getBounds())
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawRRect(rrect, looper.paint());
|
||||
@ -2138,7 +2102,7 @@ void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const Sk
|
||||
}
|
||||
}
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, &outer.getBounds())
|
||||
LOOPER_BEGIN(paint, &outer.getBounds())
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawDRRect(outer, inner, looper.paint());
|
||||
@ -2167,7 +2131,7 @@ void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
}
|
||||
}
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, &pathBounds)
|
||||
LOOPER_BEGIN(paint, &pathBounds)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawPath(path, looper.paint());
|
||||
@ -2275,8 +2239,7 @@ void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk
|
||||
}
|
||||
paint = &realPaint;
|
||||
|
||||
LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(*paint, SkDrawFilter::kBitmap_Type, &dst,
|
||||
image->isOpaque())
|
||||
LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(*paint, &dst, image->isOpaque())
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawImageRect(image, src, dst, looper.paint(), constraint);
|
||||
@ -2356,8 +2319,7 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
|
||||
paint = lazy.init();
|
||||
}
|
||||
|
||||
LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(*paint, SkDrawFilter::kBitmap_Type, &dst,
|
||||
bitmap.isOpaque())
|
||||
LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(*paint, &dst, bitmap.isOpaque())
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawBitmapRect(bitmap, src, dst, looper.paint(), constraint);
|
||||
@ -2385,7 +2347,7 @@ void SkCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, cons
|
||||
}
|
||||
paint = &realPaint;
|
||||
|
||||
LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &dst)
|
||||
LOOPER_BEGIN(*paint, &dst)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawImageNine(image, center, dst, looper.paint());
|
||||
@ -2408,7 +2370,7 @@ void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, c
|
||||
}
|
||||
paint = &realPaint;
|
||||
|
||||
LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &dst)
|
||||
LOOPER_BEGIN(*paint, &dst)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawBitmapNine(bitmap, center, dst, looper.paint());
|
||||
@ -2430,7 +2392,7 @@ void SkCanvas::onDrawImageLattice(const SkImage* image, const Lattice& lattice,
|
||||
}
|
||||
paint = &realPaint;
|
||||
|
||||
LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &dst)
|
||||
LOOPER_BEGIN(*paint, &dst)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawImageLattice(image, lattice, dst, looper.paint());
|
||||
@ -2452,7 +2414,7 @@ void SkCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattic
|
||||
}
|
||||
paint = &realPaint;
|
||||
|
||||
LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &dst)
|
||||
LOOPER_BEGIN(*paint, &dst)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawBitmapLattice(bitmap, lattice, dst, looper.paint());
|
||||
@ -2464,7 +2426,7 @@ void SkCanvas::onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattic
|
||||
void SkCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
|
||||
const SkPaint& paint) {
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
|
||||
LOOPER_BEGIN(paint, nullptr)
|
||||
|
||||
while (iter.next()) {
|
||||
fScratchGlyphRunBuilder->prepareDrawText(
|
||||
@ -2479,7 +2441,7 @@ void SkCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkSca
|
||||
void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
|
||||
const SkPaint& paint) {
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
|
||||
LOOPER_BEGIN(paint, nullptr)
|
||||
|
||||
while (iter.next()) {
|
||||
fScratchGlyphRunBuilder->prepareDrawPosText(looper.paint(), text, byteLength, pos);
|
||||
@ -2493,7 +2455,7 @@ void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint
|
||||
void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
|
||||
SkScalar constY, const SkPaint& paint) {
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
|
||||
LOOPER_BEGIN(paint, nullptr)
|
||||
|
||||
while (iter.next()) {
|
||||
fScratchGlyphRunBuilder->prepareDrawPosTextH(
|
||||
@ -2507,7 +2469,7 @@ void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScala
|
||||
|
||||
void SkCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
|
||||
const SkMatrix* matrix, const SkPaint& paint) {
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
|
||||
LOOPER_BEGIN(paint, nullptr)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawTextOnPath(text, byteLength, path, matrix, looper.paint());
|
||||
@ -2522,7 +2484,7 @@ void SkCanvas::onDrawTextRSXform(const void* text, size_t byteLength, const SkRS
|
||||
return;
|
||||
}
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
|
||||
LOOPER_BEGIN(paint, nullptr)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawTextRSXform(text, byteLength, xform, looper.paint());
|
||||
@ -2546,18 +2508,13 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
|
||||
// We cannot filter in the looper as we normally do, because the paint is
|
||||
// incomplete at this point (text-related attributes are embedded within blob run paints).
|
||||
SkDrawFilter* drawFilter = fMCRec->fFilter;
|
||||
fMCRec->fFilter = nullptr;
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, bounds)
|
||||
LOOPER_BEGIN(paint, bounds)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawTextBlob(blob, x, y, looper.paint(), drawFilter);
|
||||
iter.fDevice->drawTextBlob(blob, x, y, looper.paint());
|
||||
}
|
||||
|
||||
LOOPER_END
|
||||
|
||||
fMCRec->fFilter = drawFilter;
|
||||
}
|
||||
|
||||
void SkCanvas::drawString(const SkString& string, SkScalar x, SkScalar y, const SkPaint& paint) {
|
||||
@ -2615,7 +2572,7 @@ void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
|
||||
void SkCanvas::onDrawVerticesObject(const SkVertices* vertices, const SkMatrix* bones,
|
||||
int boneCount, SkBlendMode bmode, const SkPaint& paint) {
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, nullptr)
|
||||
LOOPER_BEGIN(paint, nullptr)
|
||||
|
||||
while (iter.next()) {
|
||||
// In the common case of one iteration we could std::move vertices here.
|
||||
@ -2647,7 +2604,7 @@ void SkCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
return;
|
||||
}
|
||||
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, nullptr)
|
||||
LOOPER_BEGIN(paint, nullptr)
|
||||
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawPatch(cubics, colors, texCoords, bmode, paint);
|
||||
@ -2698,7 +2655,7 @@ void SkCanvas::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const
|
||||
pnt = *paint;
|
||||
}
|
||||
|
||||
LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, nullptr)
|
||||
LOOPER_BEGIN(pnt, nullptr)
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawAtlas(atlas, xform, tex, colors, count, bmode, pnt);
|
||||
}
|
||||
@ -2709,7 +2666,7 @@ void SkCanvas::onDrawAnnotation(const SkRect& rect, const char key[], SkData* va
|
||||
SkASSERT(key);
|
||||
|
||||
SkPaint paint;
|
||||
LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, nullptr)
|
||||
LOOPER_BEGIN(paint, nullptr)
|
||||
while (iter.next()) {
|
||||
iter.fDevice->drawAnnotation(rect, key, value);
|
||||
}
|
||||
|
@ -267,13 +267,6 @@ public:
|
||||
return kNoLayer_SaveLayerStrategy;
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
SkDrawFilter* setDrawFilter(SkDrawFilter* filter) override {
|
||||
SkCanvas::setDrawFilter(filter);
|
||||
return fTarget->setDrawFilter(filter);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Everything from here on should be uninteresting strictly proxied state-change calls.
|
||||
void willSave() override { fTarget->save(); }
|
||||
void willRestore() override { fTarget->restore(); }
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkDraw.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkGlyphRun.h"
|
||||
#include "SkImageFilter.h"
|
||||
#include "SkImageFilterCache.h"
|
||||
@ -141,7 +140,7 @@ void SkBaseDevice::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
}
|
||||
|
||||
void SkBaseDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
const SkPaint &paint, SkDrawFilter* drawFilter) {
|
||||
const SkPaint &paint) {
|
||||
|
||||
SkPaint runPaint = paint;
|
||||
|
||||
@ -153,12 +152,6 @@ void SkBaseDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
// so it is safe to not re-seed the paint for this reason.
|
||||
it.applyFontToPaint(&runPaint);
|
||||
|
||||
if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Type)) {
|
||||
// A false return from filter() means we should abort the current draw.
|
||||
runPaint = paint;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (it.positioning()) {
|
||||
case SkTextBlob::kDefault_Positioning: {
|
||||
auto origin = SkPoint::Make(x + offset.x(), y + offset.y());
|
||||
@ -179,11 +172,6 @@ void SkBaseDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
default:
|
||||
SK_ABORT("unhandled positioning mode");
|
||||
}
|
||||
|
||||
if (drawFilter) {
|
||||
// A draw filter may change the paint arbitrarily, so we must re-seed in this case.
|
||||
runPaint = paint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "SkSurfaceProps.h"
|
||||
|
||||
class SkBitmap;
|
||||
class SkDrawFilter;
|
||||
struct SkDrawShadowRec;
|
||||
class SkGlyphRun;
|
||||
class SkGlyphRunBuilder;
|
||||
@ -155,8 +154,7 @@ protected:
|
||||
|
||||
/** These are called inside the per-device-layer loop for each draw call.
|
||||
When these are called, we have already applied any saveLayer operations,
|
||||
and are handling any looping from the paint, and any effects from the
|
||||
DrawFilter.
|
||||
and are handling any looping from the paint.
|
||||
*/
|
||||
virtual void drawPaint(const SkPaint& paint) = 0;
|
||||
virtual void drawPoints(SkCanvas::PointMode mode, size_t count,
|
||||
@ -230,8 +228,7 @@ protected:
|
||||
virtual void drawShadow(const SkPath&, const SkDrawShadowRec&);
|
||||
|
||||
// default implementation unrolls the blob runs.
|
||||
virtual void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y,
|
||||
const SkPaint& paint, SkDrawFilter* drawFilter);
|
||||
virtual void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint& paint);
|
||||
// default implementation calls drawVertices
|
||||
virtual void drawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint);
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "SkCanvas.h"
|
||||
#include "SkData.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkDrawShadowInfo.h"
|
||||
#include "SkImage.h"
|
||||
#include "SkImageFilter.h"
|
||||
@ -47,8 +46,8 @@ static const D* pod(const T* op, size_t offset = 0) {
|
||||
}
|
||||
|
||||
namespace {
|
||||
#define TYPES(M) \
|
||||
M(SetDrawFilter) M(Flush) M(Save) M(Restore) M(SaveLayer) \
|
||||
#define TYPES(M) \
|
||||
M(Flush) M(Save) M(Restore) M(SaveLayer) \
|
||||
M(Concat) M(SetMatrix) M(Translate) \
|
||||
M(ClipPath) M(ClipRect) M(ClipRRect) M(ClipRegion) \
|
||||
M(DrawPaint) M(DrawPath) M(DrawRect) M(DrawRegion) M(DrawOval) M(DrawArc) \
|
||||
@ -68,19 +67,6 @@ namespace {
|
||||
};
|
||||
static_assert(sizeof(Op) == 4, "");
|
||||
|
||||
struct SetDrawFilter final : Op {
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
static const auto kType = Type::SetDrawFilter;
|
||||
SetDrawFilter(SkDrawFilter* df) : drawFilter(sk_ref_sp(df)) {}
|
||||
sk_sp<SkDrawFilter> drawFilter;
|
||||
#endif
|
||||
void draw(SkCanvas* c, const SkMatrix&) const {
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
c->setDrawFilter(drawFilter.get());
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
struct Flush final : Op {
|
||||
static const auto kType = Type::Flush;
|
||||
void draw(SkCanvas* c, const SkMatrix&) const { c->flush(); }
|
||||
@ -542,12 +528,6 @@ inline void SkLiteDL::map(const Fn fns[], Args... args) const {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
void SkLiteDL::setDrawFilter(SkDrawFilter* df) {
|
||||
this->push<SetDrawFilter>(0, df);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SkLiteDL::flush() { this->push<Flush>(0); }
|
||||
|
||||
void SkLiteDL:: save() { this->push <Save>(0); }
|
||||
|
@ -25,10 +25,6 @@ public:
|
||||
void reset();
|
||||
bool empty() const { return fUsed == 0; }
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
void setDrawFilter(SkDrawFilter*);
|
||||
#endif
|
||||
|
||||
void flush();
|
||||
|
||||
void save();
|
||||
|
@ -22,13 +22,6 @@ sk_sp<SkSurface> SkLiteRecorder::onNewSurface(const SkImageInfo&, const SkSurfac
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
SkDrawFilter* SkLiteRecorder::setDrawFilter(SkDrawFilter* df) {
|
||||
fDL->setDrawFilter(df);
|
||||
return this->INHERITED::setDrawFilter(df);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SkLiteRecorder::onFlush() { fDL->flush(); }
|
||||
|
||||
void SkLiteRecorder::willSave() { fDL->save(); }
|
||||
|
@ -20,10 +20,6 @@ public:
|
||||
|
||||
sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
SkDrawFilter* setDrawFilter(SkDrawFilter*) override;
|
||||
#endif
|
||||
|
||||
void willSave() override;
|
||||
SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override;
|
||||
void willRestore() override;
|
||||
|
@ -240,12 +240,10 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint,
|
||||
SkDrawFilter* drawFilter) override {
|
||||
void drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
const SkPaint& paint) override {
|
||||
// The looper should be applied by the SkCanvas.
|
||||
SkASSERT(paint.getDrawLooper() == nullptr);
|
||||
// We don't support SkDrawFilter.
|
||||
SkASSERT(drawFilter == nullptr);
|
||||
|
||||
SkPoint position{x, y};
|
||||
SkPaint runPaint{paint};
|
||||
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkPaintFlagsDrawFilter.h"
|
||||
|
||||
#include "SkPaint.h"
|
||||
#include "SkTo.h"
|
||||
|
||||
SkPaintFlagsDrawFilter::SkPaintFlagsDrawFilter(uint32_t clearFlags,
|
||||
uint32_t setFlags) {
|
||||
fClearFlags = SkToU16(clearFlags & SkPaint::kAllFlags);
|
||||
fSetFlags = SkToU16(setFlags & SkPaint::kAllFlags);
|
||||
}
|
||||
|
||||
bool SkPaintFlagsDrawFilter::filter(SkPaint* paint, Type) {
|
||||
paint->setFlags((paint->getFlags() & ~fClearFlags) | fSetFlags);
|
||||
return true;
|
||||
}
|
@ -241,8 +241,7 @@ void GrRenderTargetContext::drawPosText(const GrClip& clip, const SkPaint& paint
|
||||
|
||||
void GrRenderTargetContext::drawTextBlob(const GrClip& clip, const SkPaint& paint,
|
||||
const SkMatrix& viewMatrix, const SkTextBlob* blob,
|
||||
SkScalar x, SkScalar y, SkDrawFilter* filter,
|
||||
const SkIRect& clipBounds) {
|
||||
SkScalar x, SkScalar y, const SkIRect& clipBounds) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
RETURN_IF_ABANDONED
|
||||
SkDEBUGCODE(this->validate();)
|
||||
@ -250,7 +249,7 @@ void GrRenderTargetContext::drawTextBlob(const GrClip& clip, const SkPaint& pain
|
||||
|
||||
GrTextContext* atlasTextContext = this->drawingManager()->getTextContext();
|
||||
atlasTextContext->drawTextBlob(fContext, fTextTarget.get(), clip, paint, viewMatrix,
|
||||
fSurfaceProps, blob, x, y, filter, clipBounds);
|
||||
fSurfaceProps, blob, x, y, clipBounds);
|
||||
}
|
||||
|
||||
void GrRenderTargetContext::discard() {
|
||||
|
@ -36,7 +36,6 @@ class GrShape;
|
||||
class GrStyle;
|
||||
class GrTextureProxy;
|
||||
struct GrUserStencilSettings;
|
||||
class SkDrawFilter;
|
||||
struct SkDrawShadowRec;
|
||||
struct SkIPoint;
|
||||
struct SkIRect;
|
||||
@ -70,8 +69,7 @@ public:
|
||||
const SkIRect& clipBounds);
|
||||
virtual void drawTextBlob(const GrClip&, const SkPaint&,
|
||||
const SkMatrix& viewMatrix, const SkTextBlob*,
|
||||
SkScalar x, SkScalar y,
|
||||
SkDrawFilter*, const SkIRect& clipBounds);
|
||||
SkScalar x, SkScalar y, const SkIRect& clipBounds);
|
||||
|
||||
/**
|
||||
* Provides a perfomance hint that the render target's contents are allowed
|
||||
|
@ -1638,12 +1638,12 @@ void SkGpuDevice::drawPosText(const void* text, size_t byteLength,
|
||||
}
|
||||
|
||||
void SkGpuDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
const SkPaint& paint, SkDrawFilter* drawFilter) {
|
||||
const SkPaint& paint) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawTextBlob", fContext.get());
|
||||
SkDEBUGCODE(this->validate();)
|
||||
|
||||
fRenderTargetContext->drawTextBlob(this->clip(), paint, this->ctm(), blob, x, y, drawFilter,
|
||||
fRenderTargetContext->drawTextBlob(this->clip(), paint, this->ctm(), blob, x, y,
|
||||
this->devClipBounds());
|
||||
}
|
||||
|
||||
|
@ -89,8 +89,7 @@ public:
|
||||
const SkPaint& paint) override;
|
||||
void drawPosText(const void* text, size_t len, const SkScalar pos[],
|
||||
int scalarsPerPos, const SkPoint& offset, const SkPaint&) override;
|
||||
void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y,
|
||||
const SkPaint& paint, SkDrawFilter* drawFilter) override;
|
||||
void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint& paint) override;
|
||||
void drawVertices(const SkVertices*, const SkMatrix bones[], int boneCount, SkBlendMode,
|
||||
const SkPaint&) override;
|
||||
void drawShadow(const SkPath&, const SkDrawShadowRec&) override;
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "GrContext.h"
|
||||
#include "GrTextUtils.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkGlyphCache.h"
|
||||
#include "SkMaskFilterBase.h"
|
||||
#include "SkPaintPriv.h"
|
||||
@ -303,7 +302,7 @@ void GrTextBlob::flush(GrTextUtils::Target* target, const SkSurfaceProps& props,
|
||||
// GrTextBlob::makeOp only takes uint16_t values for run and subRun indices.
|
||||
// Encountering something larger than this is highly unlikely, so we'll just not draw it.
|
||||
int lastRun = SkTMin(fRunCount, (1 << 16)) - 1;
|
||||
GrTextUtils::RunPaint runPaint(&paint, nullptr);
|
||||
GrTextUtils::RunPaint runPaint(&paint);
|
||||
for (int runIndex = 0; runIndex <= lastRun; runIndex++) {
|
||||
Run& run = fRuns[runIndex];
|
||||
|
||||
|
@ -25,7 +25,6 @@ class GrAtlasManager;
|
||||
struct GrDistanceFieldAdjustTable;
|
||||
struct GrGlyph;
|
||||
|
||||
class SkDrawFilter;
|
||||
class SkTextBlob;
|
||||
class SkTextBlobRunIterator;
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "GrTextBlobCache.h"
|
||||
#include "SkDistanceFieldGen.h"
|
||||
#include "SkDraw.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkDrawProcs.h"
|
||||
#include "SkFindAndPlaceGlyph.h"
|
||||
#include "SkGlyphRun.h"
|
||||
@ -102,7 +101,7 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target
|
||||
const GrClip& clip, const SkPaint& skPaint,
|
||||
const SkMatrix& viewMatrix, const SkSurfaceProps& props,
|
||||
const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
SkDrawFilter* drawFilter, const SkIRect& clipBounds) {
|
||||
const SkIRect& clipBounds) {
|
||||
// If we have been abandoned, then don't draw
|
||||
if (context->abandoned()) {
|
||||
return;
|
||||
@ -114,9 +113,7 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target
|
||||
// It might be worth caching these things, but its not clear at this time
|
||||
// TODO for animated mask filters, this will fill up our cache. We need a safeguard here
|
||||
const SkMaskFilter* mf = skPaint.getMaskFilter();
|
||||
bool canCache = !(skPaint.getPathEffect() ||
|
||||
(mf && !as_MFB(mf)->asABlur(&blurRec)) ||
|
||||
drawFilter);
|
||||
bool canCache = !(skPaint.getPathEffect() || (mf && !as_MFB(mf)->asABlur(&blurRec)));
|
||||
SkScalerContextFlags scalerContextFlags = ComputeScalerContextFlags(target->colorSpaceInfo());
|
||||
|
||||
auto glyphCache = context->contextPriv().getGlyphCache();
|
||||
@ -154,7 +151,7 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target
|
||||
cacheBlob = textBlobCache->makeCachedBlob(blob, key, blurRec, skPaint);
|
||||
this->regenerateTextBlob(cacheBlob.get(), glyphCache,
|
||||
*context->contextPriv().caps()->shaderCaps(), paint,
|
||||
scalerContextFlags, viewMatrix, props, blob, x, y, drawFilter);
|
||||
scalerContextFlags, viewMatrix, props, blob, x, y);
|
||||
} else {
|
||||
textBlobCache->makeMRU(cacheBlob.get());
|
||||
|
||||
@ -166,7 +163,7 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target
|
||||
sanityBlob->setupKey(key, blurRec, skPaint);
|
||||
this->regenerateTextBlob(
|
||||
sanityBlob.get(), glyphCache, *context->contextPriv().caps()->shaderCaps(),
|
||||
paint, scalerContextFlags, viewMatrix, props, blob, x, y, drawFilter);
|
||||
paint, scalerContextFlags, viewMatrix, props, blob, x, y);
|
||||
GrTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
|
||||
}
|
||||
}
|
||||
@ -178,7 +175,7 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target
|
||||
}
|
||||
this->regenerateTextBlob(cacheBlob.get(), glyphCache,
|
||||
*context->contextPriv().caps()->shaderCaps(), paint,
|
||||
scalerContextFlags, viewMatrix, props, blob, x, y, drawFilter);
|
||||
scalerContextFlags, viewMatrix, props, blob, x, y);
|
||||
}
|
||||
|
||||
cacheBlob->flush(target, props, fDistanceAdjustTable.get(), paint,
|
||||
@ -192,13 +189,12 @@ void GrTextContext::regenerateTextBlob(GrTextBlob* cacheBlob,
|
||||
SkScalerContextFlags scalerContextFlags,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkSurfaceProps& props, const SkTextBlob* blob,
|
||||
SkScalar x, SkScalar y,
|
||||
SkDrawFilter* drawFilter) const {
|
||||
SkScalar x, SkScalar y) const {
|
||||
cacheBlob->initReusableBlob(paint.luminanceColor(), viewMatrix, x, y);
|
||||
|
||||
// Regenerate textblob
|
||||
SkTextBlobRunIterator it(blob);
|
||||
GrTextUtils::RunPaint runPaint(&paint, drawFilter);
|
||||
GrTextUtils::RunPaint runPaint(&paint);
|
||||
for (int run = 0; !it.done(); it.next(), run++) {
|
||||
int glyphCount = it.glyphCount();
|
||||
size_t textLen = glyphCount * sizeof(uint16_t);
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
const SkPoint& offset, const SkIRect& regionClipBounds);
|
||||
void drawTextBlob(GrContext*, GrTextUtils::Target*, const GrClip&, const SkPaint&,
|
||||
const SkMatrix& viewMatrix, const SkSurfaceProps&, const SkTextBlob*,
|
||||
SkScalar x, SkScalar y, SkDrawFilter*, const SkIRect& clipBounds);
|
||||
SkScalar x, SkScalar y, const SkIRect& clipBounds);
|
||||
|
||||
std::unique_ptr<GrDrawOp> createOp_TestingOnly(GrContext*,
|
||||
GrTextContext*,
|
||||
@ -122,8 +122,7 @@ private:
|
||||
SkScalerContextFlags scalerContextFlags,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkSurfaceProps&,
|
||||
const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
SkDrawFilter* drawFilter) const;
|
||||
const SkTextBlob* blob, SkScalar x, SkScalar y) const;
|
||||
|
||||
static bool HasLCD(const SkTextBlob*);
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "GrTextUtils.h"
|
||||
#include "GrContext.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkGlyphCache.h"
|
||||
#include "SkGr.h"
|
||||
#include "SkPaint.h"
|
||||
@ -27,21 +26,8 @@ bool GrTextUtils::RunPaint::modifyForRun(std::function<void(SkPaint*)> paintModF
|
||||
if (!fModifiedPaint.isValid()) {
|
||||
fModifiedPaint.init(fOriginalPaint->skPaint());
|
||||
fPaint = fModifiedPaint.get();
|
||||
} else if (fFilter) {
|
||||
// We have to reset before applying the run because the filter could have arbitrary
|
||||
// changed the paint.
|
||||
*fModifiedPaint.get() = fOriginalPaint->skPaint();
|
||||
}
|
||||
paintModFunc(fModifiedPaint.get());
|
||||
|
||||
if (fFilter) {
|
||||
if (!fFilter->filter(fModifiedPaint.get(), SkDrawFilter::kText_Type)) {
|
||||
// A false return from filter() means we should abort the current draw.
|
||||
return false;
|
||||
}
|
||||
// The draw filter could have changed either the paint color or color filter.
|
||||
this->initFilteredColor();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ class GrGlyphCache;
|
||||
class GrPaint;
|
||||
class GrShaderCaps;
|
||||
class SkColorSpace;
|
||||
class SkDrawFilter;
|
||||
class SkGlyph;
|
||||
class SkMatrix;
|
||||
struct SkIRect;
|
||||
@ -110,8 +109,7 @@ public:
|
||||
*/
|
||||
class RunPaint : public Paint {
|
||||
public:
|
||||
RunPaint(const Paint* paint, SkDrawFilter* filter)
|
||||
: fOriginalPaint(paint), fFilter(filter) {
|
||||
RunPaint(const Paint* paint) : fOriginalPaint(paint) {
|
||||
// Initially we represent the original paint.
|
||||
fPaint = &fOriginalPaint->skPaint();
|
||||
fDstColorSpaceInfo = fOriginalPaint->dstColorSpaceInfo();
|
||||
@ -123,7 +121,6 @@ public:
|
||||
private:
|
||||
SkTLazy<SkPaint> fModifiedPaint;
|
||||
const Paint* fOriginalPaint;
|
||||
SkDrawFilter* fFilter;
|
||||
};
|
||||
|
||||
class PathTextIter : SkTextBaseIter {
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "SkColor.h"
|
||||
#include "SkColorFilter.h"
|
||||
#include "SkDraw.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkGlyphCache.h"
|
||||
#include "SkImageFilterCache.h"
|
||||
#include "SkJpegEncoder.h"
|
||||
@ -1459,13 +1458,10 @@ void SkPDFDevice::drawPosText(const void* text, size_t len,
|
||||
}
|
||||
|
||||
void SkPDFDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
const SkPaint &paint, SkDrawFilter* drawFilter) {
|
||||
const SkPaint &paint) {
|
||||
for (SkTextBlobRunIterator it(blob); !it.done(); it.next()) {
|
||||
SkPaint runPaint(paint);
|
||||
it.applyFontToPaint(&runPaint);
|
||||
if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Type)) {
|
||||
continue;
|
||||
}
|
||||
SkPoint offset = it.offset() + SkPoint{x, y};
|
||||
this->internalDrawText(it.glyphs(), sizeof(SkGlyphID) * it.glyphCount(),
|
||||
it.pos(), it.positioning(), offset, runPaint,
|
||||
|
@ -68,8 +68,7 @@ public:
|
||||
/**
|
||||
* These are called inside the per-device-layer loop for each draw call.
|
||||
* When these are called, we have already applied any saveLayer
|
||||
* operations, and are handling any looping from the paint, and any
|
||||
* effects from the DrawFilter.
|
||||
* operations, and are handling any looping from the paint.
|
||||
*/
|
||||
void drawPaint(const SkPaint& paint) override;
|
||||
void drawPoints(SkCanvas::PointMode mode,
|
||||
@ -98,8 +97,7 @@ public:
|
||||
void drawPosText(const void* text, size_t len,
|
||||
const SkScalar pos[], int scalarsPerPos,
|
||||
const SkPoint& offset, const SkPaint&) override;
|
||||
void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y,
|
||||
const SkPaint &, SkDrawFilter*) override;
|
||||
void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint &) override;
|
||||
void drawVertices(const SkVertices*, const SkMatrix* bones, int boneCount, SkBlendMode,
|
||||
const SkPaint&) override;
|
||||
void drawDevice(SkBaseDevice*, int x, int y,
|
||||
|
@ -366,13 +366,3 @@ void SkNWayCanvas::onFlush() {
|
||||
iter->flush();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
SkDrawFilter* SkNWayCanvas::setDrawFilter(SkDrawFilter* filter) {
|
||||
Iter iter(fList);
|
||||
while (iter.next()) {
|
||||
iter->setDrawFilter(filter);
|
||||
}
|
||||
return this->INHERITED::setDrawFilter(filter);
|
||||
}
|
||||
#endif
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "SkClipOpPriv.h"
|
||||
#include "SkColor.h"
|
||||
#include "SkCommandLineFlags.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkImageInfo.h"
|
||||
#include "SkPaint.h"
|
||||
#include "SkRRect.h"
|
||||
@ -274,36 +273,6 @@ DEF_TEST(CanvasState_test_complex_clips, reporter) {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
|
||||
class TestDrawFilter : public SkDrawFilter {
|
||||
public:
|
||||
bool filter(SkPaint*, Type) override { return true; }
|
||||
};
|
||||
|
||||
DEF_TEST(CanvasState_test_draw_filters, reporter) {
|
||||
TestDrawFilter drawFilter;
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocN32Pixels(10, 10);
|
||||
SkCanvas canvas(bitmap);
|
||||
|
||||
canvas.setDrawFilter(&drawFilter);
|
||||
|
||||
SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas);
|
||||
REPORTER_ASSERT(reporter, state);
|
||||
std::unique_ptr<SkCanvas> tmpCanvas = SkCanvasStateUtils::MakeFromCanvasState(state);
|
||||
REPORTER_ASSERT(reporter, tmpCanvas);
|
||||
|
||||
REPORTER_ASSERT(reporter, canvas.getDrawFilter());
|
||||
REPORTER_ASSERT(reporter, nullptr == tmpCanvas->getDrawFilter());
|
||||
|
||||
SkCanvasStateUtils::ReleaseCanvasState(state);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DEF_TEST(CanvasState_test_soft_clips, reporter) {
|
||||
SkBitmap bitmap;
|
||||
bitmap.allocN32Pixels(10, 10);
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkCanvas.h"
|
||||
#include "SkDrawFilter.h"
|
||||
#include "SkRefCnt.h"
|
||||
#include "SkSurface.h"
|
||||
#include "Test.h"
|
||||
class SkPaint;
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
|
||||
|
||||
namespace {
|
||||
class TestFilter : public SkDrawFilter {
|
||||
public:
|
||||
bool filter(SkPaint* p, Type) override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* canvas.setDrawFilter is defined to be local to the save/restore block, such that if you
|
||||
* do the following: save / modify-drawfilter / restore, the current drawfilter should be what
|
||||
* it was before the save.
|
||||
*/
|
||||
static void test_saverestore(skiatest::Reporter* reporter) {
|
||||
auto surface(SkSurface::MakeRasterN32Premul(10, 10));
|
||||
SkCanvas* canvas = surface->getCanvas();
|
||||
|
||||
sk_sp<TestFilter> df(new TestFilter);
|
||||
|
||||
REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter());
|
||||
|
||||
canvas->save();
|
||||
canvas->setDrawFilter(df.get());
|
||||
REPORTER_ASSERT(reporter, nullptr != canvas->getDrawFilter());
|
||||
canvas->restore();
|
||||
|
||||
REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter());
|
||||
}
|
||||
|
||||
DEF_TEST(DrawFilter, reporter) {
|
||||
test_saverestore(reporter);
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user