aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2017-09-22 14:23:22 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-22 18:43:48 +0000
commit7cf59526c9b1ab3682e875d449200e51f3b6ff32 (patch)
tree33b8858809191162841f44c3833b555f34a96ba3 /src/gpu/ops
parentc38548b3210e23090b0fa808cc0fdc16c8d55149 (diff)
Shrink GrDrawOpAtlases when no longer needed
Bug: skia:3550 Change-Id: I7b09aa2b0fd22ed99694f32f9f395392ef80e238 Reviewed-on: https://skia-review.googlesource.com/49901 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/ops')
-rw-r--r--src/gpu/ops/GrDrawOp.h4
-rw-r--r--src/gpu/ops/GrSmallPathRenderer.h12
2 files changed, 15 insertions, 1 deletions
diff --git a/src/gpu/ops/GrDrawOp.h b/src/gpu/ops/GrDrawOp.h
index 145d2e2981..ecd92498ae 100644
--- a/src/gpu/ops/GrDrawOp.h
+++ b/src/gpu/ops/GrDrawOp.h
@@ -33,6 +33,10 @@ public:
return fSequenceNumber == that.fSequenceNumber;
}
bool operator!=(const GrDrawOpUploadToken& that) const { return !(*this == that); }
+ bool inInterval(const GrDrawOpUploadToken& start, const GrDrawOpUploadToken& finish) {
+ return fSequenceNumber >= start.fSequenceNumber &&
+ fSequenceNumber <= finish.fSequenceNumber;
+ }
private:
GrDrawOpUploadToken();
diff --git a/src/gpu/ops/GrSmallPathRenderer.h b/src/gpu/ops/GrSmallPathRenderer.h
index b958baa843..9c3104b136 100644
--- a/src/gpu/ops/GrSmallPathRenderer.h
+++ b/src/gpu/ops/GrSmallPathRenderer.h
@@ -9,6 +9,7 @@
#define GrSmallPathRenderer_DEFINED
#include "GrDrawOpAtlas.h"
+#include "GrOnFlushResourceProvider.h"
#include "GrPathRenderer.h"
#include "GrRect.h"
#include "GrShape.h"
@@ -18,7 +19,7 @@
class GrContext;
-class GrSmallPathRenderer : public GrPathRenderer {
+class GrSmallPathRenderer : public GrPathRenderer, public GrOnFlushCallbackObject {
public:
GrSmallPathRenderer();
~GrSmallPathRenderer() override;
@@ -26,6 +27,15 @@ public:
class SmallPathOp;
struct PathTestStruct;
+ void preFlush(GrOnFlushResourceProvider*, const uint32_t*, int,
+ SkTArray<sk_sp<GrRenderTargetContext>>*) override {}
+
+ void postFlush(GrDrawOpUploadToken startTokenForNextFlush) override {
+ if (fAtlas) {
+ fAtlas->compact(startTokenForNextFlush);
+ }
+ }
+
private:
StencilSupport onGetStencilSupport(const GrShape&) const override {
return GrPathRenderer::kNoSupport_StencilSupport;