diff options
author | Robert Phillips <robertphillips@google.com> | 2018-05-31 12:43:27 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-31 17:27:43 +0000 |
commit | 774168efac172d096cd7f09841bce51650cb6e84 (patch) | |
tree | 1433b93978baaf92439289fe5a0a3e648a73974f /include/private/GrCCClipPath.h | |
parent | e304a8a21b0bc40c3a7d85a96371a21180750076 (diff) |
Allow CCPR in DDL mode (take 2)
A lot of the changes to get this compiling on the
win_chromium_compile_dbg_ng bot (i.e., moving a lot of header files to
private) should be undone if that bot is ever "fixed".
Bug: skia:7988
Change-Id: I704ff793d80b18e7312048538874498824803580
Reviewed-on: https://skia-review.googlesource.com/130920
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include/private/GrCCClipPath.h')
-rw-r--r-- | include/private/GrCCClipPath.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/include/private/GrCCClipPath.h b/include/private/GrCCClipPath.h new file mode 100644 index 0000000000..f15cc9c756 --- /dev/null +++ b/include/private/GrCCClipPath.h @@ -0,0 +1,79 @@ +/* + * Copyright 2018 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrCCClipPath_DEFINED +#define GrCCClipPath_DEFINED + +#include "GrTextureProxy.h" +#include "SkPath.h" + +class GrCCAtlas; +class GrCCPerFlushResources; +class GrOnFlushResourceProvider; +class GrProxyProvider; + +/** + * These are keyed by SkPath generation ID, and store which device-space paths are accessed and + * where by clip FPs in a given opList. A single GrCCClipPath can be referenced by multiple FPs. At + * flush time their coverage count masks are packed into atlas(es) alongside normal DrawPathOps. + */ +class GrCCClipPath { +public: + GrCCClipPath() = default; + GrCCClipPath(const GrCCClipPath&) = delete; + + ~GrCCClipPath() { + // Ensure no clip FPs exist with a dangling pointer back into this class. + SkASSERT(!fAtlasLazyProxy || fAtlasLazyProxy->isUnique_debugOnly()); + // Ensure no lazy proxy callbacks exist with a dangling pointer back into this class. + SkASSERT(fHasAtlasTransform); + } + + bool isInitialized() const { return fAtlasLazyProxy != nullptr; } + void init(GrProxyProvider* proxyProvider, + const SkPath& deviceSpacePath, const SkIRect& accessRect, + int rtWidth, int rtHeight); + + void addAccess(const SkIRect& accessRect) { + SkASSERT(this->isInitialized()); + fAccessRect.join(accessRect); + } + GrTextureProxy* atlasLazyProxy() const { + SkASSERT(this->isInitialized()); + return fAtlasLazyProxy.get(); + } + const SkPath& deviceSpacePath() const { + SkASSERT(this->isInitialized()); + return fDeviceSpacePath; + } + const SkIRect& pathDevIBounds() const { + SkASSERT(this->isInitialized()); + return fPathDevIBounds; + } + + void renderPathInAtlas(GrCCPerFlushResources*, GrOnFlushResourceProvider*); + + const SkVector& atlasScale() const { SkASSERT(fHasAtlasTransform); return fAtlasScale; } + const SkVector& atlasTranslate() const { SkASSERT(fHasAtlasTransform); return fAtlasTranslate; } + +private: + sk_sp<GrTextureProxy> fAtlasLazyProxy; + SkPath fDeviceSpacePath; + SkIRect fPathDevIBounds; + SkIRect fAccessRect; + + const GrCCAtlas* fAtlas = nullptr; + int16_t fAtlasOffsetX; + int16_t fAtlasOffsetY; + SkDEBUGCODE(bool fHasAtlas = false); + + SkVector fAtlasScale; + SkVector fAtlasTranslate; + SkDEBUGCODE(bool fHasAtlasTransform = false); +}; + +#endif |