aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-26 21:37:40 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-26 21:37:40 +0000
commite4d69c0e46c1a000eb89ef950bdaf0aea680a816 (patch)
tree79e686956e5dc1bfdf0d7743913310a3875f09e7 /src/gpu
parent99547767e9cdabcdae6a575f0f6bfde01d809865 (diff)
Added getConservativeBound helper function to GrClipData
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.cpp5
-rw-r--r--src/gpu/GrClip.cpp13
-rw-r--r--src/gpu/GrClipMaskManager.cpp25
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp5
-rw-r--r--src/gpu/gl/GrGpuGL_program.cpp3
5 files changed, 19 insertions, 32 deletions
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 988cfa7584..13d61554bd 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -512,10 +512,7 @@ bool GrAAHairLinePathRenderer::createGeom(
int rtHeight = drawState.getRenderTarget()->height();
GrIRect clip;
-
- const GrClipData* clipData = target->getClip();
- GrRect conservativeBounds = clipData->fClipStack->getConservativeBounds();
- conservativeBounds.roundOut(&clip);
+ target->getClip()->getConservativeBounds(drawState.getRenderTarget(), &clip);
GrVertexLayout layout = GrDrawTarget::kEdge_VertexLayoutBit;
GrMatrix viewM = drawState.getViewMatrix();
diff --git a/src/gpu/GrClip.cpp b/src/gpu/GrClip.cpp
index ace765f6cb..d75dd264a2 100644
--- a/src/gpu/GrClip.cpp
+++ b/src/gpu/GrClip.cpp
@@ -9,6 +9,8 @@
#include "GrClip.h"
+#include "GrSurface.h"
+#include "GrRect.h"
GrClip::GrClip()
: fRequiresAA(false) {
@@ -247,3 +249,14 @@ void GrClip::Iter::reset(const GrClip& stack, IterStart startLoc) {
fCurIndex = fStack->getElementCount()-1;
}
}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void GrClipData::getConservativeBounds(const GrSurface* surface,
+ GrIRect* result,
+ bool* isIntersectionOfRects) const {
+
+ const GrRect& conservativeBounds = fClipStack->getConservativeBounds();
+ conservativeBounds.roundOut(result);
+}
+
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index a3c8537737..ea5a2cd693 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -147,16 +147,9 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn) {
GrAssert(NULL != rt);
GrIRect bounds;
- GrIRect rtRect;
- rtRect.setLTRB(0, 0, rt->width(), rt->height());
+ bool isIntersectionOfRects = false;
-
- GrRect conservativeBounds = clipDataIn->fClipStack->getConservativeBounds();
-
- conservativeBounds.roundOut(&bounds);
- if (!bounds.intersect(rtRect)) {
- bounds.setEmpty();
- }
+ clipDataIn->getConservativeBounds(rt, &bounds, &isIntersectionOfRects);
if (bounds.isEmpty()) {
return false;
}
@@ -542,22 +535,10 @@ bool GrClipMaskManager::clipMaskPreamble(const GrClipData& clipDataIn,
GrRenderTarget* rt = origDrawState->getRenderTarget();
GrAssert(NULL != rt);
- GrRect rtRect;
- rtRect.setLTRB(0, 0,
- GrIntToScalar(rt->width()), GrIntToScalar(rt->height()));
-
// unlike the stencil path the alpha path is not bound to the size of the
// render target - determine the minimum size required for the mask
- GrRect bounds = clipDataIn.fClipStack->getConservativeBounds();
-
- if (!bounds.intersect(rtRect)) {
- // the mask will be empty in this case
- GrAssert(false);
- bounds.setEmpty();
- }
-
GrIRect intBounds;
- bounds.roundOut(&intBounds);
+ clipDataIn.getConservativeBounds(rt, &intBounds);
// need to outset a pixel since the standard bounding box computation
// path doesn't leave any room for antialiasing (esp. w.r.t. rects)
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 0bf1cab46a..5b570b4b74 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -46,10 +46,7 @@ bool get_path_and_clip_bounds(const GrDrawTarget* target,
}
*pathBounds = GrIRect::MakeWH(rt->width(), rt->height());
- const GrClipData* clipData = target->getClip();
-
- SkRect conservativeBounds = clipData->fClipStack->getConservativeBounds();
- conservativeBounds.roundOut(clipBounds);
+ target->getClip()->getConservativeBounds(rt, clipBounds);
if (!pathBounds->intersect(*clipBounds)) {
return false;
}
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index b7ae6c71df..d87467280b 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -436,8 +436,7 @@ bool GrGpuGL::flushGraphicsState(DrawType type) {
GrIRect* rect = NULL;
GrIRect clipBounds;
if (drawState.isClipState()) {
- GrRect conservativeBounds = fClip->fClipStack->getConservativeBounds();
- conservativeBounds.roundOut(&clipBounds);
+ fClip->getConservativeBounds(drawState.getRenderTarget(), &clipBounds);
rect = &clipBounds;
}
// This must come after textures are flushed because a texture may need