Inline noop willFoo/didFoo into SkCanvas.h.

We've got our canvas subclasses all calling back up to these via
INHERITED, all noops.  That's fine but currently a little sad as they
can't be optimized away without link-time optimization, which we and
Chrome only do on Windows.  We actually make a call for each of these
today on non-Windows.

So, move the empty implementations into the header so those chaining
calls really can be optimized away.

BUG=skia:
R=reed@google.com, fmalita@google.com, mtklein@google.com, fmalita@chromium.org

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/287593005

git-svn-id: http://skia.googlecode.com/svn/trunk@14722 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-05-14 13:13:44 +00:00
parent 8ec8bab778
commit fc6dfbab75
2 changed files with 7 additions and 27 deletions

View File

@ -1226,12 +1226,14 @@ protected:
kFullLayer_SaveLayerStrategy,
kNoLayer_SaveLayerStrategy
};
virtual void willSave(SaveFlags);
virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags);
virtual void willRestore();
virtual void didConcat(const SkMatrix&);
virtual void didSetMatrix(const SkMatrix&);
virtual void willSave(SaveFlags) {}
virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) {
return kFullLayer_SaveLayerStrategy;
}
virtual void willRestore() {}
virtual void didConcat(const SkMatrix&) {}
virtual void didSetMatrix(const SkMatrix&) {}
virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&);

View File

@ -830,10 +830,6 @@ int SkCanvas::internalSave(SaveFlags flags) {
return saveCount;
}
void SkCanvas::willSave(SaveFlags) {
// Do nothing. Subclasses may do something.
}
int SkCanvas::save() {
this->willSave(kMatrixClip_SaveFlag);
return this->internalSave(kMatrixClip_SaveFlag);
@ -897,12 +893,6 @@ bool SkCanvas::clipRectBounds(const SkRect* bounds, SaveFlags flags,
return true;
}
SkCanvas::SaveLayerStrategy SkCanvas::willSaveLayer(const SkRect*, const SkPaint*, SaveFlags) {
// Do nothing. Subclasses may do something.
return kFullLayer_SaveLayerStrategy;
}
int SkCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint) {
SaveLayerStrategy strategy = this->willSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag);
return this->internalSaveLayer(bounds, paint, kARGB_ClipLayer_SaveFlag, false, strategy);
@ -999,10 +989,6 @@ int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
}
}
void SkCanvas::willRestore() {
// Do nothing. Subclasses may do something.
}
void SkCanvas::restore() {
// check for underflow
if (fMCStack.count() > 1) {
@ -1344,10 +1330,6 @@ void SkCanvas::skew(SkScalar sx, SkScalar sy) {
this->concat(m);
}
void SkCanvas::didConcat(const SkMatrix&) {
// Do nothing. Subclasses may do something.
}
void SkCanvas::concat(const SkMatrix& matrix) {
if (matrix.isIdentity()) {
return;
@ -1360,10 +1342,6 @@ void SkCanvas::concat(const SkMatrix& matrix) {
this->didConcat(matrix);
}
void SkCanvas::didSetMatrix(const SkMatrix&) {
// Do nothing. Subclasses may do something.
}
void SkCanvas::setMatrix(const SkMatrix& matrix) {
fDeviceCMDirty = true;
fCachedLocalClipBoundsDirty = true;