aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-08-31 15:06:24 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-31 15:06:24 -0700
commit13a7eee2504e7deb0e27ed3e69a787696d57b037 (patch)
treebe4bda801aa399016befedd2d288fe2f79300206
parent1da3ecd07836a72c9225c896d2516625906b4bda (diff)
Flush some non-substantive Ganesh changes
Split out of: https://codereview.chromium.org/2215323003/ (Start using RenderTargetProxy (omnibus)) GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2299523004 Review-Url: https://codereview.chromium.org/2299523004
-rw-r--r--include/gpu/GrDrawContext.h2
-rw-r--r--include/gpu/GrSurface.h3
-rw-r--r--include/private/GrSurfaceProxy.h10
-rw-r--r--src/gpu/GrDrawContext.cpp26
-rw-r--r--src/gpu/batches/GrDiscardBatch.h2
5 files changed, 24 insertions, 19 deletions
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h
index f3af2eb27d..cad2b827e4 100644
--- a/include/gpu/GrDrawContext.h
+++ b/include/gpu/GrDrawContext.h
@@ -341,8 +341,6 @@ public:
GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); }
- sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; }
-
sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture()); }
// Provides access to functions that aren't part of the public API.
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 24e2dfcb84..ac5c5fa1bb 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -33,8 +33,7 @@ public:
/**
* Helper that gets the width and height of the surface as a bounding rectangle.
*/
- void getBoundsRect(SkRect* rect) const { rect->setWH(SkIntToScalar(this->width()),
- SkIntToScalar(this->height())); }
+ SkRect getBoundsRect() const { return SkRect::MakeIWH(this->width(), this->height()); }
GrSurfaceOrigin origin() const {
SkASSERT(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin || kBottomLeft_GrSurfaceOrigin == fDesc.fOrigin);
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index ad2ea91973..98979ac819 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -29,6 +29,11 @@ public:
uint32_t uniqueID() const { return fUniqueID; }
/**
+ * Helper that gets the width and height of the surface as a bounding rectangle.
+ */
+ SkRect getBoundsRect() const { return SkRect::MakeIWH(this->width(), this->height()); }
+
+ /**
* @return the texture proxy associated with the surface proxy, may be NULL.
*/
virtual GrTextureProxy* asTextureProxy() { return nullptr; }
@@ -40,6 +45,11 @@ public:
virtual GrRenderTargetProxy* asRenderTargetProxy() { return nullptr; }
virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return nullptr; }
+ /**
+ * Does the resource count against the resource budget?
+ */
+ SkBudgeted isBudgeted() const { return fBudgeted; }
+
protected:
// Deferred version
GrSurfaceProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budgeted)
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 05d62f8a41..1fd113dce3 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -256,10 +256,8 @@ void GrDrawContext::drawPaint(const GrClip& clip,
// set rect to be big enough to fill the space, but not super-huge, so we
// don't overflow fixed-point implementations
- SkRect r;
- r.setLTRB(0, 0,
- SkIntToScalar(fRenderTarget->width()),
- SkIntToScalar(fRenderTarget->height()));
+
+ SkRect r = fRenderTarget->getBoundsRect();
SkTCopyOnFirstWrite<GrPaint> paint(origPaint);
SkRRect rrect;
@@ -332,7 +330,7 @@ static bool should_apply_coverage_aa(const GrPaint& paint, GrRenderTarget* rt,
// Attempts to crop a rect and optional local rect to the clip boundaries.
// Returns false if the draw can be skipped entirely.
-static bool crop_filled_rect(const GrRenderTarget* rt, const GrClip& clip,
+static bool crop_filled_rect(int width, int height, const GrClip& clip,
const SkMatrix& viewMatrix, SkRect* rect,
SkRect* localRect = nullptr) {
if (!viewMatrix.rectStaysRect()) {
@@ -342,7 +340,7 @@ static bool crop_filled_rect(const GrRenderTarget* rt, const GrClip& clip,
SkIRect clipDevBounds;
SkRect clipBounds;
- clip.getConservativeBounds(rt->width(), rt->height(), &clipDevBounds);
+ clip.getConservativeBounds(width, height, &clipDevBounds);
if (!SkMatrixPriv::InverseMapRect(viewMatrix, &clipBounds, SkRect::Make(clipDevBounds))) {
return false;
}
@@ -381,7 +379,7 @@ bool GrDrawContext::drawFilledRect(const GrClip& clip,
const SkRect& rect,
const GrUserStencilSettings* ss) {
SkRect croppedRect = rect;
- if (!crop_filled_rect(fRenderTarget.get(), clip, viewMatrix, &croppedRect)) {
+ if (!crop_filled_rect(this->width(), this->height(), clip, viewMatrix, &croppedRect)) {
return true;
}
@@ -453,8 +451,7 @@ void GrDrawContext::drawRect(const GrClip& clip,
if (!fContext->caps()->useDrawInsteadOfClear()) {
// 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.
- SkRect rtRect;
- fRenderTarget->getBoundsRect(&rtRect);
+ SkRect rtRect = fRenderTarget->getBoundsRect();
// Does the clip contain the entire RT?
if (clip.quickContains(rtRect)) {
SkMatrix invM;
@@ -631,7 +628,8 @@ void GrDrawContext::fillRectToRect(const GrClip& clip,
SkRect croppedRect = rectToDraw;
SkRect croppedLocalRect = localRect;
- if (!crop_filled_rect(fRenderTarget.get(), clip, viewMatrix, &croppedRect, &croppedLocalRect)) {
+ if (!crop_filled_rect(this->width(), this->height(), clip, viewMatrix,
+ &croppedRect, &croppedLocalRect)) {
return;
}
@@ -690,7 +688,7 @@ void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectWithLocalMatrix");
SkRect croppedRect = rectToDraw;
- if (!crop_filled_rect(fRenderTarget.get(), clip, viewMatrix, &croppedRect)) {
+ if (!crop_filled_rect(this->width(), this->height(), clip, viewMatrix, &croppedRect)) {
return;
}
@@ -1301,9 +1299,9 @@ bool GrDrawContextPriv::drawAndStencilPath(const GrClip& clip,
// the src color (either the input alpha or in the frag shader) to implement
// aa. If we have some future driver-mojo path AA that can do the right
// thing WRT to the blend then we'll need some query on the PR.
- bool useCoverageAA = doAA && !fDrawContext->fRenderTarget->isUnifiedMultisampled();
+ bool useCoverageAA = doAA && !fDrawContext->isUnifiedMultisampled();
bool hasUserStencilSettings = !ss->isUnused();
- bool isStencilBufferMSAA = fDrawContext->fRenderTarget->isStencilBufferMultisampled();
+ bool isStencilBufferMSAA = fDrawContext->isStencilBufferMultisampled();
const GrPathRendererChain::DrawType type =
useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType
@@ -1364,7 +1362,7 @@ void GrDrawContext::internalDrawPath(const GrClip& clip,
bool useCoverageAA = should_apply_coverage_aa(paint, fRenderTarget.get());
constexpr bool kHasUserStencilSettings = false;
- bool isStencilBufferMSAA = fRenderTarget->isStencilBufferMultisampled();
+ bool isStencilBufferMSAA = this->isStencilBufferMultisampled();
const GrPathRendererChain::DrawType type =
useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType
diff --git a/src/gpu/batches/GrDiscardBatch.h b/src/gpu/batches/GrDiscardBatch.h
index 33ffa25718..04e0ddbce4 100644
--- a/src/gpu/batches/GrDiscardBatch.h
+++ b/src/gpu/batches/GrDiscardBatch.h
@@ -38,7 +38,7 @@ public:
private:
bool onCombineIfPossible(GrBatch* that, const GrCaps& caps) override {
- return fRenderTarget == that->cast<GrDiscardBatch>()->fRenderTarget;
+ return this->renderTargetUniqueID() == that->renderTargetUniqueID();
}
void onPrepare(GrBatchFlushState*) override {}