SaveFlags begone!
This is now dead code (post https://codereview.chromium.org/1636103002). R=reed@google.com,robertphillips@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1648773002 Review URL: https://codereview.chromium.org/1648773002
This commit is contained in:
parent
5962957d95
commit
54d60293ce
@ -285,35 +285,6 @@ public:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
|
||||
enum SaveFlags {
|
||||
/** save the matrix state, restoring it on restore() */
|
||||
// [deprecated] kMatrix_SaveFlag = 0x01,
|
||||
kMatrix_SaveFlag = 0x01,
|
||||
/** save the clip state, restoring it on restore() */
|
||||
// [deprecated] kClip_SaveFlag = 0x02,
|
||||
kClip_SaveFlag = 0x02,
|
||||
/** the layer needs to support per-pixel alpha */
|
||||
kHasAlphaLayer_SaveFlag = 0x04,
|
||||
/** the layer needs to support 8-bits per color component */
|
||||
kFullColorLayer_SaveFlag = 0x08,
|
||||
/**
|
||||
* the layer should clip against the bounds argument
|
||||
*
|
||||
* if SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG is undefined, this is treated as always on.
|
||||
*/
|
||||
kClipToLayer_SaveFlag = 0x10,
|
||||
|
||||
// helper masks for common choices
|
||||
// [deprecated] kMatrixClip_SaveFlag = 0x03,
|
||||
kMatrixClip_SaveFlag = 0x03,
|
||||
#ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
|
||||
kARGB_NoClipLayer_SaveFlag = 0x0F,
|
||||
#endif
|
||||
kARGB_ClipLayer_SaveFlag = 0x1F
|
||||
};
|
||||
#endif
|
||||
|
||||
/** This call saves the current matrix, clip, and drawFilter, and pushes a
|
||||
copy onto a private stack. Subsequent calls to translate, scale,
|
||||
rotate, skew, concat or clipRect, clipPath, and setDrawFilter all
|
||||
@ -349,26 +320,6 @@ public:
|
||||
*/
|
||||
int saveLayerPreserveLCDTextRequests(const SkRect* bounds, const SkPaint* paint);
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
|
||||
/** DEPRECATED - use saveLayer(const SkRect*, const SkPaint*) instead.
|
||||
|
||||
This behaves the same as saveLayer(const SkRect*, const SkPaint*),
|
||||
but it allows fine-grained control of which state bits to be saved
|
||||
(and subsequently restored).
|
||||
|
||||
@param bounds (may be null) This rect, if non-null, is used as a hint to
|
||||
limit the size of the offscreen, and thus drawing may be
|
||||
clipped to it, though that clipping is not guaranteed to
|
||||
happen. If exact clipping is desired, use clipRect().
|
||||
@param paint (may be null) This is copied, and is applied to the
|
||||
offscreen when restore() is called
|
||||
@param flags LayerFlags
|
||||
@return The value to pass to restoreToCount() to balance this save()
|
||||
*/
|
||||
SK_ATTR_EXTERNALLY_DEPRECATED("SaveFlags use is deprecated")
|
||||
int saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags);
|
||||
#endif
|
||||
|
||||
/** This behaves the same as save(), but in addition it allocates an
|
||||
offscreen bitmap. All drawing calls are directed there, and only when
|
||||
the balancing call to restore() is made is that offscreen transfered to
|
||||
@ -382,25 +333,6 @@ public:
|
||||
*/
|
||||
int saveLayerAlpha(const SkRect* bounds, U8CPU alpha);
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
|
||||
/** DEPRECATED - use saveLayerAlpha(const SkRect*, U8CPU) instead.
|
||||
|
||||
This behaves the same as saveLayerAlpha(const SkRect*, U8CPU),
|
||||
but it allows fine-grained control of which state bits to be saved
|
||||
(and subsequently restored).
|
||||
|
||||
@param bounds (may be null) This rect, if non-null, is used as a hint to
|
||||
limit the size of the offscreen, and thus drawing may be
|
||||
clipped to it, though that clipping is not guaranteed to
|
||||
happen. If exact clipping is desired, use clipRect().
|
||||
@param alpha This is applied to the offscreen when restore() is called.
|
||||
@param flags LayerFlags
|
||||
@return The value to pass to restoreToCount() to balance this save()
|
||||
*/
|
||||
SK_ATTR_EXTERNALLY_DEPRECATED("SaveFlags use is deprecated")
|
||||
int saveLayerAlpha(const SkRect* bounds, U8CPU alpha, SaveFlags flags);
|
||||
#endif
|
||||
|
||||
enum {
|
||||
kIsOpaque_SaveLayerFlag = 1 << 0,
|
||||
kPreserveLCDText_SaveLayerFlag = 1 << 1,
|
||||
@ -1362,16 +1294,8 @@ protected:
|
||||
bool clipRectBounds(const SkRect* bounds, SaveLayerFlags, SkIRect* intersection,
|
||||
const SkImageFilter* imageFilter = NULL);
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
|
||||
// Needed by SkiaCanvasProxy in Android. Make sure that class is updated
|
||||
// before removing this method.
|
||||
static uint32_t SaveLayerFlagsToSaveFlags(SaveLayerFlags);
|
||||
#endif
|
||||
private:
|
||||
static bool BoundsAffectsClip(SaveLayerFlags);
|
||||
#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
|
||||
static uint32_t SaveFlagsToSaveLayerFlags(SaveFlags);
|
||||
#endif
|
||||
static SaveLayerFlags LegacySaveFlagsToSaveLayerFlags(uint32_t legacySaveFlags);
|
||||
|
||||
enum ShaderOverrideOpacity {
|
||||
@ -1568,19 +1492,6 @@ private:
|
||||
};
|
||||
#define SkAutoCanvasRestore(...) SK_REQUIRE_LOCAL_VAR(SkAutoCanvasRestore)
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
|
||||
static inline SkCanvas::SaveFlags operator|(const SkCanvas::SaveFlags lhs,
|
||||
const SkCanvas::SaveFlags rhs) {
|
||||
return static_cast<SkCanvas::SaveFlags>(static_cast<int>(lhs) | static_cast<int>(rhs));
|
||||
}
|
||||
|
||||
static inline SkCanvas::SaveFlags& operator|=(SkCanvas::SaveFlags& lhs,
|
||||
const SkCanvas::SaveFlags rhs) {
|
||||
lhs = lhs | rhs;
|
||||
return lhs;
|
||||
}
|
||||
#endif
|
||||
|
||||
class SkCanvasClipVisitor {
|
||||
public:
|
||||
virtual ~SkCanvasClipVisitor();
|
||||
|
@ -1115,42 +1115,11 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveLayerFlags saveLayerFlag
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
|
||||
uint32_t SkCanvas::SaveFlagsToSaveLayerFlags(SaveFlags flags) {
|
||||
uint32_t layerFlags = 0;
|
||||
|
||||
if (0 == (flags & kClipToLayer_SaveFlag)) {
|
||||
layerFlags |= kDontClipToLayer_PrivateSaveLayerFlag;
|
||||
}
|
||||
if (0 == (flags & kHasAlphaLayer_SaveFlag)) {
|
||||
layerFlags |= kIsOpaque_SaveLayerFlag;
|
||||
}
|
||||
return layerFlags;
|
||||
}
|
||||
|
||||
uint32_t SkCanvas::SaveLayerFlagsToSaveFlags(SaveLayerFlags layerFlags) {
|
||||
uint32_t saveFlags = 0;
|
||||
|
||||
if (0 == (layerFlags & kDontClipToLayer_PrivateSaveLayerFlag)) {
|
||||
saveFlags |= kClipToLayer_SaveFlag;
|
||||
}
|
||||
if (0 == (layerFlags & kIsOpaque_SaveLayerFlag)) {
|
||||
saveFlags |= kHasAlphaLayer_SaveFlag;
|
||||
}
|
||||
return saveFlags;
|
||||
}
|
||||
#endif
|
||||
|
||||
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
|
||||
return this->saveLayer(SaveLayerRec(bounds, paint, 0));
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
|
||||
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) {
|
||||
return this->saveLayer(SaveLayerRec(bounds, paint, SaveFlagsToSaveLayerFlags(flags)));
|
||||
}
|
||||
#endif
|
||||
|
||||
int SkCanvas::saveLayerPreserveLCDTextRequests(const SkRect* bounds, const SkPaint* paint) {
|
||||
return this->saveLayer(SaveLayerRec(bounds, paint, kPreserveLCDText_SaveLayerFlag));
|
||||
}
|
||||
@ -1290,19 +1259,6 @@ int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
|
||||
int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
|
||||
SaveFlags flags) {
|
||||
if (0xFF == alpha) {
|
||||
return this->saveLayer(bounds, nullptr, flags);
|
||||
} else {
|
||||
SkPaint tmpPaint;
|
||||
tmpPaint.setAlpha(alpha);
|
||||
return this->saveLayer(bounds, &tmpPaint, flags);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void SkCanvas::internalRestore() {
|
||||
SkASSERT(fMCStack.count() != 0);
|
||||
|
||||
|
@ -21,10 +21,6 @@ enum LegacySaveFlags {
|
||||
kHasAlphaLayer_LegacySaveFlags = 0x04,
|
||||
kClipToLayer_LegacySaveFlags = 0x10,
|
||||
};
|
||||
#ifdef SK_SUPPORT_LEGACY_SAVEFLAGS
|
||||
static_assert(kHasAlphaLayer_LegacySaveFlags == (int)SkCanvas::kHasAlphaLayer_SaveFlag, "");
|
||||
static_assert(kClipToLayer_LegacySaveFlags == (int)SkCanvas::kClipToLayer_SaveFlag, "");
|
||||
#endif
|
||||
|
||||
SkCanvas::SaveLayerFlags SkCanvas::LegacySaveFlagsToSaveLayerFlags(uint32_t flags) {
|
||||
uint32_t layerFlags = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user