aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-15 13:58:07 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-15 13:58:07 +0000
commitf69a11b5c5dc5ae02489dfe7ca6432d641b9f121 (patch)
tree8b0a0ede812aba446e88dc7fc76f6dd01cf38637
parent14ca1d33bc346c93c1ec88f8055b35a583b73303 (diff)
Use GrAARectRenderer in GPU AA clip mask generation
-rw-r--r--include/gpu/GrContext.h6
-rw-r--r--src/gpu/GrAARectRenderer.cpp6
-rw-r--r--src/gpu/GrClipMaskManager.cpp42
3 files changed, 18 insertions, 36 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 1c7cb865c3..ee6130b13d 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -254,6 +254,8 @@ public:
const GrRenderTarget* getRenderTarget() const;
GrRenderTarget* getRenderTarget();
+ GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; }
+
/**
* Can the provided configuration act as a color render target?
*/
@@ -705,9 +707,9 @@ private:
GrIndexBufferAllocPool* fDrawBufferIBAllocPool;
GrInOrderDrawBuffer* fDrawBuffer;
- GrContext(GrGpu* gpu);
+ GrAARectRenderer* fAARectRenderer;
- GrAARectRenderer* fAARectRenderer;
+ GrContext(GrGpu* gpu);
void setupDrawBuffer();
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index a771532b41..5df5efb81a 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -108,9 +108,9 @@ GrIndexBuffer* GrAARectRenderer::aaStrokeRectIndexBuffer(GrGpu* gpu) {
}
void GrAARectRenderer::fillAARect(GrGpu* gpu,
- GrDrawTarget* target,
- const GrRect& devRect,
- bool useVertexCoverage) {
+ GrDrawTarget* target,
+ const GrRect& devRect,
+ bool useVertexCoverage) {
GrVertexLayout layout = aa_rect_layout(target, useVertexCoverage);
size_t vsize = GrDrawTarget::VertexSize(layout);
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 28ce46d27e..1cb9dc456c 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -96,31 +96,14 @@ bool GrClipMaskManager::useSWOnlyPath(GrGpu* gpu, const GrClip& clipIn) {
useSW = false;
}
- if (kRect_ClipType == clipIn.getElementType(i)) {
- // Non-anti-aliased rects can always be drawn directly (w/o
- // using the software path) so the anti-aliased rects are all
- // that need to be checked here
- if (clipIn.getDoAA(i)) {
- // Antialiased rects are converted to paths and then drawn with
- // kEvenOdd_GrPathFill.
-
- // TODO: wrap GrContext::fillAARect in a helper class and
- // draw AA rects directly rather than converting to paths
- SkPath temp;
- temp.addRect(clipIn.getRect(i));
-
- if (path_needs_SW_renderer(this->getContext(), gpu, temp,
- kEvenOdd_GrPathFill, true)) {
- useSW = true;
- }
- }
- } else {
- if (path_needs_SW_renderer(this->getContext(), gpu,
- clipIn.getPath(i),
- clipIn.getPathFill(i),
- clipIn.getDoAA(i))) {
- useSW = true;
- }
+ // rects can always be drawn directly w/o using the software path
+ // so only paths need to be checked
+ if (kPath_ClipType == clipIn.getElementType(i) &&
+ path_needs_SW_renderer(this->getContext(), gpu,
+ clipIn.getPath(i),
+ clipIn.getPathFill(i),
+ clipIn.getDoAA(i))) {
+ useSW = true;
}
}
@@ -414,12 +397,9 @@ bool GrClipMaskManager::drawClipShape(GrGpu* gpu,
if (kRect_ClipType == clipIn.getElementType(index)) {
if (clipIn.getDoAA(index)) {
- // convert the rect to a path for AA
- SkPath temp;
- temp.addRect(clipIn.getRect(index));
-
- return draw_path(this->getContext(), gpu, temp,
- kEvenOdd_GrPathFill, clipIn.getDoAA(index));
+ getContext()->getAARectRenderer()->fillAARect(gpu, gpu,
+ clipIn.getRect(index),
+ true);
} else {
gpu->drawSimpleRect(clipIn.getRect(index), NULL, 0);
}