diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrClipMaskManager.cpp | 10 | ||||
-rwxr-xr-x | src/gpu/GrContext.cpp | 33 | ||||
-rw-r--r-- | src/gpu/GrDefaultPathRenderer.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrDrawTarget.cpp | 6 | ||||
-rw-r--r-- | src/gpu/GrDrawTarget.h | 13 | ||||
-rw-r--r-- | src/gpu/GrInOrderDrawBuffer.cpp | 12 | ||||
-rw-r--r-- | src/gpu/GrInOrderDrawBuffer.h | 1 | ||||
-rw-r--r-- | src/gpu/GrOvalRenderer.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrSoftwarePathRenderer.cpp | 8 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGpuGL.cpp | 4 |
11 files changed, 33 insertions, 60 deletions
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index 704750efca..edd44540c5 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -407,7 +407,7 @@ bool GrClipMaskManager::drawElement(GrTexture* target, element->getRect(), false); } else { - fGpu->drawSimpleRect(element->getRect(), NULL); + fGpu->drawSimpleRect(element->getRect()); } return true; default: { @@ -481,7 +481,7 @@ void GrClipMaskManager::mergeMask(GrTexture* dstMask, GrTextureDomain::MakeTexelDomain(srcMask, srcBound), GrTextureDomain::kDecal_Mode, GrTextureParams::kNone_FilterMode))->unref(); - fGpu->drawSimpleRect(SkRect::Make(dstBound), NULL); + fGpu->drawSimpleRect(SkRect::Make(dstBound)); } // get a texture to act as a temporary buffer for AA clip boolean operations @@ -812,7 +812,7 @@ bool GrClipMaskManager::createStencilClipMask(int32_t elementsGenID, SET_RANDOM_COLOR if (Element::kRect_Type == element->getType()) { *drawState->stencil() = gDrawToStencil; - fGpu->drawSimpleRect(element->getRect(), NULL); + fGpu->drawSimpleRect(element->getRect()); } else { if (!clipPath.isEmpty()) { if (canRenderDirectToStencil) { @@ -833,7 +833,7 @@ bool GrClipMaskManager::createStencilClipMask(int32_t elementsGenID, if (canDrawDirectToClip) { if (Element::kRect_Type == element->getType()) { SET_RANDOM_COLOR - fGpu->drawSimpleRect(element->getRect(), NULL); + fGpu->drawSimpleRect(element->getRect()); } else { SET_RANDOM_COLOR pr->drawPath(clipPath, stroke, fGpu, false); @@ -842,7 +842,7 @@ bool GrClipMaskManager::createStencilClipMask(int32_t elementsGenID, SET_RANDOM_COLOR // The view matrix is setup to do clip space -> stencil space translation, so // draw rect in clip space. - fGpu->drawSimpleRect(SkRect::Make(clipSpaceIBounds), NULL); + fGpu->drawSimpleRect(SkRect::Make(clipSpaceIBounds)); } } } diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 3dc78c117c..c3f3c33f73 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -786,8 +786,7 @@ static inline bool rect_contains_inclusive(const SkRect& rect, const SkPoint& po void GrContext::drawRect(const GrPaint& paint, const SkRect& rect, - const GrStrokeInfo* strokeInfo, - const SkMatrix* matrix) { + const GrStrokeInfo* strokeInfo) { if (NULL != strokeInfo && strokeInfo->isDashed()) { SkPath path; path.addRect(rect); @@ -804,10 +803,7 @@ void GrContext::drawRect(const GrPaint& paint, GR_CREATE_TRACE_MARKER("GrContext::drawRect", target); SkScalar width = NULL == strokeInfo ? -1 : strokeInfo->getStrokeRec().getWidth(); - SkMatrix combinedMatrix = target->drawState()->getViewMatrix(); - if (NULL != matrix) { - combinedMatrix.preConcat(*matrix); - } + SkMatrix matrix = target->drawState()->getViewMatrix(); // Check if this is a full RT draw and can be replaced with a clear. We don't bother checking // cases where the RT is fully inside a stroke. @@ -824,7 +820,7 @@ void GrContext::drawRect(const GrPaint& paint, // Does the clip contain the entire RT? if (!checkClip || target->getClip()->fClipStack->quickContains(clipSpaceRTRect)) { SkMatrix invM; - if (!combinedMatrix.invert(&invM)) { + if (!matrix.invert(&invM)) { return; } // Does the rect bound the RT? @@ -848,7 +844,7 @@ void GrContext::drawRect(const GrPaint& paint, bool useVertexCoverage; bool needAA = paint.isAntiAlias() && !target->getDrawState().getRenderTarget()->isMultisampled(); - bool doAA = needAA && apply_aa_to_rect(target, rect, width, combinedMatrix, &devBoundRect, + bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix, &devBoundRect, &useVertexCoverage); const SkStrokeRec& strokeRec = strokeInfo->getStrokeRec(); @@ -860,12 +856,12 @@ void GrContext::drawRect(const GrPaint& paint, } if (width >= 0) { fAARectRenderer->strokeAARect(this->getGpu(), target, rect, - combinedMatrix, devBoundRect, + matrix, devBoundRect, strokeRec, useVertexCoverage); } else { // filled AA rect fAARectRenderer->fillAARect(this->getGpu(), target, - rect, combinedMatrix, devBoundRect, + rect, matrix, devBoundRect, useVertexCoverage); } return; @@ -904,23 +900,16 @@ void GrContext::drawRect(const GrPaint& paint, vertex[4].set(rect.fLeft, rect.fTop); } - GrDrawState::AutoViewMatrixRestore avmr; - if (NULL != matrix) { - GrDrawState* drawState = target->drawState(); - avmr.set(drawState, *matrix); - } - target->drawNonIndexed(primType, 0, vertCount); } else { // filled BW rect - target->drawSimpleRect(rect, matrix); + target->drawSimpleRect(rect); } } void GrContext::drawRectToRect(const GrPaint& paint, const SkRect& dstRect, const SkRect& localRect, - const SkMatrix* dstMatrix, const SkMatrix* localMatrix) { AutoRestoreEffects are; AutoCheckFlush acf(this); @@ -931,7 +920,7 @@ void GrContext::drawRectToRect(const GrPaint& paint, GR_CREATE_TRACE_MARKER("GrContext::drawRectToRect", target); - target->drawRect(dstRect, dstMatrix, &localRect, localMatrix); + target->drawRect(dstRect, &localRect, localMatrix); } namespace { @@ -1523,7 +1512,7 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target, drawState->setRenderTarget(texture->asRenderTarget()); SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); - fGpu->drawSimpleRect(rect, NULL); + fGpu->drawSimpleRect(rect); // we want to read back from the scratch's origin left = 0; top = 0; @@ -1609,7 +1598,7 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint* sampleM.preTranslate(SkIntToScalar(srcRect.fLeft), SkIntToScalar(srcRect.fTop)); drawState->addColorTextureEffect(src, sampleM); SkRect dstR = SkRect::MakeWH(SkIntToScalar(srcRect.width()), SkIntToScalar(srcRect.height())); - fGpu->drawSimpleRect(dstR, NULL); + fGpu->drawSimpleRect(dstR); } bool GrContext::writeRenderTargetPixels(GrRenderTarget* target, @@ -1736,7 +1725,7 @@ bool GrContext::writeRenderTargetPixels(GrRenderTarget* target, drawState->setRenderTarget(target); - fGpu->drawSimpleRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)), NULL); + fGpu->drawSimpleRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height))); return true; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp index bd9b1ea16a..dd6ae9d025 100644 --- a/src/gpu/GrDefaultPathRenderer.cpp +++ b/src/gpu/GrDefaultPathRenderer.cpp @@ -491,7 +491,7 @@ bool GrDefaultPathRenderer::internalDrawPath(const SkPath& path, bounds = path.getBounds(); } GrDrawTarget::AutoGeometryAndStatePush agasp(target, GrDrawTarget::kPreserve_ASRInit); - target->drawSimpleRect(bounds, NULL); + target->drawSimpleRect(bounds); } else { if (passCount > 1) { drawState->enableState(GrDrawState::kNoColorWrites_StateBit); diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index fd5e476c4e..f8bb910cd8 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -696,15 +696,9 @@ void set_vertex_attributes(GrDrawState* drawState, bool hasUVs) { }; void GrDrawTarget::onDrawRect(const SkRect& rect, - const SkMatrix* matrix, const SkRect* localRect, const SkMatrix* localMatrix) { - GrDrawState::AutoViewMatrixRestore avmr; - if (NULL != matrix) { - avmr.set(this->drawState(), *matrix); - } - set_vertex_attributes(this->drawState(), NULL != localRect); AutoReleaseGeometry geo(this, 4, 0); diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h index 0c03e34041..bd25a18e50 100644 --- a/src/gpu/GrDrawTarget.h +++ b/src/gpu/GrDrawTarget.h @@ -389,7 +389,6 @@ public: * and thus will finalize any reserved geometry. * * @param rect the rect to draw - * @param matrix optional matrix applied to rect (before viewMatrix) * @param localRect optional rect that specifies local coords to map onto * rect. If NULL then rect serves as the local coords. * @param localMatrix optional matrix applied to localRect. If @@ -398,22 +397,21 @@ public: * srcMatrix can be NULL when no srcMatrix is desired. */ void drawRect(const SkRect& rect, - const SkMatrix* matrix, const SkRect* localRect, const SkMatrix* localMatrix) { AutoGeometryPush agp(this); - this->onDrawRect(rect, matrix, localRect, localMatrix); + this->onDrawRect(rect, localRect, localMatrix); } /** * Helper for drawRect when the caller doesn't need separate local rects or matrices. */ - void drawSimpleRect(const SkRect& rect, const SkMatrix* matrix = NULL) { - this->drawRect(rect, matrix, NULL, NULL); + void drawSimpleRect(const SkRect& rect) { + this->drawRect(rect, NULL, NULL); } - void drawSimpleRect(const SkIRect& irect, const SkMatrix* matrix = NULL) { + void drawSimpleRect(const SkIRect& irect) { SkRect rect = SkRect::Make(irect); - this->drawRect(rect, matrix, NULL, NULL); + this->drawRect(rect, NULL, NULL); } /** @@ -929,7 +927,6 @@ private: // drawIndexedInstances, ...). The base class draws a two triangle fan using // drawNonIndexed from reserved vertex space. virtual void onDrawRect(const SkRect& rect, - const SkMatrix* matrix, const SkRect* localRect, const SkMatrix* localMatrix); diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index 26b54522b5..0cab19ff04 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -137,7 +137,6 @@ static bool cmd_has_trace_marker(uint8_t cmd) { } void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect, - const SkMatrix* matrix, const SkRect* localRect, const SkMatrix* localMatrix) { GrDrawState::AutoColorRestore acr; @@ -167,13 +166,8 @@ void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect, } // Go to device coords to allow batching across matrix changes - SkMatrix combinedMatrix; - if (NULL != matrix) { - combinedMatrix = *matrix; - } else { - combinedMatrix.reset(); - } - combinedMatrix.postConcat(drawState->getViewMatrix()); + SkMatrix matrix = drawState->getViewMatrix(); + // When the caller has provided an explicit source rect for a stage then we don't want to // modify that stage's matrix. Otherwise if the effect is generating its source rect from // the vertex positions then we have to account for the view matrix change. @@ -185,7 +179,7 @@ void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect, size_t vsize = drawState->getVertexSize(); geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vsize); - combinedMatrix.mapPointsWithStride(geo.positions(), vsize, 4); + matrix.mapPointsWithStride(geo.positions(), vsize, 4); SkRect devBounds; // since we already computed the dev verts, set the bounds hint. This will help us avoid diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h index b18112efae..b678518a5d 100644 --- a/src/gpu/GrInOrderDrawBuffer.h +++ b/src/gpu/GrInOrderDrawBuffer.h @@ -155,7 +155,6 @@ private: // overrides from GrDrawTarget virtual void onDraw(const DrawInfo&) SK_OVERRIDE; virtual void onDrawRect(const SkRect& rect, - const SkMatrix* matrix, const SkRect* localRect, const SkMatrix* localMatrix) SK_OVERRIDE; diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index cf4c31677d..395c90be05 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -939,7 +939,7 @@ bool GrOvalRenderer::drawDRRect(GrDrawTarget* target, GrContext* context, bool u if (applyAA) { bounds.outset(SK_ScalarHalf, SK_ScalarHalf); } - target->drawRect(bounds, NULL, NULL, NULL); + target->drawRect(bounds, NULL, NULL); return true; } diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp index bca2c66b37..0d3ef62dc2 100644 --- a/src/gpu/GrSoftwarePathRenderer.cpp +++ b/src/gpu/GrSoftwarePathRenderer.cpp @@ -84,22 +84,22 @@ void draw_around_inv_path(GrDrawTarget* target, if (devClipBounds.fTop < devPathBounds.fTop) { rect.iset(devClipBounds.fLeft, devClipBounds.fTop, devClipBounds.fRight, devPathBounds.fTop); - target->drawSimpleRect(rect, NULL); + target->drawSimpleRect(rect); } if (devClipBounds.fLeft < devPathBounds.fLeft) { rect.iset(devClipBounds.fLeft, devPathBounds.fTop, devPathBounds.fLeft, devPathBounds.fBottom); - target->drawSimpleRect(rect, NULL); + target->drawSimpleRect(rect); } if (devClipBounds.fRight > devPathBounds.fRight) { rect.iset(devPathBounds.fRight, devPathBounds.fTop, devClipBounds.fRight, devPathBounds.fBottom); - target->drawSimpleRect(rect, NULL); + target->drawSimpleRect(rect); } if (devClipBounds.fBottom > devPathBounds.fBottom) { rect.iset(devClipBounds.fLeft, devPathBounds.fBottom, devClipBounds.fRight, devClipBounds.fBottom); - target->drawSimpleRect(rect, NULL); + target->drawSimpleRect(rect); } } diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index b1e23f9474..7c4f4519d1 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1381,7 +1381,7 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, SkColor2GrColor(paint.getColor()); SkPaint2GrPaintNoShader(this->context(), paint, paintColor, false, &grPaint); - fContext->drawRectToRect(grPaint, dstRect, paintRect, NULL); + fContext->drawRectToRect(grPaint, dstRect, paintRect); } static bool filter_texture(SkBaseDevice* device, GrContext* context, diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 8982785b3e..adcddcc108 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -1935,7 +1935,7 @@ void GrGpuGL::onGpuDrawPath(const GrPath* path, SkPath::FillType fill) { avmr.setIdentity(drawState); } - this->drawSimpleRect(bounds, NULL); + this->drawSimpleRect(bounds); } } @@ -2012,7 +2012,7 @@ void GrGpuGL::onGpuDrawPaths(const GrPathRange* pathRange, avmr.setIdentity(drawState); } - this->drawSimpleRect(bounds, NULL); + this->drawSimpleRect(bounds); } } |