Merge "Remove two macros" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9ab8e869bc
@@ -54,7 +54,7 @@ SkBlendMode Layer::getMode() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline SkScalar isIntegerAligned(SkScalar x) {
|
static inline SkScalar isIntegerAligned(SkScalar x) {
|
||||||
return fabsf(roundf(x) - x) <= NON_ZERO_EPSILON;
|
return MathUtils::isZero(roundf(x) - x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable filtering when there is no scaling in screen coordinates and the corners have the same
|
// Disable filtering when there is no scaling in screen coordinates and the corners have the same
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ void LayerDrawable::onDraw(SkCanvas* canvas) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline SkScalar isIntegerAligned(SkScalar x) {
|
static inline SkScalar isIntegerAligned(SkScalar x) {
|
||||||
return fabsf(roundf(x) - x) <= NON_ZERO_EPSILON;
|
return MathUtils::isZero(roundf(x) - x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable filtering when there is no scaling in screen coordinates and the corners have the same
|
// Disable filtering when there is no scaling in screen coordinates and the corners have the same
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void StartReorderBarrierDrawable::onDraw(SkCanvas* canvas) {
|
|||||||
RenderNodeDrawable* childNode = mChildren[drawIndex];
|
RenderNodeDrawable* childNode = mChildren[drawIndex];
|
||||||
SkASSERT(childNode);
|
SkASSERT(childNode);
|
||||||
const float casterZ = childNode->getNodeProperties().getZ();
|
const float casterZ = childNode->getNodeProperties().getZ();
|
||||||
if (casterZ >= -NON_ZERO_EPSILON) { // draw only children with negative Z
|
if (casterZ >= -MathUtils::NON_ZERO_EPSILON) { // draw only children with negative Z
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SkAutoCanvasRestore acr(canvas, true);
|
SkAutoCanvasRestore acr(canvas, true);
|
||||||
@@ -86,7 +86,7 @@ void EndReorderBarrierDrawable::onDraw(SkCanvas* canvas) {
|
|||||||
|
|
||||||
const size_t endIndex = zChildren.size();
|
const size_t endIndex = zChildren.size();
|
||||||
while (drawIndex < endIndex // draw only children with positive Z
|
while (drawIndex < endIndex // draw only children with positive Z
|
||||||
&& zChildren[drawIndex]->getNodeProperties().getZ() <= NON_ZERO_EPSILON)
|
&& zChildren[drawIndex]->getNodeProperties().getZ() <= MathUtils::NON_ZERO_EPSILON)
|
||||||
drawIndex++;
|
drawIndex++;
|
||||||
size_t shadowIndex = drawIndex;
|
size_t shadowIndex = drawIndex;
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
namespace android {
|
namespace android {
|
||||||
namespace uirenderer {
|
namespace uirenderer {
|
||||||
|
|
||||||
#define NON_ZERO_EPSILON (0.001f)
|
|
||||||
#define ALPHA_EPSILON (0.001f)
|
|
||||||
|
|
||||||
class MathUtils {
|
class MathUtils {
|
||||||
public:
|
public:
|
||||||
|
static constexpr float NON_ZERO_EPSILON = 0.001f;
|
||||||
|
static constexpr float ALPHA_EPSILON = 0.001f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for floats that are close enough to zero.
|
* Check for floats that are close enough to zero.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user