Remove unused field from DeviceCM

The SkRasterClip on DeviceCM appears to be unused and just increased the
size of that struct. Now the clip is tracked on the MCRec or within
SkBitmapDevice itself.

This adjusts the reserved size for DeviceCM to match (as reported on my
machine), and moves it into an anonymous namespace.

Change-Id: Ifa8635f839fc3d75339a64c9378ee054fe0cc071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321250
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
Michael Ludwig 2020-09-30 17:04:25 -04:00 committed by Skia Commit-Bot
parent 8ba54ea3a2
commit 6d32686824
4 changed files with 5 additions and 8 deletions

View File

@ -2641,7 +2641,7 @@ private:
// the first N recs that can fit here mean we won't call malloc
static constexpr int kMCRecSize = 128; // most recent measurement
static constexpr int kMCRecCount = 32; // common depth for save/restores
static constexpr int kDeviceCMSize = 224; // most recent measurement
static constexpr int kDeviceCMSize = 64; // most recent measurement
intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)];
intptr_t fDeviceCMStorage[kDeviceCMSize / sizeof(intptr_t)];

View File

@ -135,7 +135,6 @@ protected:
private:
friend class SkCanvas;
friend struct DeviceCM; //for setMatrixClip
friend class SkDraw;
friend class SkDrawIter;
friend class SkDrawTiler;

View File

@ -178,6 +178,8 @@ void SkCanvas::predrawNotify(const SkRect* rect, const SkPaint* paint,
///////////////////////////////////////////////////////////////////////////////
namespace {
/* This is the record we keep for each SkBaseDevice that the user installs.
The clip/matrix/proc are fields that reflect the top of the save/restore
stack. Whenever the canvas changes, it marks a dirty flag, and then before
@ -188,7 +190,6 @@ void SkCanvas::predrawNotify(const SkRect* rect, const SkPaint* paint,
struct DeviceCM {
DeviceCM* fNext;
sk_sp<SkBaseDevice> fDevice;
SkRasterClip fClip;
std::unique_ptr<const SkPaint> fPaint; // may be null (in the future)
SkMatrix fStashedMatrix; // original CTM; used by imagefilter in saveLayer
@ -199,15 +200,13 @@ struct DeviceCM {
, fStashedMatrix(stashed)
{}
void reset(const SkIRect& bounds) {
void validate() {
SkASSERT(!fPaint);
SkASSERT(!fNext);
SkASSERT(fDevice);
fClip.setRect(bounds);
}
};
namespace {
// Encapsulate state needed to restore from saveBehind()
struct BackImage {
sk_sp<SkSpecialImage> fImage;
@ -262,10 +261,10 @@ public:
void reset(const SkIRect& bounds) {
SkASSERT(fLayer);
SkASSERT(fDeferredSaveCount == 0);
fLayer->validate();
fMatrix.setIdentity();
fRasterClip.setRect(bounds);
fLayer->reset(bounds);
}
};

View File

@ -400,7 +400,6 @@ protected:
private:
friend class SkAndroidFrameworkUtils;
friend class SkCanvas;
friend struct DeviceCM; //for setMatrixClip
friend class SkDraw;
friend class SkDrawIter;
friend class SkSurface_Raster;