CPD Results

The following document contains the results of PMD's CPD 5.2.1.

Duplications

File Line
org/newdawn/slick/opengl/pbuffer/PBufferGraphics.java 126
org/newdawn/slick/opengl/pbuffer/PBufferUniqueGraphics.java 121
        TextureImpl.unbind();
        initGL();
    }

    /**
     * Initialise the GL context
     */
    void initGL() {
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_LIGHTING);
        
        GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        GL11.glClearDepth(1);                                       
        
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        
        GL11.glViewport(0,0,screenWidth,screenHeight);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();

        enterOrtho();
    }

    /**
     * Enter the orthographic mode
     */
    void enterOrtho() {
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        GL11.glOrtho(0, screenWidth, 0, screenHeight, 1, -1);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
    }

    /** glOrtho is called with (0, screenWidth, 0, screenHeight, 1, -1) meaning the Y value is flipped */
    protected boolean isYFlipped() {
        return true;
    }

    /**
     * @see org.newdawn.slick.Graphics#destroy()
     */
    public void destroy() {
        super.destroy();

        pbuffer.destroy();
    }

    /**
     * @see org.newdawn.slick.Graphics#flush()
     */
    public void flush() {
        super.flush();

        image.flushPixelData();
    }
}
File Line
org/newdawn/slick/opengl/pbuffer/FBOGraphics.java 184
org/newdawn/slick/opengl/pbuffer/PBufferGraphics.java 126
org/newdawn/slick/opengl/pbuffer/PBufferUniqueGraphics.java 121
        bind();
        initGL();
    }

    /**
     * Initialise the GL context
     */
    void initGL() {
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_LIGHTING);
        
        GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        GL11.glClearDepth(1);                                       
        
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        
        GL11.glViewport(0,0,screenWidth,screenHeight);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();

        enterOrtho();
    }

    /**
     * Enter the orthographic mode
     */
    void enterOrtho() {
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        GL11.glOrtho(0, screenWidth, 0, screenHeight, 1, -1);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
    }

    /** glOrtho is called with (0, screenWidth, 0, screenHeight, 1, -1) meaning the Y value is flipped */
    protected boolean isYFlipped() {
        return true;
    }

    /**
     * @see org.newdawn.slick.Graphics#destroy()
     */
    public void destroy() {
        super.destroy();
File Line
org/newdawn/slick/UnicodeFont.java 742
org/newdawn/slick/font/HieroSettings.java 136
    }

    /**
     * Returns the padding above a glyph on the GlyphPage to allow for effects to be drawn.
     *
     * @return The padding at the top of the glyphs when drawn
     */
    public int getPaddingTop() {
        return paddingTop;
    }

    /**
     * Sets the padding above a glyph on the GlyphPage to allow for effects to be drawn.
     *
     * @param paddingTop The padding at the top of the glyphs when drawn
     */
    public void setPaddingTop(int paddingTop) {
        this.paddingTop = paddingTop;
    }

    /**
     * Returns the padding to the left of a glyph on the GlyphPage to allow for effects to be drawn.
     *
     * @return The padding at the left of the glyphs when drawn
     */
    public int getPaddingLeft() {
        return paddingLeft;
    }

    /**
     * Sets the padding to the left of a glyph on the GlyphPage to allow for effects to be drawn.
     *
     * @param paddingLeft The padding at the left of the glyphs when drawn
     */
    public void setPaddingLeft(int paddingLeft) {
        this.paddingLeft = paddingLeft;
    }

    /**
     * Returns the padding below a glyph on the GlyphPage to allow for effects to be drawn.
     *
     * @return The padding at the bottom of the glyphs when drawn
     */
    public int getPaddingBottom() {
        return paddingBottom;
    }

    /**
     * Sets the padding below a glyph on the GlyphPage to allow for effects to be drawn.
     *
     * @param paddingBottom The padding at the bottom of the glyphs when drawn
     */
    public void setPaddingBottom(int paddingBottom) {
        this.paddingBottom = paddingBottom;
    }

    /**
     * Returns the padding to the right of a glyph on the GlyphPage to allow for effects to be drawn.
     *
     * @return The padding at the right of the glyphs when drawn
     */
    public int getPaddingRight () {
        return paddingRight;
    }

    /**
     * Sets the padding to the right of a glyph on the GlyphPage to allow for effects to be drawn.
     *
     * @param paddingRight The padding at the right of the glyphs when drawn
     */
    public void setPaddingRight (int paddingRight) {
        this.paddingRight = paddingRight;
    }

    /**
     * Gets the additional amount to offset glyphs on the x axis.
     *
     * @return The padding applied for each horizontal advance (i.e. when a glyph is rendered)
     */
    public int getPaddingAdvanceX() {
        return paddingAdvanceX;
    }

    /**
     * Sets the additional amount to offset glyphs on the x axis. This is typically set to a negative number when left or right
     * padding is used so that glyphs are not spaced too far apart.
     *
     * @param paddingAdvanceX The padding applied for each horizontal advance (i.e. when a glyph is rendered)
     */
    public void setPaddingAdvanceX (int paddingAdvanceX) {
        this.paddingAdvanceX = paddingAdvanceX;
    }

    /**
     * Gets the additional amount to offset a line of text on the y axis.
     *
     * @return The padding applied for each vertical advance (i.e. when a glyph is rendered)
     */
    public int getPaddingAdvanceY () {
        return paddingAdvanceY;
    }

    /**
     * Sets the additional amount to offset a line of text on the y axis. This is typically set to a negative number when top or
     * bottom padding is used so that lines of text are not spaced too far apart.
     *
     * @param paddingAdvanceY The padding applied for each vertical advance (i.e. when a glyph is rendered)
     */
    public void setPaddingAdvanceY (int paddingAdvanceY) {
        this.paddingAdvanceY = paddingAdvanceY;
    }

    /**
     * Returns the distance from one line of text to the next. This is the sum of the descent, ascent, leading, padding top,
     * padding bottom, and padding advance y. To change the line height, use {@link #setPaddingAdvanceY(int)}.
     */
    public int getLineHeight() {
File Line
org/newdawn/slick/Image.java 1000
org/newdawn/slick/Image.java 1092
        texture.bind();

        GL.glTranslatef(x, y, 0);
        if (angle != 0) {
            GL.glTranslatef(centerX, centerY, 0.0f);
            GL.glRotatef(angle, 0.0f, 0.0f, 1.0f);
            GL.glTranslatef(-centerX, -centerY, 0.0f);
        }

        GL.glBegin(SGL.GL_QUADS);
        drawEmbedded(0,0,width,height);
        GL.glEnd();

        if (angle != 0) {
            GL.glTranslatef(centerX, centerY, 0.0f);
            GL.glRotatef(-angle, 0.0f, 0.0f, 1.0f);
            GL.glTranslatef(-centerX, -centerY, 0.0f);
        }
        GL.glTranslatef(-x, -y, 0);
File Line
org/newdawn/slick/opengl/PNGImageData.java 137
org/newdawn/slick/opengl/TGAImageData.java 282
            }
        }
        if (width < texWidth-1) {
            for (int y=0;y<texHeight;y++) {
                for (int i=0;i<perPixel;i++) {
                    scratch.put(((y+1)*(texWidth*perPixel))-perPixel+i, scratch.get(y*(texWidth*perPixel)+i));
                    scratch.put((y*(texWidth*perPixel))+(width*perPixel)+i, scratch.get((y*(texWidth*perPixel))+((width-1)*perPixel)+i));
                }
            }
        }

        scratch.position(0);
