/* * Copyright 2006 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.
*/
bool SkPaint::canComputeFastBounds() const { if (this->getImageFilter() && !this->getImageFilter()->canComputeFastBounds()) { returnfalse;
} // Pass nullptr for the bounds to determine if they can be computed if (this->getPathEffect() &&
!as_PEB(this->getPathEffect())->computeFastBounds(nullptr)) { returnfalse;
} returntrue;
}
const SkRect& SkPaint::computeFastBounds(const SkRect& orig, SkRect* storage) const { // Things like stroking, etc... will do math on the bounds rect, assuming that it's sorted.
SkASSERT(orig.isSorted());
SkPaint::Style style = this->getStyle(); // ultra fast-case: filling with no effects that affect geometry if (kFill_Style == style) {
uintptr_t effects = 0;
effects |= reinterpret_cast<uintptr_t>(this->getMaskFilter());
effects |= reinterpret_cast<uintptr_t>(this->getPathEffect());
effects |= reinterpret_cast<uintptr_t>(this->getImageFilter()); if (!effects) { return orig;
}
}
// return true if the filter exists, and may affect alpha staticbool affects_alpha(const SkColorFilter* cf) { return cf && !as_CFB(cf)->isAlphaUnchanged();
}
// return true if the filter exists, and may affect alpha staticbool affects_alpha(const SkImageFilter* imf) { // TODO: check if we should allow imagefilters to broadcast that they don't affect alpha // ala colorfilters return imf != nullptr;
}
bool SkPaint::nothingToDraw() const { auto bm = this->asBlendMode(); if (!bm) { returnfalse;
} switch (bm.value()) { case SkBlendMode::kSrcOver: case SkBlendMode::kSrcATop: case SkBlendMode::kDstOut: case SkBlendMode::kDstOver: case SkBlendMode::kPlus: if (0 == this->getAlpha()) { return !affects_alpha(fColorFilter.get()) && !affects_alpha(fImageFilter.get());
} break; case SkBlendMode::kDst: returntrue; default: break;
} returnfalse;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.