summaryrefslogtreecommitdiffstats
path: root/libs/hwui/DisplayListRenderer.cpp
diff options
context:
space:
mode:
authorTom Hudson <tomhudson@google.com>2014-10-10 13:38:16 -0400
committerTom Hudson <tomhudson@google.com>2014-11-04 17:16:36 -0500
commit984162fb7e4010b6e2908352dbff17ed47eecf06 (patch)
tree0b15f1e5bdd1485862dd1f9098e4c94bc033df77 /libs/hwui/DisplayListRenderer.cpp
parenta5545d24c7289c25707ffa8704b57a37cea6535a (diff)
downloadframeworks_base-984162fb7e4010b6e2908352dbff17ed47eecf06.zip
frameworks_base-984162fb7e4010b6e2908352dbff17ed47eecf06.tar.gz
frameworks_base-984162fb7e4010b6e2908352dbff17ed47eecf06.tar.bz2
Replace StatefulBaseRenderer inheritance with CanvasState member
Incrementally disentangles DisplayListRenderer and OpenGLRenderer. Introduces abstract CanvasStateClient class to share three functions between the two. Design doc at https://docs.google.com/a/google.com/document/d/1PY1JF7AfPEF2UOUAnETS5j_4_tnJShTAMExvpCJfP8o/edit?usp=sharing. BUG:15672762 R=djsollen@google.com,ccraik@google.com,jreck@google.com Change-Id: Ic9fdffe18808e7d921ad06d01ea1ca25b2ad6f23
Diffstat (limited to 'libs/hwui/DisplayListRenderer.cpp')
-rw-r--r--libs/hwui/DisplayListRenderer.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index ab9ca1f..c0b8a56 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -32,7 +32,8 @@ namespace android {
namespace uirenderer {
DisplayListRenderer::DisplayListRenderer()
- : mCaches(Caches::getInstance())
+ : mState(*this)
+ , mCaches(Caches::getInstance())
, mDisplayListData(NULL)
, mTranslateX(0.0f)
, mTranslateY(0.0f)
@@ -66,10 +67,10 @@ void DisplayListRenderer::prepareDirty(float left, float top,
"prepareDirty called a second time during a recording!");
mDisplayListData = new DisplayListData();
- initializeSaveStack(0, 0, getWidth(), getHeight(), Vector3());
+ mState.initializeSaveStack(0, 0, mState.getWidth(), mState.getHeight(), Vector3());
mDeferredBarrierType = kBarrier_InOrder;
- mDirtyClip = opaque;
+ mState.setDirtyClip(opaque);
mRestoreSaveCount = -1;
}
@@ -93,7 +94,7 @@ void DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) {
int DisplayListRenderer::save(int flags) {
addStateOp(new (alloc()) SaveOp(flags));
- return StatefulBaseRenderer::save(flags);
+ return mState.save(flags);
}
void DisplayListRenderer::restore() {
@@ -104,13 +105,13 @@ void DisplayListRenderer::restore() {
mRestoreSaveCount--;
flushTranslate();
- StatefulBaseRenderer::restore();
+ mState.restore();
}
void DisplayListRenderer::restoreToCount(int saveCount) {
mRestoreSaveCount = saveCount;
flushTranslate();
- StatefulBaseRenderer::restoreToCount(saveCount);
+ mState.restoreToCount(saveCount);
}
int DisplayListRenderer::saveLayer(float left, float top, float right, float bottom,
@@ -120,7 +121,7 @@ int DisplayListRenderer::saveLayer(float left, float top, float right, float bot
paint = refPaint(paint);
addStateOp(new (alloc()) SaveLayerOp(left, top, right, bottom, paint, flags));
- return StatefulBaseRenderer::save(flags);
+ return mState.save(flags);
}
void DisplayListRenderer::translate(float dx, float dy, float dz) {
@@ -129,50 +130,50 @@ void DisplayListRenderer::translate(float dx, float dy, float dz) {
mTranslateX += dx;
mTranslateY += dy;
flushRestoreToCount();
- StatefulBaseRenderer::translate(dx, dy, dz);
+ mState.translate(dx, dy, dz);
}
void DisplayListRenderer::rotate(float degrees) {
addStateOp(new (alloc()) RotateOp(degrees));
- StatefulBaseRenderer::rotate(degrees);
+ mState.rotate(degrees);
}
void DisplayListRenderer::scale(float sx, float sy) {
addStateOp(new (alloc()) ScaleOp(sx, sy));
- StatefulBaseRenderer::scale(sx, sy);
+ mState.scale(sx, sy);
}
void DisplayListRenderer::skew(float sx, float sy) {
addStateOp(new (alloc()) SkewOp(sx, sy));
- StatefulBaseRenderer::skew(sx, sy);
+ mState.skew(sx, sy);
}
void DisplayListRenderer::setMatrix(const SkMatrix& matrix) {
addStateOp(new (alloc()) SetMatrixOp(matrix));
- StatefulBaseRenderer::setMatrix(matrix);
+ mState.setMatrix(matrix);
}
void DisplayListRenderer::concatMatrix(const SkMatrix& matrix) {
addStateOp(new (alloc()) ConcatMatrixOp(matrix));
- StatefulBaseRenderer::concatMatrix(matrix);
+ mState.concatMatrix(matrix);
}
bool DisplayListRenderer::clipRect(float left, float top, float right, float bottom,
SkRegion::Op op) {
addStateOp(new (alloc()) ClipRectOp(left, top, right, bottom, op));
- return StatefulBaseRenderer::clipRect(left, top, right, bottom, op);
+ return mState.clipRect(left, top, right, bottom, op);
}
bool DisplayListRenderer::clipPath(const SkPath* path, SkRegion::Op op) {
path = refPath(path);
addStateOp(new (alloc()) ClipPathOp(path, op));
- return StatefulBaseRenderer::clipPath(path, op);
+ return mState.clipPath(path, op);
}
bool DisplayListRenderer::clipRegion(const SkRegion* region, SkRegion::Op op) {
region = refRegion(region);
addStateOp(new (alloc()) ClipRegionOp(region, op));
- return StatefulBaseRenderer::clipRegion(region, op);
+ return mState.clipRegion(region, op);
}
void DisplayListRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t flags) {
@@ -180,7 +181,7 @@ void DisplayListRenderer::drawRenderNode(RenderNode* renderNode, Rect& dirty, in
// dirty is an out parameter and should not be recorded,
// it matters only when replaying the display list
- DrawRenderNodeOp* op = new (alloc()) DrawRenderNodeOp(renderNode, flags, *currentTransform());
+ DrawRenderNodeOp* op = new (alloc()) DrawRenderNodeOp(renderNode, flags, *mState.currentTransform());
addRenderNodeOp(op);
}