2 * Copyright (C) 2012 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.gallery3d.ui;
19 import android.graphics.Bitmap;
20 import android.graphics.RectF;
22 import com.android.gallery3d.glrenderer.BitmapTexture;
23 import com.android.gallery3d.glrenderer.GLCanvas;
25 public class BitmapScreenNail implements ScreenNail {
26 private final BitmapTexture mBitmapTexture;
28 public BitmapScreenNail(Bitmap bitmap) {
29 mBitmapTexture = new BitmapTexture(bitmap);
33 public int getWidth() {
34 return mBitmapTexture.getWidth();
38 public int getHeight() {
39 return mBitmapTexture.getHeight();
43 public void draw(GLCanvas canvas, int x, int y, int width, int height) {
44 mBitmapTexture.draw(canvas, x, y, width, height);
48 public void noDraw() {
53 public void recycle() {
54 mBitmapTexture.recycle();
58 public void draw(GLCanvas canvas, RectF source, RectF dest) {
59 canvas.drawTexture(mBitmapTexture, source, dest);