aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrBlurUtils.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-03-08 09:51:04 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-08 15:26:51 +0000
commitc7c2baf0cf264b9d0d9c0f67cfb827a7e4a5e32c (patch)
tree6af65cc34a6b4557fd24d029c447c2822bdb9699 /src/gpu/GrBlurUtils.cpp
parent8c827ce7ea5b624792a9261f65d9515deb56a63d (diff)
Additional DDL playback cleanup
This operates in tandem with https://skia-review.googlesource.com/c/skia/+/112702 ( Remove GrRestrictedAtlasManager) to get DDL playback working. Change-Id: I6c2178fde760677bf79f2cf0a2dee8b5990aa5bc Reviewed-on: https://skia-review.googlesource.com/113121 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrBlurUtils.cpp')
-rw-r--r--src/gpu/GrBlurUtils.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 0bddd5c594..146f297987 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -6,15 +6,18 @@
*/
#include "GrBlurUtils.h"
-#include "GrRenderTargetContext.h"
+
#include "GrCaps.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrFixedClip.h"
+#include "GrProxyProvider.h"
+#include "GrRenderTargetContext.h"
#include "GrRenderTargetContextPriv.h"
-#include "effects/GrSimpleTextureEffect.h"
#include "GrStyle.h"
#include "GrTextureProxy.h"
+#include "effects/GrSimpleTextureEffect.h"
+
#include "SkDraw.h"
#include "SkGr.h"
#include "SkMaskFilterBase.h"
@@ -49,6 +52,10 @@ static bool draw_mask(GrRenderTargetContext* renderTargetContext,
return true;
}
+static void mask_release_proc(void* addr, void* /*context*/) {
+ SkMask::FreeImage(addr);
+}
+
static bool sw_draw_with_mask_filter(GrContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clipData,
@@ -58,7 +65,7 @@ static bool sw_draw_with_mask_filter(GrContext* context,
const SkIRect& clipBounds,
GrPaint&& paint,
SkStrokeRec::InitStyle fillOrHairline) {
- SkMask srcM, dstM;
+ SkMask srcM, dstM;
if (!SkDraw::DrawToMask(devPath, &clipBounds, filter, &viewMatrix, &srcM,
SkMask::kComputeBoundsAndRenderImage_CreateMode, fillOrHairline)) {
return false;
@@ -77,25 +84,23 @@ static bool sw_draw_with_mask_filter(GrContext* context,
// we now have a device-aligned 8bit mask in dstM, ready to be drawn using
// the current clip (and identity matrix) and GrPaint settings
- GrSurfaceDesc desc;
- desc.fWidth = dstM.fBounds.width();
- desc.fHeight = dstM.fBounds.height();
- desc.fConfig = kAlpha_8_GrPixelConfig;
-
- sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeDeferredSurfaceContext(
- desc, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, SkBackingFit::kApprox,
- SkBudgeted::kYes);
- if (!sContext) {
+ SkBitmap bm;
+ if (!bm.installPixels(SkImageInfo::MakeA8(dstM.fBounds.width(), dstM.fBounds.height()),
+ autoDst.release(), dstM.fRowBytes, mask_release_proc, nullptr)) {
return false;
}
+ bm.setImmutable();
- SkImageInfo ii = SkImageInfo::MakeA8(desc.fWidth, desc.fHeight);
- if (!sContext->writePixels(ii, dstM.fImage, dstM.fRowBytes, 0, 0)) {
- return false;
- }
+ sk_sp<SkImage> image = SkImage::MakeFromBitmap(bm);
+
+ auto proxyProvider = context->contextPriv().proxyProvider();
+ sk_sp<GrTextureProxy> maskProxy = proxyProvider->createTextureProxy(std::move(image),
+ kNone_GrSurfaceFlags,
+ 1, SkBudgeted::kYes,
+ SkBackingFit::kApprox);
return draw_mask(renderTargetContext, clipData, viewMatrix,
- dstM.fBounds, std::move(paint), sContext->asTextureProxyRef());
+ dstM.fBounds, std::move(paint), std::move(maskProxy));
}
// Create a mask of 'devPath' and place the result in 'mask'.