diff options
| author | Romain Guy <romainguy@google.com> | 2010-10-12 15:59:26 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2010-10-12 15:59:26 -0700 |
| commit | 4bb942083a0d4db746adf95349108dd8ef842e32 (patch) | |
| tree | 7707bc9551f3db4ad0561c30c73293e4a0edfbf2 /libs/hwui/utils | |
| parent | 5a3b8e698e276839e502dcf41894b56ad59695c3 (diff) | |
| download | frameworks_base-4bb942083a0d4db746adf95349108dd8ef842e32.zip frameworks_base-4bb942083a0d4db746adf95349108dd8ef842e32.tar.gz frameworks_base-4bb942083a0d4db746adf95349108dd8ef842e32.tar.bz2 | |
Optimize 9patch rendering.
This change detects empty quads in 9patches and removes them from
the mesh to avoid unnecessary blending.
Change-Id: I4500566fb4cb6845d64dcb59b522c0be7a0ec704
Diffstat (limited to 'libs/hwui/utils')
| -rw-r--r-- | libs/hwui/utils/Compare.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libs/hwui/utils/Compare.h b/libs/hwui/utils/Compare.h new file mode 100644 index 0000000..754b470 --- /dev/null +++ b/libs/hwui/utils/Compare.h @@ -0,0 +1,40 @@ +/* + * 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 |
