1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.gallery3d.ui;
18
19import javax.microedition.khronos.opengles.GL11;
20
21public class GLCanvasMock extends GLCanvasStub {
22    // fillRect
23    int mFillRectCalled;
24    float mFillRectWidth;
25    float mFillRectHeight;
26    int mFillRectColor;
27    // drawMixed
28    int mDrawMixedCalled;
29    float mDrawMixedRatio;
30    // drawTexture;
31    int mDrawTextureCalled;
32
33    private GL11 mGL;
34
35    public GLCanvasMock(GL11 gl) {
36        mGL = gl;
37    }
38
39    public GLCanvasMock() {
40        mGL = new GLStub();
41    }
42
43    @Override
44    public GL11 getGLInstance() {
45        return mGL;
46    }
47
48    @Override
49    public void fillRect(float x, float y, float width, float height, int color) {
50        mFillRectCalled++;
51        mFillRectWidth = width;
52        mFillRectHeight = height;
53        mFillRectColor = color;
54    }
55
56    @Override
57    public void drawTexture(
58                BasicTexture texture, int x, int y, int width, int height) {
59        mDrawTextureCalled++;
60    }
61
62    @Override
63    public void drawMixed(BasicTexture from, BasicTexture to,
64            float ratio, int x, int y, int w, int h) {
65        mDrawMixedCalled++;
66        mDrawMixedRatio = ratio;
67    }
68}
69