Romain Guy 4bb942083a Optimize 9patch rendering.
This change detects empty quads in 9patches and removes them from
the mesh to avoid unnecessary blending.

Change-Id: I4500566fb4cb6845d64dcb59b522c0be7a0ec704
2010-10-12 15:59:26 -07:00

41 lines
1020 B
C

/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_UI_COMPARE_H
#define ANDROID_UI_COMPARE_H
#include <cmath>
#define EPSILON 0.00001f
#define almost(u, v) (fabs((u) - (v)) < EPSILON)
/**
* Compare floats.
*/
#define compare(a) \
if (a < rhs.a) return true; \
if (almost(a, rhs.a))
/**
* Compare integers.
*/
#define compareI(a) \
if (a < rhs.a) return true; \
if (a == rhs.a)
#endif // ANDROID_UI_COMPARE_H