aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops
diff options
context:
space:
mode:
authorGravatar rmistry <rmistry@google.com>2016-12-19 04:32:28 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-12-19 04:32:28 -0800
commita8b1e6d0688c7bc8754b0f49578144c77f5a180e (patch)
tree249ba0dcada07a70e7113e18d81a8fd036c7a2d7 /src/gpu/ops
parent64b70b096ac20833d9737758a4bd5f2a51078bc4 (diff)
Revert of Generate Signed Distance Field directly from vector path (patchset #23 id:440001 of https://codereview.chromium.org/1643143002/ )
Reason for revert: Seems to have caused lot of test bots to fail. Eg: https://luci-milo.appspot.com/swarming/task/332e3b427135f010 Original issue's description: > Generate Signed Distance Field directly from vector path > > Add SkGenerateDistanceFieldFromPath API to generate signed distance field directly from SkPath. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1643143002 > > Committed: https://skia.googlesource.com/skia/+/4de97a64e8829323a7070b623411d9f9ddb0cd0f > Committed: https://skia.googlesource.com/skia/+/e8f0a7b986f1e5583c9bc162efcdd92fd6430549 > Committed: https://skia.googlesource.com/skia/+/67c7c81a82b6351e9fbbf235084d7120162d9268 > Review-Url: https://codereview.chromium.org/1643143002 > Committed: https://skia.googlesource.com/skia/+/64b70b096ac20833d9737758a4bd5f2a51078bc4 TBR=bsalomon@google.com,jvanverth@google.com,mtklein@google.com,wasim.abbas@arm.com,caryclark@google.com,reed@google.com,egdaniel@google.com,joel.liang@arm.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2580373002
Diffstat (limited to 'src/gpu/ops')
-rw-r--r--src/gpu/ops/GrAADistanceFieldPathRenderer.cpp76
1 files changed, 31 insertions, 45 deletions
diff --git a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
index 8d1af05f14..d72a239cc2 100644
--- a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
@@ -1,6 +1,5 @@
/*
* Copyright 2014 Google Inc.
- * Copyright 2016 ARM Ltd.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
@@ -20,9 +19,7 @@
#include "effects/GrDistanceFieldGeoProc.h"
#include "ops/GrMeshDrawOp.h"
-#include "SkPathOps.h"
#include "SkDistanceFieldGen.h"
-#include "GrDistanceFieldGenFromVector.h"
#define ATLAS_TEXTURE_WIDTH 2048
#define ATLAS_TEXTURE_HEIGHT 2048
@@ -338,56 +335,45 @@ private:
drawMatrix.setScale(scale, scale);
drawMatrix.postTranslate(intPad - dx, intPad - dy);
+ // setup bitmap backing
SkASSERT(devPathBounds.fLeft == 0);
SkASSERT(devPathBounds.fTop == 0);
+ SkAutoPixmapStorage dst;
+ if (!dst.tryAlloc(SkImageInfo::MakeA8(devPathBounds.width(),
+ devPathBounds.height()))) {
+ return false;
+ }
+ sk_bzero(dst.writable_addr(), dst.getSafeSize());
- // setup signed distance field storage
- SkIRect dfBounds = devPathBounds.makeOutset(SK_DistanceFieldPad, SK_DistanceFieldPad);
- width = dfBounds.width();
- height = dfBounds.height();
- // TODO We should really generate this directly into the plot somehow
- SkAutoSMalloc<1024> dfStorage(width * height * sizeof(unsigned char));
-
- SkPath path;
- shape.asPath(&path);
-#ifndef SK_USE_LEGACY_DISTANCE_FIELDS
- // Generate signed distance field directly from SkPath
- bool succeed = GrGenerateDistanceFieldFromPath((unsigned char*)dfStorage.get(),
- path, drawMatrix,
- width, height, width * sizeof(unsigned char));
- if (!succeed) {
-#endif
- // setup bitmap backing
- SkAutoPixmapStorage dst;
- if (!dst.tryAlloc(SkImageInfo::MakeA8(devPathBounds.width(),
- devPathBounds.height()))) {
- return false;
- }
- sk_bzero(dst.writable_addr(), dst.getSafeSize());
+ // rasterize path
+ SkPaint paint;
+ paint.setStyle(SkPaint::kFill_Style);
+ paint.setAntiAlias(true);
- // rasterize path
- SkPaint paint;
- paint.setStyle(SkPaint::kFill_Style);
- paint.setAntiAlias(true);
+ SkDraw draw;
+ sk_bzero(&draw, sizeof(draw));
- SkDraw draw;
- sk_bzero(&draw, sizeof(draw));
+ SkRasterClip rasterClip;
+ rasterClip.setRect(devPathBounds);
+ draw.fRC = &rasterClip;
+ draw.fMatrix = &drawMatrix;
+ draw.fDst = dst;
- SkRasterClip rasterClip;
- rasterClip.setRect(devPathBounds);
- draw.fRC = &rasterClip;
- draw.fMatrix = &drawMatrix;
- draw.fDst = dst;
+ SkPath path;
+ shape.asPath(&path);
+ draw.drawPathCoverage(path, paint);
- draw.drawPathCoverage(path, paint);
+ // generate signed distance field
+ devPathBounds.outset(SK_DistanceFieldPad, SK_DistanceFieldPad);
+ width = devPathBounds.width();
+ height = devPathBounds.height();
+ // TODO We should really generate this directly into the plot somehow
+ SkAutoSMalloc<1024> dfStorage(width * height * sizeof(unsigned char));
- // Generate signed distance field
- SkGenerateDistanceFieldFromA8Image((unsigned char*)dfStorage.get(),
- (const unsigned char*)dst.addr(),
- dst.width(), dst.height(), dst.rowBytes());
-#ifndef SK_USE_LEGACY_DISTANCE_FIELDS
- }
-#endif
+ // Generate signed distance field
+ SkGenerateDistanceFieldFromA8Image((unsigned char*)dfStorage.get(),
+ (const unsigned char*)dst.addr(),
+ dst.width(), dst.height(), dst.rowBytes());
// add to atlas
SkIPoint16 atlasLocation;