bool SortConfig::operator()(const Config &x, const Config &y) const { #define SORT(attribute) \ if (x.attribute != y.attribute) \ { \ return x.attribute < y.attribute; \ } META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG); SORT(mConfigCaveat); META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER); SORT(mColorBufferType); // By larger total number of color bits, only considering those that are requested to be > 0. EGLint xComponentsSize = wantedComponentsSize(x); EGLint yComponentsSize = wantedComponentsSize(y); if (xComponentsSize != yComponentsSize) { return xComponentsSize > yComponentsSize; } SORT(mBufferSize); SORT(mSampleBuffers); SORT(mSamples); SORT(mDepthSize); SORT(mStencilSize); SORT(mAlphaMaskSize); SORT(mNativeVisualType); SORT(mConfigID); #undef SORT return false; }
bool operator()(const Config &x, const Config &y) const { #define SORT(attribute) \ if (x.attribute != y.attribute) \ { \ return x.attribute < y.attribute; \ } static_assert(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG, "Unexpected EGL enum value."); SORT(configCaveat); static_assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER, "Unexpected EGL enum value."); SORT(colorBufferType); // By larger total number of color bits, only considering those that are requested to be > 0. EGLint xComponentsSize = wantedComponentsSize(x); EGLint yComponentsSize = wantedComponentsSize(y); if (xComponentsSize != yComponentsSize) { return xComponentsSize > yComponentsSize; } SORT(bufferSize); SORT(sampleBuffers); SORT(samples); SORT(depthSize); SORT(stencilSize); SORT(alphaMaskSize); SORT(nativeVisualType); SORT(configID); #undef SORT return false; }