Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: src/gpu/GrClipStackClip.cpp

Issue 2215323003: Start using RenderTargetProxy (omnibus) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrClipStackClip.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrClipStackClip.cpp
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 669a9c23a6cd4811010b4be3e17edd9e679b6424..76a5dacdce961a691e6e65d3972676ff2bbdbda4 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -16,6 +16,7 @@
#include "GrRenderTargetPriv.h"
#include "GrStencilAttachment.h"
#include "GrSWMaskHelper.h"
+#include "GrTextureProxy.h"
#include "effects/GrConvexPolyEffect.h"
#include "effects/GrRRectEffect.h"
#include "effects/GrTextureDomain.h"
@@ -80,7 +81,7 @@ void GrClipStackClip::getConservativeBounds(int width, int height, SkIRect* devR
////////////////////////////////////////////////////////////////////////////////
// set up the draw state to enable the aa clipping mask.
-static sk_sp<GrFragmentProcessor> create_fp_for_mask(GrTexture* result,
+static sk_sp<GrFragmentProcessor> create_fp_for_mask(GrTextureProxy* result,
const SkIRect &devBound) {
SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height());
return GrDeviceSpaceTextureDecalFragmentProcessor::Make(result, domainTexels,
@@ -335,7 +336,7 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar
// If the stencil buffer is multisampled we can use it to do everything.
if (!renderTargetContext->isStencilBufferMultisampled() && reducedClip.requiresAA()) {
- sk_sp<GrTexture> result;
+ sk_sp<GrTextureProxy> result;
if (UseSWOnlyPath(context, hasUserStencilSettings, renderTargetContext, reducedClip)) {
// The clip geometry is complex enough that it will be more efficient to create it
// entirely in software
@@ -389,13 +390,13 @@ static void GetClipMaskKey(int32_t clipGenID, const SkIRect& bounds, GrUniqueKey
builder[2] = SkToS16(bounds.fTop) | (SkToS16(bounds.fBottom) << 16);
}
-sk_sp<GrTexture> GrClipStackClip::CreateAlphaClipMask(GrContext* context,
- const GrReducedClip& reducedClip) {
+sk_sp<GrTextureProxy> GrClipStackClip::CreateAlphaClipMask(GrContext* context,
+ const GrReducedClip& reducedClip) {
GrResourceProvider* resourceProvider = context->resourceProvider();
GrUniqueKey key;
GetClipMaskKey(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
if (GrTexture* texture = resourceProvider->findAndRefTextureByUniqueKey(key)) {
- return sk_sp<GrTexture>(texture);
+ return GrTextureProxy::Make(sk_sp<GrTexture>(texture));
}
sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContextWithFallback(
@@ -412,18 +413,19 @@ sk_sp<GrTexture> GrClipStackClip::CreateAlphaClipMask(GrContext* context,
return nullptr;
}
- sk_sp<GrTexture> texture(rtc->asTexture());
+ sk_sp<GrTextureProxy> texture(rtc->asDeferredTexture());
SkASSERT(texture);
- texture->resourcePriv().setUniqueKey(key);
+ //texture->resourcePriv().setUniqueKey(key);
return texture;
}
-sk_sp<GrTexture> GrClipStackClip::CreateSoftwareClipMask(GrTextureProvider* texProvider,
- const GrReducedClip& reducedClip) {
+////////////////////////////////////////////////////////////////////////////////
+sk_sp<GrTextureProxy> GrClipStackClip::CreateSoftwareClipMask(GrTextureProvider* texProvider,
+ const GrReducedClip& reducedClip) {
GrUniqueKey key;
GetClipMaskKey(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
if (GrTexture* texture = texProvider->findAndRefTextureByUniqueKey(key)) {
- return sk_sp<GrTexture>(texture);
+ return GrTextureProxy::Make(sk_ref_sp(texture)); // sub-optimal!!
}
// The mask texture may be larger than necessary. We round out the clip space bounds and pin
@@ -490,5 +492,5 @@ sk_sp<GrTexture> GrClipStackClip::CreateSoftwareClipMask(GrTextureProvider* texP
helper.toTexture(result.get());
- return result;
+ return GrTextureProxy::Make(result);
}
« no previous file with comments | « src/gpu/GrClipStackClip.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698