6package org.mozilla.gecko.gfx;
8import android.graphics.Rect;
9import android.graphics.RectF;
10import android.graphics.Region;
11import android.graphics.RegionIterator;
12import android.opengl.GLES20;
13import android.util.Log;
17import java.nio.ByteBuffer;
18import java.nio.FloatBuffer;
46 mBounds =
new RectF();
125 throw new RuntimeException(
"invalidate() is only valid inside a transaction");
147 super.performUpdates(context);
158 if (imageBuffer ==
null) {
174 GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, glInfo.
internalFormat,
181 GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
182 GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,
mTextureIDs[0]);
184 GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
185 GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
186 GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
187 GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
234 GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
235 GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,
getTextureID());
238 coordBuffer.position(0);
242 GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
245 coordBuffer.position(0);
246 GLES20.glVertexAttribPointer(positionHandle, 3, GLES20.GL_FLOAT,
false, 20, coordBuffer);
249 coordBuffer.position(3);
250 GLES20.glVertexAttribPointer(textureHandle, 2, GLES20.GL_FLOAT,
false, 20, coordBuffer);
251 GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
Identifies the tile by its position (x and y coordinate on the document), zoom and tile size (current...
Information needed to render Cairo bitmaps using OpenGL ES.
abstract ByteBuffer getBuffer()
abstract IntSize getSize()
boolean equals(IntSize size)
static int nextPowerOfTwo(int value)
final FloatBuffer coordBuffer
boolean inTransaction()
Returns true if the layer is currently in a transaction and false otherwise.
final void fillRectCoordBuffer(float[] dest, RectF rect, float viewWidth, float viewHeight, Rect cropRect, float texWidth, float texHeight)
This function fills in the provided dest array with values to render a texture.
RectF getBounds(RenderContext context)
Given the intrinsic size of the layer, returns the pixel boundaries of the layer rect.
void setPosition(Rect newPosition)
Sets the position.
void setImage(CairoImage image)
void performUpdates(RenderContext context)
Subclasses may override this method to perform custom layer updates.
void validateTexture()
Remove the texture if the image is of different size than the current uploaded texture.
final Region mMaskedBounds
void draw(RenderContext context)
Subclasses override this function to draw the layer.
SubTile(TileIdentifier id)
final RectF mTextureBounds
void bindAndSetGLParameters()
void refreshTileMetrics()
void invalidate()
Invalidates the entire buffer so that it will be uploaded again.
Manages a list of dead tiles, so we don't leak resources.
static TextureReaper get()
void add(int[] textureIDs)