aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrClipStackClip.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2016-10-27 14:47:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-27 19:14:09 +0000
commit1105224f9701e57ec5ce0354d6a380b664f5c638 (patch)
tree2b6f3db0bfd99da5e22adabc0da37d9271c8b543 /src/gpu/GrClipStackClip.cpp
parent6e74412a9cf1ffa44271a55b42f18e8a0813a0a2 (diff)
Rename GrDrawContext to GrRenderTargetContext
This is in preparation for GrTextureContext and GrSurfaceContext BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4030 Change-Id: Ie58c93052e68f3f1f5fe8d15d63760de274a6fbd Reviewed-on: https://skia-review.googlesource.com/4030 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrClipStackClip.cpp')
-rw-r--r--src/gpu/GrClipStackClip.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 7694a3f403..14c2dbe8ac 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -10,7 +10,7 @@
#include "GrAppliedClip.h"
#include "GrContextPriv.h"
#include "GrDrawingManager.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrFixedClip.h"
#include "GrGpuResourcePriv.h"
#include "GrRenderTargetPriv.h"
@@ -92,7 +92,7 @@ static sk_sp<GrFragmentProcessor> create_fp_for_mask(GrTexture* result,
// 'prOut' to the non-SW path renderer that will do the job).
bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context,
bool hasUserStencilSettings,
- const GrDrawContext* drawContext,
+ const GrRenderTargetContext* renderTargetContext,
const SkMatrix& viewMatrix,
const Element* element,
GrPathRenderer** prOut,
@@ -134,7 +134,7 @@ bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context,
canDrawArgs.fShape = &shape;
canDrawArgs.fAntiAlias = element->isAA();
canDrawArgs.fHasUserStencilSettings = hasUserStencilSettings;
- canDrawArgs.fIsStencilBufferMSAA = drawContext->isStencilBufferMultisampled();
+ canDrawArgs.fIsStencilBufferMSAA = renderTargetContext->isStencilBufferMultisampled();
// the 'false' parameter disallows use of the SW path renderer
GrPathRenderer* pr =
@@ -153,7 +153,7 @@ bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context,
*/
bool GrClipStackClip::UseSWOnlyPath(GrContext* context,
bool hasUserStencilSettings,
- const GrDrawContext* drawContext,
+ const GrRenderTargetContext* renderTargetContext,
const GrReducedClip& reducedClip) {
// TODO: generalize this function so that when
// a clip gets complex enough it can just be done in SW regardless
@@ -173,7 +173,7 @@ bool GrClipStackClip::UseSWOnlyPath(GrContext* context,
SkCanvas::kIntersect_Op == op || SkCanvas::kReverseDifference_Op == op;
if (PathNeedsSWRenderer(context, hasUserStencilSettings,
- drawContext, translate, element, nullptr, needsStencil)) {
+ renderTargetContext, translate, element, nullptr, needsStencil)) {
return true;
}
}
@@ -262,18 +262,18 @@ static bool get_analytic_clip_processor(const ElementList& elements,
////////////////////////////////////////////////////////////////////////////////
// sort out what kind of clip mask needs to be created: alpha, stencil,
// scissor, or entirely software
-bool GrClipStackClip::apply(GrContext* context, GrDrawContext* drawContext, bool useHWAA,
- bool hasUserStencilSettings, GrAppliedClip* out) const {
+bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTargetContext,
+ bool useHWAA, bool hasUserStencilSettings, GrAppliedClip* out) const {
if (!fStack || fStack->isWideOpen()) {
return true;
}
- SkRect devBounds = SkRect::MakeIWH(drawContext->width(), drawContext->height());
+ SkRect devBounds = SkRect::MakeIWH(renderTargetContext->width(), renderTargetContext->height());
if (!devBounds.intersect(out->clippedDrawBounds())) {
return false;
}
- GrRenderTarget* rt = drawContext->accessRenderTarget();
+ GrRenderTarget* rt = renderTargetContext->accessRenderTarget();
const SkScalar clipX = SkIntToScalar(fOrigin.x()),
clipY = SkIntToScalar(fOrigin.y());
@@ -311,8 +311,8 @@ bool GrClipStackClip::apply(GrContext* context, GrDrawContext* drawContext, bool
if (reducedClip.elements().count() <= kMaxAnalyticElements) {
// When there are multiple samples we want to do per-sample clipping, not compute a
// fractional pixel coverage.
- bool disallowAnalyticAA = drawContext->isStencilBufferMultisampled();
- if (disallowAnalyticAA && !drawContext->numColorSamples()) {
+ bool disallowAnalyticAA = renderTargetContext->isStencilBufferMultisampled();
+ if (disallowAnalyticAA && !renderTargetContext->numColorSamples()) {
// With a single color sample, any coverage info is lost from color once it hits the
// color buffer anyway, so we may as well use coverage AA if nothing else in the pipe
// is multisampled.
@@ -328,9 +328,9 @@ bool GrClipStackClip::apply(GrContext* context, GrDrawContext* drawContext, bool
}
// If the stencil buffer is multisampled we can use it to do everything.
- if (!drawContext->isStencilBufferMultisampled() && reducedClip.requiresAA()) {
+ if (!renderTargetContext->isStencilBufferMultisampled() && reducedClip.requiresAA()) {
sk_sp<GrTexture> result;
- if (UseSWOnlyPath(context, hasUserStencilSettings, drawContext, reducedClip)) {
+ if (UseSWOnlyPath(context, hasUserStencilSettings, renderTargetContext, reducedClip)) {
// The clip geometry is complex enough that it will be more efficient to create it
// entirely in software
result = CreateSoftwareClipMask(context->textureProvider(), reducedClip);
@@ -365,7 +365,7 @@ bool GrClipStackClip::apply(GrContext* context, GrDrawContext* drawContext, bool
// after clipping is overhauled.
if (stencilAttachment->mustRenderClip(reducedClip.elementsGenID(), reducedClip.ibounds(),
fOrigin)) {
- reducedClip.drawStencilClipMask(context, drawContext, fOrigin);
+ reducedClip.drawStencilClipMask(context, renderTargetContext, fOrigin);
stencilAttachment->setLastClip(reducedClip.elementsGenID(), reducedClip.ibounds(),
fOrigin);
}
@@ -393,20 +393,21 @@ sk_sp<GrTexture> GrClipStackClip::CreateAlphaClipMask(GrContext* context,
return sk_sp<GrTexture>(texture);
}
- sk_sp<GrDrawContext> dc(context->makeDrawContextWithFallback(SkBackingFit::kApprox,
- reducedClip.width(),
- reducedClip.height(),
- kAlpha_8_GrPixelConfig,
- nullptr));
- if (!dc) {
+ sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kApprox,
+ reducedClip.width(),
+ reducedClip.height(),
+ kAlpha_8_GrPixelConfig,
+ nullptr));
+ if (!rtc) {
return nullptr;
}
- if (!reducedClip.drawAlphaClipMask(dc.get())) {
+ if (!reducedClip.drawAlphaClipMask(rtc.get())) {
return nullptr;
}
- sk_sp<GrTexture> texture(dc->asTexture());
+ sk_sp<GrTexture> texture(rtc->asTexture());
SkASSERT(texture);
texture->resourcePriv().setUniqueKey(key);
return texture;