aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-12-13 11:50:22 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-13 18:24:30 +0000
commite42edcc8ef257d4c430344d6d208e994f20f9320 (patch)
tree6c894e1995a7b03a74619b185998936dd6f62f9c /include
parentb9042d206ab8762429c61160383094360fb04c7a (diff)
Add stubbed out GrContext
This CL mainly just: stores the GrContextOptions in GrContextThreadSafeProxy (so they can be passed on to a stubbed out GrContext) adds a method to create a stubbed out GrContext that has a GrStubGpu - the stubbed out GrContext isn't quite ready for prime time yet Change-Id: I31be6763640e406c5963e6f0714489ac358339e4 Reviewed-on: https://skia-review.googlesource.com/79601 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkDeferredDisplayListRecorder.h14
-rw-r--r--include/gpu/GrContext.h26
-rw-r--r--include/private/SkSurfaceCharacterization.h17
3 files changed, 43 insertions, 14 deletions
diff --git a/include/core/SkDeferredDisplayListRecorder.h b/include/core/SkDeferredDisplayListRecorder.h
index 63934a1857..b50d4f8c1f 100644
--- a/include/core/SkDeferredDisplayListRecorder.h
+++ b/include/core/SkDeferredDisplayListRecorder.h
@@ -13,8 +13,12 @@
#include "../private/SkDeferredDisplayList.h"
#include "../private/SkSurfaceCharacterization.h"
+class GrContext;
+
class SkCanvas;
-class SkSurface; // TODO: remove
+class SkSurface;
+
+#define SK_RASTER_RECORDER_IMPLEMENTATION 1
/*
* This class is intended to be used as:
@@ -44,9 +48,13 @@ public:
std::unique_ptr<SkDeferredDisplayList> detach();
private:
- const SkSurfaceCharacterization fCharacterization;
+ bool init();
- sk_sp<SkSurface> fSurface; // temporary until we have a real implementation
+ const SkSurfaceCharacterization fCharacterization;
+#ifndef SK_RASTER_RECORDER_IMPLEMENTATION
+ sk_sp<GrContext> fContext;
+#endif
+ sk_sp<SkSurface> fSurface;
};
#endif
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index d9ea0a0ce8..68514891c4 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -382,16 +382,16 @@ private:
GrAuditTrail fAuditTrail;
- GrBackend fBackend;
+ const GrBackend fBackend;
GrContextOptions::PersistentCache* fPersistentCache;
// TODO: have the GrClipStackClip use renderTargetContexts and rm this friending
friend class GrContextPriv;
- GrContext(); // init must be called after the constructor.
- bool init(GrBackend, GrBackendContext, const GrContextOptions& options);
- bool init(const GrContextOptions& options);
+ GrContext(GrBackend); // init must be called after the constructor.
+ GrContext(GrContextThreadSafeProxy*);
+ bool init(const GrContextOptions&);
/**
* These functions create premul <-> unpremul effects. If the second argument is 'true', they
@@ -427,14 +427,24 @@ public:
bool matches(GrContext* context) const { return context->uniqueID() == fContextUniqueID; }
private:
- GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uint32_t uniqueID)
+ // DDL TODO: need to add unit tests for backend & maybe options
+ GrContextThreadSafeProxy(sk_sp<const GrCaps> caps,
+ uint32_t uniqueID,
+ GrBackend backend,
+ const GrContextOptions& options)
: fCaps(std::move(caps))
- , fContextUniqueID(uniqueID) {}
+ , fContextUniqueID(uniqueID)
+ , fBackend(backend)
+ , fOptions(options) {
+ }
- sk_sp<const GrCaps> fCaps;
- uint32_t fContextUniqueID;
+ sk_sp<const GrCaps> fCaps;
+ const uint32_t fContextUniqueID;
+ const GrBackend fBackend;
+ const GrContextOptions fOptions;
friend class GrContext;
+ friend class GrContextPriv;
friend class SkImage;
typedef SkRefCnt INHERITED;
diff --git a/include/private/SkSurfaceCharacterization.h b/include/private/SkSurfaceCharacterization.h
index 282043a879..40be90c685 100644
--- a/include/private/SkSurfaceCharacterization.h
+++ b/include/private/SkSurfaceCharacterization.h
@@ -10,12 +10,14 @@
#include "GrTypes.h"
+#include "SkSurfaceProps.h"
+
+class SkColorSpace;
+
#if SK_SUPPORT_GPU
#include "GrTypesPriv.h"
-#include "SkSurfaceProps.h"
class GrContextThreadSafeProxy;
-class SkColorSpace;
/** \class SkSurfaceCharacterization
A surface characterization contains all the information Ganesh requires to makes its internal
@@ -103,14 +105,23 @@ private:
class SkSurfaceCharacterization {
public:
- SkSurfaceCharacterization() : fWidth(0), fHeight(0) { }
+ SkSurfaceCharacterization()
+ : fWidth(0)
+ , fHeight(0)
+ , fSurfaceProps(0, kUnknown_SkPixelGeometry) {
+ }
int width() const { return fWidth; }
int height() const { return fHeight; }
+ SkColorSpace* colorSpace() const { return fColorSpace.get(); }
+ sk_sp<SkColorSpace> refColorSpace() const { return fColorSpace; }
+ const SkSurfaceProps& surfaceProps()const { return fSurfaceProps; }
private:
int fWidth;
int fHeight;
+ sk_sp<SkColorSpace> fColorSpace;
+ SkSurfaceProps fSurfaceProps;
};
#endif