6package org.mozilla.gecko.gfx;
8import android.graphics.Rect;
9import android.graphics.RectF;
10import android.graphics.Region;
14import java.nio.FloatBuffer;
15import java.util.concurrent.locks.ReentrantLock;
47 throw new RuntimeException(
"draw() called while transaction lock held by this " +
116 throw new RuntimeException(
"setPosition() is only valid inside a transaction");
132 throw new RuntimeException(
"setResolution() is only valid inside a transaction");
163 Rect cropRect,
float texWidth,
float texHeight) {
165 dest[0] = rect.left / viewWidth;
166 dest[1] = rect.bottom / viewHeight;
168 dest[3] = cropRect.left / texWidth;
169 dest[4] = cropRect.top / texHeight;
171 dest[5] = rect.left / viewWidth;
172 dest[6] = rect.top / viewHeight;
174 dest[8] = cropRect.left / texWidth;
175 dest[9] = cropRect.bottom / texHeight;
177 dest[10] = rect.right / viewWidth;
178 dest[11] = rect.bottom / viewHeight;
180 dest[13] = cropRect.right / texWidth;
181 dest[14] = cropRect.top / texHeight;
183 dest[15] = rect.right / viewWidth;
184 dest[16] = rect.top / viewHeight;
186 dest[18] = cropRect.right / texWidth;
187 dest[19] = cropRect.bottom / texHeight;
199 int aPositionHandle,
int aTextureHandle, FloatBuffer aCoordBuffer) {
final FloatBuffer coordBuffer
RenderContext(RectF aViewport, RectF aPageRect, float aZoomFactor, int aPositionHandle, int aTextureHandle, FloatBuffer aCoordBuffer)
boolean fuzzyEquals(RenderContext other)
final ReentrantLock mTransactionLock
void endTransaction()
Call this when you're done modifying the layer.
boolean inTransaction()
Returns true if the layer is currently in a transaction and false otherwise.
void performUpdates(RenderContext context)
Subclasses may override this method to perform custom layer updates.
void beginTransaction()
Call this before modifying the layer.
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.
void setResolution(float newResolution)
Sets the layer resolution.
float getResolution()
Returns the current layer's resolution.
abstract void draw(RenderContext context)
Subclasses override this function to draw the layer.
final boolean update(RenderContext context)
Updates the layer.
boolean mUsesDefaultProgram
RectF getBounds(RenderContext context)
Given the intrinsic size of the layer, returns the pixel boundaries of the layer rect.
Rect getPosition()
Returns the current layer position.
Region getValidRegion(RenderContext context)
Returns the region of the layer that is considered valid.
boolean usesDefaultProgram()
void setPosition(Rect newPosition)
Sets the position.
static RectF scale(RectF rect, float scale)
static Rect round(RectF rect)
Returns the nearest integer rect of the given rect.
static boolean fuzzyEquals(RectF a, RectF b)
static boolean fuzzyEquals(float a, float b)