File Line
org/newdawn/slick/geom/OverTriangulator.java 50
org/newdawn/slick/geom/OverTriangulator.java 71
                pt1[1] = (pt1[1] + pt2[1]) / 2;

                triangles[(tcount * 3)][0] = cx;
                triangles[(tcount * 3)][1] = cy;
                triangles[(tcount *3) + 1][0] = pt1[0];
                triangles[(tcount *3) + 1][1] = pt1[1];
                triangles[(tcount *3) + 2][0] = pt2[0];
                triangles[(tcount *3) + 2][1] = pt2[1];
                tcount++;
            }
File Line
org/newdawn/slick/opengl/PNGDecoder.java 442
org/newdawn/slick/opengl/PNGDecoder.java 465
org/newdawn/slick/opengl/PNGDecoder.java 488
    private void copyRGBtoABGR(@Nonnull ByteBuffer buffer, @Nonnull byte[] curLine) {
        if (transPixel != null) {
            byte tr = transPixel[1];
            byte tg = transPixel[3];
            byte tb = transPixel[5];
            for (int i = 1, n = curLine.length; i < n; i += 3) {
                byte r = curLine[i];
                byte g = curLine[i + 1];
                byte b = curLine[i + 2];
                byte a = (byte) 0xFF;
                if (r == tr && g == tg && b == tb) {
                    a = 0;
                }
                buffer.put(a).put(b).put(g).put(r);
File Line
org/newdawn/slick/Image.java 261
org/newdawn/slick/Image.java 527
    public Image(String ref, boolean flipped, int f, @Nullable Color transparent) throws SlickException {
        this.filter = f;
        try {
            this.ref = ref;
            int[] trans = null;
            if (transparent != null) {
                trans = new int[3];
                trans[0] = (int) (transparent.r * 255);
                trans[1] = (int) (transparent.g * 255);
                trans[2] = (int) (transparent.b * 255);
            }
            texture = InternalTextureLoader.get().getTexture(ref, flipped, filter, trans);