aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/gpu/GrClip.h8
-rw-r--r--include/gpu/GrDrawContext.h5
-rw-r--r--src/gpu/GrAtlasTextContext.cpp18
-rw-r--r--src/gpu/GrAtlasTextContext.h4
-rw-r--r--src/gpu/GrBlurUtils.cpp11
-rw-r--r--src/gpu/GrBlurUtils.h2
-rw-r--r--src/gpu/GrDrawTarget.cpp2
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp2
-rw-r--r--src/gpu/GrTextContext.cpp12
-rw-r--r--src/gpu/GrTextContext.h4
-rw-r--r--src/gpu/SkGpuDevice.cpp10
-rw-r--r--src/gpu/SkGpuDevice_drawTexture.cpp2
-rw-r--r--src/gpu/batches/GrAAHairLinePathRenderer.cpp4
-rw-r--r--src/gpu/batches/GrTessellatingPathRenderer.cpp2
-rw-r--r--tests/ClipBoundsTest.cpp2
15 files changed, 40 insertions, 48 deletions
diff --git a/include/gpu/GrClip.h b/include/gpu/GrClip.h
index f260f05cc7..18f212f962 100644
--- a/include/gpu/GrClip.h
+++ b/include/gpu/GrClip.h
@@ -9,7 +9,6 @@
#define GrClip_DEFINED
#include "SkClipStack.h"
-#include "GrSurface.h"
struct SkIRect;
@@ -157,13 +156,6 @@ public:
(kIRect_ClipType == fClipType && this->irect().contains(rect));
}
- void getConservativeBounds(const GrSurface* surface,
- SkIRect* devResult,
- bool* isIntersectionOfRects = NULL) const {
- this->getConservativeBounds(surface->width(), surface->height(),
- devResult, isIntersectionOfRects);
- }
-
void getConservativeBounds(int width, int height,
SkIRect* devResult,
bool* isIntersectionOfRects = NULL) const;
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h
index e0a9b0eedb..82cf362d57 100644
--- a/include/gpu/GrDrawContext.h
+++ b/include/gpu/GrDrawContext.h
@@ -9,6 +9,7 @@
#define GrDrawContext_DEFINED
#include "GrColor.h"
+#include "GrRenderTarget.h"
#include "SkRefCnt.h"
#include "SkSurfaceProps.h"
@@ -273,6 +274,10 @@ public:
*/
void drawBatch(const GrClip&, const GrPaint&, GrDrawBatch*);
+ int width() const { return fRenderTarget->width(); }
+ int height() const { return fRenderTarget->height(); }
+ int numColorSamples() const { return fRenderTarget->numColorSamples(); }
+
private:
friend class GrAtlasTextContext; // for access to drawBatch
friend class GrDrawingManager; // for ctor
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index c158ec1f2c..163601e836 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -1210,7 +1210,7 @@ inline void GrAtlasTextContext::appendGlyphCommon(GrAtlasTextBlob* blob, Run* ru
subRun->fVertexEndIndex += vertexStride * GrAtlasTextBatch::kVerticesPerGlyph;
}
-void GrAtlasTextContext::flushRunAsPaths(GrDrawContext* dc, GrRenderTarget* rt,
+void GrAtlasTextContext::flushRunAsPaths(GrDrawContext* dc,
const SkTextBlobRunIterator& it,
const GrClip& clip, const SkPaint& skPaint,
SkDrawFilter* drawFilter, const SkMatrix& viewMatrix,
@@ -1230,18 +1230,18 @@ void GrAtlasTextContext::flushRunAsPaths(GrDrawContext* dc, GrRenderTarget* rt,
switch (it.positioning()) {
case SkTextBlob::kDefault_Positioning:
- this->drawTextAsPath(dc, rt, clip, runPaint, viewMatrix,
+ this->drawTextAsPath(dc, clip, runPaint, viewMatrix,
(const char *)it.glyphs(),
textLen, x + offset.x(), y + offset.y(), clipBounds);
break;
case SkTextBlob::kHorizontal_Positioning:
- this->drawPosTextAsPath(dc, rt, clip, runPaint, viewMatrix,
+ this->drawPosTextAsPath(dc, clip, runPaint, viewMatrix,
(const char*)it.glyphs(),
textLen, it.pos(), 1, SkPoint::Make(x, y + offset.y()),
clipBounds);
break;
case SkTextBlob::kFull_Positioning:
- this->drawPosTextAsPath(dc, rt, clip, runPaint, viewMatrix,
+ this->drawPosTextAsPath(dc, clip, runPaint, viewMatrix,
(const char*)it.glyphs(),
textLen, it.pos(), 2, SkPoint::Make(x, y), clipBounds);
break;
@@ -1309,7 +1309,7 @@ inline void GrAtlasTextContext::flushRun(GrDrawContext* dc, GrPipelineBuilder* p
}
inline void GrAtlasTextContext::flushBigGlyphs(GrAtlasTextBlob* cacheBlob,
- GrDrawContext* dc, GrRenderTarget* rt,
+ GrDrawContext* dc,
const GrClip& clip, const SkPaint& skPaint,
SkScalar transX, SkScalar transY,
const SkIRect& clipBounds) {
@@ -1328,7 +1328,7 @@ inline void GrAtlasTextContext::flushBigGlyphs(GrAtlasTextBlob* cacheBlob,
ctm.postConcat(cacheBlob->fViewMatrix);
}
- GrBlurUtils::drawPathWithMaskFilter(fContext, dc, rt, clip, bigGlyph.fPath,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, dc, clip, bigGlyph.fPath,
skPaint, ctm, nullptr, clipBounds, false);
}
}
@@ -1354,7 +1354,7 @@ void GrAtlasTextContext::flush(const SkTextBlob* blob,
SkTextBlobRunIterator it(blob);
for (int run = 0; !it.done(); it.next(), run++) {
if (cacheBlob->fRuns[run].fDrawAsPaths) {
- this->flushRunAsPaths(dc, rt, it, clip, skPaint,
+ this->flushRunAsPaths(dc, it, clip, skPaint,
drawFilter, viewMatrix, clipBounds, x, y);
continue;
}
@@ -1364,7 +1364,7 @@ void GrAtlasTextContext::flush(const SkTextBlob* blob,
}
// Now flush big glyphs
- this->flushBigGlyphs(cacheBlob, dc, rt, clip, skPaint, transX, transY, clipBounds);
+ this->flushBigGlyphs(cacheBlob, dc, clip, skPaint, transX, transY, clipBounds);
}
void GrAtlasTextContext::flush(GrAtlasTextBlob* cacheBlob,
@@ -1382,7 +1382,7 @@ void GrAtlasTextContext::flush(GrAtlasTextBlob* cacheBlob,
}
// Now flush big glyphs
- this->flushBigGlyphs(cacheBlob, dc, rt, clip, skPaint, 0, 0, clipBounds);
+ this->flushBigGlyphs(cacheBlob, dc, clip, skPaint, 0, 0, clipBounds);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h
index 81f1ddd378..90e401008d 100644
--- a/src/gpu/GrAtlasTextContext.h
+++ b/src/gpu/GrAtlasTextContext.h
@@ -71,7 +71,7 @@ private:
size_t vertexStride, bool useVertexColor,
GrGlyph*);
- inline void flushRunAsPaths(GrDrawContext*, GrRenderTarget*,
+ inline void flushRunAsPaths(GrDrawContext*,
const SkTextBlobRunIterator&, const GrClip& clip,
const SkPaint&, SkDrawFilter*,
const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x,
@@ -82,7 +82,7 @@ private:
const SkPaint&);
inline void flushRun(GrDrawContext*, GrPipelineBuilder*, GrAtlasTextBlob*, int run, GrColor,
SkScalar transX, SkScalar transY, const SkPaint&);
- inline void flushBigGlyphs(GrAtlasTextBlob* cacheBlob, GrDrawContext*, GrRenderTarget*,
+ inline void flushBigGlyphs(GrAtlasTextBlob* cacheBlob, GrDrawContext*,
const GrClip& clip, const SkPaint& skPaint,
SkScalar transX, SkScalar transY, const SkIRect& clipBounds);
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 8cd569b1b9..9ca445b529 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -148,7 +148,6 @@ static GrTexture* create_mask_GPU(GrContext* context,
static void draw_path_with_mask_filter(GrContext* context,
GrDrawContext* drawContext,
- GrRenderTarget* renderTarget,
const GrClip& clip,
GrPaint* paint,
const SkMatrix& viewMatrix,
@@ -160,7 +159,7 @@ static void draw_path_with_mask_filter(GrContext* context,
SkASSERT(maskFilter);
SkIRect clipBounds;
- clip.getConservativeBounds(renderTarget, &clipBounds);
+ clip.getConservativeBounds(drawContext->width(), drawContext->height(), &clipBounds);
SkTLazy<SkPath> tmpPath;
GrStrokeInfo strokeInfo(origStrokeInfo);
@@ -225,7 +224,7 @@ static void draw_path_with_mask_filter(GrContext* context,
*devPathPtr,
strokeInfo,
paint->isAntiAlias(),
- renderTarget->numColorSamples()));
+ drawContext->numColorSamples()));
if (mask) {
GrTexture* filtered;
@@ -251,7 +250,6 @@ static void draw_path_with_mask_filter(GrContext* context,
void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
GrDrawContext* drawContext,
- GrRenderTarget* rt,
const GrClip& clip,
const SkPath& origPath,
GrPaint* paint,
@@ -273,13 +271,12 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
pathEffect = nullptr;
}
- draw_path_with_mask_filter(context, drawContext, rt, clip, paint, viewMatrix, mf, pathEffect,
+ draw_path_with_mask_filter(context, drawContext, clip, paint, viewMatrix, mf, pathEffect,
strokeInfo, pathPtr, pathIsMutable);
}
void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
GrDrawContext* drawContext,
- GrRenderTarget* renderTarget,
const GrClip& clip,
const SkPath& origSrcPath,
const SkPaint& paint,
@@ -340,7 +337,7 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
}
if (paint.getMaskFilter()) {
- draw_path_with_mask_filter(context, drawContext, renderTarget, clip, &grPaint, viewMatrix,
+ draw_path_with_mask_filter(context, drawContext, clip, &grPaint, viewMatrix,
paint.getMaskFilter(), pathEffect, strokeInfo,
pathPtr, pathIsMutable);
} else {
diff --git a/src/gpu/GrBlurUtils.h b/src/gpu/GrBlurUtils.h
index 1de669c5d6..a22239aa34 100644
--- a/src/gpu/GrBlurUtils.h
+++ b/src/gpu/GrBlurUtils.h
@@ -31,7 +31,6 @@ namespace GrBlurUtils {
*/
void drawPathWithMaskFilter(GrContext* context,
GrDrawContext* drawContext,
- GrRenderTarget* rt,
const GrClip& clip,
const SkPath& origSrcPath,
const SkPaint& paint,
@@ -46,7 +45,6 @@ namespace GrBlurUtils {
*/
void drawPathWithMaskFilter(GrContext*,
GrDrawContext*,
- GrRenderTarget*,
const GrClip&,
const SkPath& path,
GrPaint*,
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index e41a1b72a8..9b7fa31ab0 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -137,7 +137,7 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
}
SkIRect copyRect;
- pipelineBuilder.clip().getConservativeBounds(rt, &copyRect);
+ pipelineBuilder.clip().getConservativeBounds(rt->width(), rt->height(), &copyRect);
SkIRect drawIBounds;
bounds.roundOut(&drawIBounds);
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index de833a6e26..a136886a64 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -39,7 +39,7 @@ bool get_path_and_clip_bounds(const GrPipelineBuilder* pipelineBuilder,
return false;
}
- pipelineBuilder->clip().getConservativeBounds(rt, devClipBounds);
+ pipelineBuilder->clip().getConservativeBounds(rt->width(), rt->height(), devClipBounds);
if (devClipBounds->isEmpty()) {
*devPathBounds = SkIRect::MakeWH(rt->width(), rt->height());
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 0ef18aaeb2..5cfcf64c1a 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -51,7 +51,7 @@ void GrTextContext::drawText(GrDrawContext* dc, GrRenderTarget* rt,
} while (textContext);
// fall back to drawing as a path
- this->drawTextAsPath(dc, rt, clip, skPaint, viewMatrix,
+ this->drawTextAsPath(dc, clip, skPaint, viewMatrix,
text, byteLength, x, y, clipBounds);
}
@@ -77,7 +77,7 @@ void GrTextContext::drawPosText(GrDrawContext* dc, GrRenderTarget* rt,
} while (textContext);
// fall back to drawing as a path
- this->drawPosTextAsPath(dc, rt, clip, skPaint, viewMatrix, text, byteLength, pos,
+ this->drawPosTextAsPath(dc, clip, skPaint, viewMatrix, text, byteLength, pos,
scalarsPerPosition, offset, clipBounds);
}
@@ -161,7 +161,7 @@ void GrTextContext::drawTextBlob(GrDrawContext* dc, GrRenderTarget* rt,
}
}
-void GrTextContext::drawTextAsPath(GrDrawContext* dc, GrRenderTarget* rt,
+void GrTextContext::drawTextAsPath(GrDrawContext* dc,
const GrClip& clip,
const SkPaint& skPaint, const SkMatrix& viewMatrix,
const char text[], size_t byteLength, SkScalar x, SkScalar y,
@@ -179,14 +179,14 @@ void GrTextContext::drawTextAsPath(GrDrawContext* dc, GrRenderTarget* rt,
matrix.postTranslate(xpos - prevXPos, 0);
if (iterPath) {
const SkPaint& pnt = iter.getPaint();
- GrBlurUtils::drawPathWithMaskFilter(fContext, dc, rt, clip, *iterPath,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, dc, clip, *iterPath,
pnt, viewMatrix, &matrix, clipBounds, false);
}
prevXPos = xpos;
}
}
-void GrTextContext::drawPosTextAsPath(GrDrawContext* dc, GrRenderTarget* rt,
+void GrTextContext::drawPosTextAsPath(GrDrawContext* dc,
const GrClip& clip,
const SkPaint& origPaint, const SkMatrix& viewMatrix,
const char text[], size_t byteLength,
@@ -227,7 +227,7 @@ void GrTextContext::drawPosTextAsPath(GrDrawContext* dc, GrRenderTarget* rt,
matrix[SkMatrix::kMTransX] = loc.fX;
matrix[SkMatrix::kMTransY] = loc.fY;
- GrBlurUtils::drawPathWithMaskFilter(fContext, dc, rt, clip, *path, paint,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, dc, clip, *path, paint,
viewMatrix, &matrix, clipBounds, false);
}
}
diff --git a/src/gpu/GrTextContext.h b/src/gpu/GrTextContext.h
index 05e179af53..2521047938 100644
--- a/src/gpu/GrTextContext.h
+++ b/src/gpu/GrTextContext.h
@@ -66,11 +66,11 @@ protected:
const SkScalar pos[], int scalarsPerPosition,
const SkPoint& offset, const SkIRect& clipBounds) = 0;
- void drawTextAsPath(GrDrawContext*, GrRenderTarget*, const GrClip& clip,
+ void drawTextAsPath(GrDrawContext*, const GrClip& clip,
const SkPaint& origPaint, const SkMatrix& viewMatrix,
const char text[], size_t byteLength, SkScalar x, SkScalar y,
const SkIRect& clipBounds);
- void drawPosTextAsPath(GrDrawContext*, GrRenderTarget*, const GrClip& clip,
+ void drawPosTextAsPath(GrDrawContext*, const GrClip& clip,
const SkPaint& origPaint, const SkMatrix& viewMatrix,
const char text[], size_t byteLength,
const SkScalar pos[], int scalarsPerPosition,
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 46e8df4443..17e4468acb 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -484,7 +484,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint
SkPath path;
path.setIsVolatile(true);
path.addRect(rect);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, fRenderTarget,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fClip->getBounds(), true);
@@ -554,7 +554,7 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rect,
SkPath path;
path.setIsVolatile(true);
path.addRRect(rect);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, fRenderTarget,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fClip->getBounds(), true);
@@ -590,7 +590,7 @@ void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
path.addRRect(inner);
path.setFillType(SkPath::kEvenOdd_FillType);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, fRenderTarget,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fClip->getBounds(), true);
@@ -666,7 +666,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
CHECK_SHOULD_DRAW(draw);
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPath", fContext);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, fRenderTarget,
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext,
fClip, origSrcPath, paint,
*draw.fMatrix, prePathMatrix,
draw.fClip->getBounds(), pathIsMutable);
@@ -706,7 +706,7 @@ static void determine_clipped_src_rect(const GrRenderTarget* rt,
const SkISize& imageSize,
const SkRect* srcRectPtr,
SkIRect* clippedSrcIRect) {
- clip.getConservativeBounds(rt, clippedSrcIRect, nullptr);
+ clip.getConservativeBounds(rt->width(), rt->height(), clippedSrcIRect, nullptr);
SkMatrix inv;
if (!viewMatrix.invert(&inv)) {
clippedSrcIRect->setEmpty();
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 443bcf102b..0b1d3f1f08 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -234,7 +234,7 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
SkPath rectPath;
rectPath.addRect(clippedDstRect);
rectPath.setIsVolatile(true);
- GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext, fRenderTarget, fClip,
+ GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext, fClip,
rectPath, &grPaint, viewMatrix, mf, paint.getPathEffect(),
GrStrokeInfo::FillInfo(), true);
}
diff --git a/src/gpu/batches/GrAAHairLinePathRenderer.cpp b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
index 94abe1c1ec..d6ad9d32c9 100644
--- a/src/gpu/batches/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
@@ -975,8 +975,8 @@ static GrDrawBatch* create_hairline_batch(GrColor color,
bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
SkIRect devClipBounds;
- args.fPipelineBuilder->clip().getConservativeBounds(args.fPipelineBuilder->getRenderTarget(),
- &devClipBounds);
+ GrRenderTarget* rt = args.fPipelineBuilder->getRenderTarget();
+ args.fPipelineBuilder->clip().getConservativeBounds(rt->width(), rt->height(), &devClipBounds);
SkAutoTUnref<GrDrawBatch> batch(create_hairline_batch(args.fColor, *args.fViewMatrix, *args.fPath,
*args.fStroke, devClipBounds));
diff --git a/src/gpu/batches/GrTessellatingPathRenderer.cpp b/src/gpu/batches/GrTessellatingPathRenderer.cpp
index 082a8dbdcf..27e287e9c6 100644
--- a/src/gpu/batches/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/batches/GrTessellatingPathRenderer.cpp
@@ -1634,7 +1634,7 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
SkIRect clipBoundsI;
- args.fPipelineBuilder->clip().getConservativeBounds(rt, &clipBoundsI);
+ args.fPipelineBuilder->clip().getConservativeBounds(rt->width(), rt->height(), &clipBoundsI);
SkRect clipBounds = SkRect::Make(clipBoundsI);
SkMatrix vmi;
if (!args.fViewMatrix->invert(&vmi)) {
diff --git a/tests/ClipBoundsTest.cpp b/tests/ClipBoundsTest.cpp
index d8df62ecad..c59d5a55f8 100644
--- a/tests/ClipBoundsTest.cpp
+++ b/tests/ClipBoundsTest.cpp
@@ -57,7 +57,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrClipBounds, reporter, context) {
clipData.setClipStack(&stack);
SkIRect devGrClipBound;
- clipData.getConservativeBounds(texture,
+ clipData.getConservativeBounds(texture->width(), texture->height(),
&devGrClipBound,
&isIntersectionOfRects);