// Path: opengl/src/main/java/com/doctoror/particlesdrawable/opengl/util/PotCalculator.java
// public final class PotCalculator {
// 
//     private PotCalculator() {
// 
//     }
// 
//     public static boolean isPowerOfTwo(final int number) {
//         return number > 0 && ((number & (number - 1)) == 0);
//     }
// 
//     public static int findNextOrReturnIfPowerOfTwo(int n) {
//         if (n <= 0) {
//             return 1;
//         }
//         if (isPowerOfTwo(n)) {
//             return n;
//         }
//         n--;
//         n |= n >> 1;
//         n |= n >> 2;
//         n |= n >> 4;
//         n |= n >> 8;
//         n |= n >> 16;
//         n++;
//         return n;
//     }
// }


import com.doctoror.particlesdrawable.opengl.util.PotCalculator;
import javax.microedition.khronos.egl.EGL10;
import androidx.annotation.Nullable;
/*
 * Copyright (C) 2018 Yaroslav Mytkalyk
 *
 * 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.
 */
package com.doctoror.particlesdrawable.opengl.chooser;




final class MultisamplingConfigChooser extends BaseConfigChooser {

    MultisamplingConfigChooser(
            final int samples,
            @Nullable final EGLConfigChooserCallback callback) {
        super("MultisamplingConfigChooser", makeConfigSpec(samples), callback);
    }

    private static int[] makeConfigSpec(final int samples) {
        if (samples <= 1) {
            throw new IllegalArgumentException("samples must be > 1");
        }

// Path: opengl/src/main/java/com/doctoror/particlesdrawable/opengl/util/PotCalculator.java
// public final class PotCalculator {
// 
//     private PotCalculator() {
// 
//     }
// 
//     public static boolean isPowerOfTwo(final int number) {
//         return number > 0 && ((number & (number - 1)) == 0);
//     }
// 
//     public static int findNextOrReturnIfPowerOfTwo(int n) {
//         if (n <= 0) {
//             return 1;
//         }
//         if (isPowerOfTwo(n)) {
//             return n;
//         }
//         n--;
//         n |= n >> 1;
//         n |= n >> 2;
//         n |= n >> 4;
//         n |= n >> 8;
//         n |= n >> 16;
//         n++;
//         return n;
//     }
// }


// Path: opengl/src/main/java/com/doctoror/particlesdrawable/opengl/chooser/MultisamplingConfigChooser.java
import com.doctoror.particlesdrawable.opengl.util.PotCalculator;
import javax.microedition.khronos.egl.EGL10;
import androidx.annotation.Nullable;

/*
 * Copyright (C) 2018 Yaroslav Mytkalyk
 *
 * 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.
 */
package com.doctoror.particlesdrawable.opengl.chooser;




final class MultisamplingConfigChooser extends BaseConfigChooser {

    MultisamplingConfigChooser(
            final int samples,
            @Nullable final EGLConfigChooserCallback callback) {
        super("MultisamplingConfigChooser", makeConfigSpec(samples), callback);
    }

    private static int[] makeConfigSpec(final int samples) {
        if (samples <= 1) {
            throw new IllegalArgumentException("samples must be > 1");
        }

        if (!PotCalculator.isPowerOfTwo(samples)) {