Add an OR operator overload for SaveFlags to avoid extra static casts.

R=reed@google.com

Author: djsollen@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@15005 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-05-30 20:41:20 +00:00
parent 999cfd1076
commit 2a5cd60bff
3 changed files with 14 additions and 3 deletions

View File

@ -1512,4 +1512,16 @@ private:
size_t fRowBytes;
};
static inline SkCanvas::SaveFlags operator|(const SkCanvas::SaveFlags lhs,
const SkCanvas::SaveFlags rhs) {
return static_cast<SkCanvas::SaveFlags>(lhs | rhs);
}
static inline SkCanvas::SaveFlags& operator|=(SkCanvas::SaveFlags& lhs,
const SkCanvas::SaveFlags rhs) {
lhs = lhs | rhs;
return lhs;
}
#endif

View File

@ -913,7 +913,7 @@ static SkBaseDevice* create_compatible_device(SkCanvas* canvas,
int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags,
bool justForImageFilter, SaveLayerStrategy strategy) {
#ifndef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
flags = (SaveFlags)(flags | kClipToLayer_SaveFlag);
flags |= kClipToLayer_SaveFlag;
#endif
// do this before we create the layer. We don't call the public save() since

View File

@ -172,8 +172,7 @@ int SkMatrixClipStateMgr::saveLayer(const SkRect* bounds, const SkPaint* paint,
// restore
fSkipOffsets = SkNEW(SkTDArray<int>);
fPicRecord->recordSaveLayer(bounds, paint,
(SkCanvas::SaveFlags)(flags| SkCanvas::kMatrixClip_SaveFlag));
fPicRecord->recordSaveLayer(bounds, paint, flags | SkCanvas::kMatrixClip_SaveFlag);
#ifdef SK_DEBUG
fActualDepth++;
#endif