robertphillips | 4fd74ae | 2016-08-03 14:26:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrContextPriv_DEFINED |
| 9 | #define GrContextPriv_DEFINED |
| 10 | |
| 11 | #include "GrContext.h" |
Brian Osman | 45580d3 | 2016-11-23 09:37:01 -0500 | [diff] [blame] | 12 | #include "GrSurfaceContext.h" |
Robert Phillips | c4039ea | 2018-03-01 11:36:45 -0500 | [diff] [blame] | 13 | #include "text/GrAtlasManager.h" |
robertphillips | 4fd74ae | 2016-08-03 14:26:53 -0700 | [diff] [blame] | 14 | |
Greg Daniel | bcf612b | 2017-05-01 13:50:58 +0000 | [diff] [blame] | 15 | class GrBackendRenderTarget; |
Brian Salomon | d17f658 | 2017-07-19 18:28:58 -0400 | [diff] [blame] | 16 | class GrOnFlushCallbackObject; |
Greg Daniel | d85f97d | 2017-03-07 13:37:21 -0500 | [diff] [blame] | 17 | class GrSemaphore; |
Robert Phillips | e2f7d18 | 2016-12-15 09:23:05 -0500 | [diff] [blame] | 18 | class GrSurfaceProxy; |
Brian Salomon | d17f658 | 2017-07-19 18:28:58 -0400 | [diff] [blame] | 19 | class GrTextureContext; |
Robert Phillips | e2f7d18 | 2016-12-15 09:23:05 -0500 | [diff] [blame] | 20 | |
Robert Phillips | 6200036 | 2018-02-01 09:10:04 -0500 | [diff] [blame] | 21 | class SkDeferredDisplayList; |
| 22 | |
robertphillips | 4fd74ae | 2016-08-03 14:26:53 -0700 | [diff] [blame] | 23 | /** Class that adds methods to GrContext that are only intended for use internal to Skia. |
| 24 | This class is purely a privileged window into GrContext. It should never have additional |
| 25 | data members or virtual methods. */ |
| 26 | class GrContextPriv { |
| 27 | public: |
Robert Phillips | e42edcc | 2017-12-13 11:50:22 -0500 | [diff] [blame] | 28 | /** |
| 29 | * Create a GrContext without a resource cache |
| 30 | */ |
Kevin Lubick | b5502b2 | 2018-03-12 10:17:06 -0400 | [diff] [blame] | 31 | static sk_sp<GrContext> MakeDDL(const sk_sp<GrContextThreadSafeProxy>&); |
Robert Phillips | e42edcc | 2017-12-13 11:50:22 -0500 | [diff] [blame] | 32 | |
Brian Salomon | c7fe0f7 | 2018-05-11 10:14:21 -0400 | [diff] [blame^] | 33 | const GrCaps* caps() const { return fContext->fCaps.get(); } |
| 34 | |
bungeman | 6bd5284 | 2016-10-27 09:30:08 -0700 | [diff] [blame] | 35 | GrDrawingManager* drawingManager() { return fContext->fDrawingManager.get(); } |
csmartdalton | bde96c6 | 2016-08-31 12:54:46 -0700 | [diff] [blame] | 36 | |
Robert Phillips | d5f9cdd | 2018-01-31 09:29:48 -0500 | [diff] [blame] | 37 | sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>, |
| 38 | sk_sp<SkColorSpace> = nullptr, |
| 39 | const SkSurfaceProps* = nullptr); |
Robert Phillips | 31c2608 | 2016-12-14 15:12:15 -0500 | [diff] [blame] | 40 | |
Robert Phillips | bf25d43 | 2017-04-07 10:08:53 -0400 | [diff] [blame] | 41 | sk_sp<GrSurfaceContext> makeDeferredSurfaceContext(const GrSurfaceDesc&, |
Brian Salomon | 2a4f983 | 2018-03-03 22:43:43 -0500 | [diff] [blame] | 42 | GrSurfaceOrigin, |
Greg Daniel | 65c7f66 | 2017-10-30 13:39:09 -0400 | [diff] [blame] | 43 | GrMipMapped, |
Robert Phillips | bf25d43 | 2017-04-07 10:08:53 -0400 | [diff] [blame] | 44 | SkBackingFit, |
Brian Salomon | 366093f | 2018-02-13 09:25:22 -0500 | [diff] [blame] | 45 | SkBudgeted, |
| 46 | sk_sp<SkColorSpace> colorSpace = nullptr, |
| 47 | const SkSurfaceProps* = nullptr); |
Robert Phillips | e305cc1f | 2016-12-14 12:19:05 -0500 | [diff] [blame] | 48 | |
Brian Salomon | d17f658 | 2017-07-19 18:28:58 -0400 | [diff] [blame] | 49 | sk_sp<GrTextureContext> makeBackendTextureContext(const GrBackendTexture& tex, |
Greg Daniel | 7ef28f3 | 2017-04-20 16:41:55 +0000 | [diff] [blame] | 50 | GrSurfaceOrigin origin, |
Brian Osman | c1e3705 | 2017-03-09 14:19:20 -0500 | [diff] [blame] | 51 | sk_sp<SkColorSpace> colorSpace); |
Robert Phillips | d46697a | 2017-01-25 12:10:37 -0500 | [diff] [blame] | 52 | |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 53 | sk_sp<GrRenderTargetContext> makeBackendTextureRenderTargetContext( |
Greg Daniel | 7ef28f3 | 2017-04-20 16:41:55 +0000 | [diff] [blame] | 54 | const GrBackendTexture& tex, |
| 55 | GrSurfaceOrigin origin, |
| 56 | int sampleCnt, |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 57 | sk_sp<SkColorSpace> colorSpace, |
Brian Osman | c1e3705 | 2017-03-09 14:19:20 -0500 | [diff] [blame] | 58 | const SkSurfaceProps* = nullptr); |
robertphillips | 4fd74ae | 2016-08-03 14:26:53 -0700 | [diff] [blame] | 59 | |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 60 | sk_sp<GrRenderTargetContext> makeBackendRenderTargetRenderTargetContext( |
Greg Daniel | bcf612b | 2017-05-01 13:50:58 +0000 | [diff] [blame] | 61 | const GrBackendRenderTarget&, |
| 62 | GrSurfaceOrigin origin, |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 63 | sk_sp<SkColorSpace> colorSpace, |
| 64 | const SkSurfaceProps* = nullptr); |
robertphillips | 4fd74ae | 2016-08-03 14:26:53 -0700 | [diff] [blame] | 65 | |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 66 | sk_sp<GrRenderTargetContext> makeBackendTextureAsRenderTargetRenderTargetContext( |
Greg Daniel | 7ef28f3 | 2017-04-20 16:41:55 +0000 | [diff] [blame] | 67 | const GrBackendTexture& tex, |
| 68 | GrSurfaceOrigin origin, |
| 69 | int sampleCnt, |
robertphillips | 4fd74ae | 2016-08-03 14:26:53 -0700 | [diff] [blame] | 70 | sk_sp<SkColorSpace> colorSpace, |
| 71 | const SkSurfaceProps* = nullptr); |
| 72 | |
Brian Osman | 46da1cc | 2017-02-14 14:15:48 -0500 | [diff] [blame] | 73 | bool disableGpuYUVConversion() const { return fContext->fDisableGpuYUVConversion; } |
Brian Osman | 8a83ca4 | 2018-02-12 14:32:17 -0500 | [diff] [blame] | 74 | bool sharpenMipmappedTextures() const { return fContext->fSharpenMipmappedTextures; } |
Brian Osman | 46da1cc | 2017-02-14 14:15:48 -0500 | [diff] [blame] | 75 | |
Robert Phillips | 7ee385e | 2017-03-30 08:02:11 -0400 | [diff] [blame] | 76 | /** |
| 77 | * Call to ensure all drawing to the context has been issued to the |
| 78 | * underlying 3D API. |
| 79 | * The 'proxy' parameter is a hint. If it is supplied the context will guarantee that |
| 80 | * the draws required for that proxy are flushed but it could do more. If no 'proxy' is |
| 81 | * provided then all current work will be flushed. |
| 82 | */ |
| 83 | void flush(GrSurfaceProxy*); |
| 84 | |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 85 | /** |
| 86 | * Registers an object for flush-related callbacks. (See GrOnFlushCallbackObject.) |
| 87 | * |
| 88 | * NOTE: the drawing manager tracks this object as a raw pointer; it is up to the caller to |
| 89 | * ensure its lifetime is tied to that of the context. |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 90 | */ |
Chris Dalton | fe199b7 | 2017-05-05 11:26:15 -0400 | [diff] [blame] | 91 | void addOnFlushCallbackObject(GrOnFlushCallbackObject*); |
| 92 | |
| 93 | void testingOnly_flushAndRemoveOnFlushCallbackObject(GrOnFlushCallbackObject*); |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 94 | |
Robert Phillips | 7ee385e | 2017-03-30 08:02:11 -0400 | [diff] [blame] | 95 | /** |
| 96 | * After this returns any pending writes to the surface will have been issued to the |
| 97 | * backend 3D API. |
| 98 | */ |
| 99 | void flushSurfaceWrites(GrSurfaceProxy*); |
| 100 | |
| 101 | /** |
| 102 | * After this returns any pending reads or writes to the surface will have been issued to the |
| 103 | * backend 3D API. |
| 104 | */ |
| 105 | void flushSurfaceIO(GrSurfaceProxy*); |
| 106 | |
| 107 | /** |
| 108 | * Finalizes all pending reads and writes to the surface and also performs an MSAA resolve |
| 109 | * if necessary. |
| 110 | * |
| 111 | * It is not necessary to call this before reading the render target via Skia/GrContext. |
| 112 | * GrContext will detect when it must perform a resolve before reading pixels back from the |
| 113 | * surface or using it as a texture. |
| 114 | */ |
| 115 | void prepareSurfaceForExternalIO(GrSurfaceProxy*); |
| 116 | |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 117 | /** |
| 118 | * These flags can be used with the read/write pixels functions below. |
| 119 | */ |
| 120 | enum PixelOpsFlags { |
| 121 | /** The GrContext will not be flushed before the surface read or write. This means that |
| 122 | the read or write may occur before previous draws have executed. */ |
| 123 | kDontFlush_PixelOpsFlag = 0x1, |
| 124 | /** Any surface writes should be flushed to the backend 3D API after the surface operation |
| 125 | is complete */ |
| 126 | kFlushWrites_PixelOp = 0x2, |
| 127 | /** The src for write or dst read is unpremultiplied. This is only respected if both the |
| 128 | config src and dst configs are an RGBA/BGRA 8888 format. */ |
| 129 | kUnpremul_PixelOpsFlag = 0x4, |
| 130 | }; |
| 131 | |
| 132 | /** |
Brian Salomon | 19eaf2d | 2018-03-19 16:06:44 -0400 | [diff] [blame] | 133 | * Reads a rectangle of pixels from a surface. There are currently two versions of this. |
| 134 | * readSurfacePixels() is the older version which will be replaced by the more robust and |
| 135 | * maintainable (but perhaps slower) readSurfacePixels2(). |
| 136 | * |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 137 | * @param src the surface context to read from. |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 138 | * @param left left edge of the rectangle to read (inclusive) |
| 139 | * @param top top edge of the rectangle to read (inclusive) |
| 140 | * @param width width of rectangle to read in pixels. |
| 141 | * @param height height of rectangle to read in pixels. |
Brian Salomon | 19eaf2d | 2018-03-19 16:06:44 -0400 | [diff] [blame] | 142 | * @param dstColorType the color type of the destination buffer |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 143 | * @param dstColorSpace color space of the destination buffer |
| 144 | * @param buffer memory to read the rectangle into. |
| 145 | * @param rowBytes number of bytes bewtween consecutive rows. Zero means rows are tightly |
| 146 | * packed. |
| 147 | * @param pixelOpsFlags see PixelOpsFlags enum above. |
| 148 | * |
| 149 | * @return true if the read succeeded, false if not. The read can fail because of an unsupported |
| 150 | * pixel configs |
| 151 | */ |
Brian Salomon | c320b15 | 2018-02-20 14:05:36 -0500 | [diff] [blame] | 152 | bool readSurfacePixels(GrSurfaceContext* src, int left, int top, int width, int height, |
| 153 | GrColorType dstColorType, SkColorSpace* dstColorSpace, void* buffer, |
| 154 | size_t rowBytes = 0, uint32_t pixelOpsFlags = 0); |
Brian Salomon | 19eaf2d | 2018-03-19 16:06:44 -0400 | [diff] [blame] | 155 | bool readSurfacePixels2(GrSurfaceContext* src, int left, int top, int width, int height, |
| 156 | GrColorType dstColorType, SkColorSpace* dstColorSpace, void* buffer, |
| 157 | size_t rowBytes = 0, uint32_t pixelOpsFlags = 0); |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 158 | |
| 159 | /** |
Brian Salomon | 5f33a8c | 2018-02-26 14:32:39 -0500 | [diff] [blame] | 160 | * Writes a rectangle of pixels to a surface. There are currently two versions of this. |
| 161 | * writeSurfacePixels() is the older version which will be replaced by the more robust and |
| 162 | * maintainable (but perhaps slower) writeSurfacePixels2(). |
| 163 | * |
Robert Phillips | f41c22f | 2017-04-18 07:48:58 -0400 | [diff] [blame] | 164 | * @param dst the surface context to write to. |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 165 | * @param left left edge of the rectangle to write (inclusive) |
| 166 | * @param top top edge of the rectangle to write (inclusive) |
| 167 | * @param width width of rectangle to write in pixels. |
| 168 | * @param height height of rectangle to write in pixels. |
Brian Salomon | 5f33a8c | 2018-02-26 14:32:39 -0500 | [diff] [blame] | 169 | * @param srcColorType the color type of the source buffer |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 170 | * @param srcColorSpace color space of the source buffer |
| 171 | * @param buffer memory to read pixels from |
| 172 | * @param rowBytes number of bytes between consecutive rows. Zero |
| 173 | * means rows are tightly packed. |
| 174 | * @param pixelOpsFlags see PixelOpsFlags enum above. |
| 175 | * @return true if the write succeeded, false if not. The write can fail because of an |
| 176 | * unsupported combination of surface and src configs. |
| 177 | */ |
Brian Salomon | c320b15 | 2018-02-20 14:05:36 -0500 | [diff] [blame] | 178 | bool writeSurfacePixels(GrSurfaceContext* dst, int left, int top, int width, int height, |
| 179 | GrColorType srcColorType, SkColorSpace* srcColorSpace, |
| 180 | const void* buffer, size_t rowBytes, uint32_t pixelOpsFlags = 0); |
Brian Salomon | 5f33a8c | 2018-02-26 14:32:39 -0500 | [diff] [blame] | 181 | bool writeSurfacePixels2(GrSurfaceContext* dst, int left, int top, int width, int height, |
| 182 | GrColorType srcColorType, SkColorSpace* srcColorSpace, |
| 183 | const void* buffer, size_t rowBytes, uint32_t pixelOpsFlags = 0); |
Robert Phillips | e78b725 | 2017-04-06 07:59:41 -0400 | [diff] [blame] | 184 | |
Greg Daniel | fc978fd | 2017-04-13 09:54:12 -0400 | [diff] [blame] | 185 | GrBackend getBackend() const { return fContext->fBackend; } |
| 186 | |
Brian Osman | 5127998 | 2017-08-23 10:12:00 -0400 | [diff] [blame] | 187 | SkTaskGroup* getTaskGroup() { return fContext->fTaskGroup.get(); } |
| 188 | |
Robert Phillips | 1afd4cd | 2018-01-08 13:40:32 -0500 | [diff] [blame] | 189 | GrProxyProvider* proxyProvider() { return fContext->fProxyProvider; } |
| 190 | const GrProxyProvider* proxyProvider() const { return fContext->fProxyProvider; } |
| 191 | |
Robert Phillips | 6be756b | 2018-01-16 15:07:54 -0500 | [diff] [blame] | 192 | GrResourceProvider* resourceProvider() { return fContext->fResourceProvider; } |
| 193 | const GrResourceProvider* resourceProvider() const { return fContext->fResourceProvider; } |
| 194 | |
| 195 | GrResourceCache* getResourceCache() { return fContext->fResourceCache; } |
| 196 | |
Robert Phillips | 41a3b87 | 2018-03-09 12:00:34 -0500 | [diff] [blame] | 197 | GrTextureStripAtlasManager* textureStripAtlasManager() { |
| 198 | return fContext->fTextureStripAtlasManager.get(); |
| 199 | } |
| 200 | |
Robert Phillips | f35fd8d | 2018-01-22 10:48:15 -0500 | [diff] [blame] | 201 | GrGpu* getGpu() { return fContext->fGpu.get(); } |
| 202 | const GrGpu* getGpu() const { return fContext->fGpu.get(); } |
| 203 | |
Robert Phillips | c4039ea | 2018-03-01 11:36:45 -0500 | [diff] [blame] | 204 | GrGlyphCache* getGlyphCache() { return fContext->fGlyphCache; } |
Robert Phillips | f35fd8d | 2018-01-22 10:48:15 -0500 | [diff] [blame] | 205 | GrTextBlobCache* getTextBlobCache() { return fContext->fTextBlobCache.get(); } |
Robert Phillips | 1056eb8 | 2018-03-01 14:16:41 -0500 | [diff] [blame] | 206 | |
Robert Phillips | c4039ea | 2018-03-01 11:36:45 -0500 | [diff] [blame] | 207 | // This accessor should only ever be called by the GrOpFlushState. |
Robert Phillips | 5a66efb | 2018-03-07 15:13:18 -0500 | [diff] [blame] | 208 | GrAtlasManager* getAtlasManager() { |
| 209 | return fContext->onGetAtlasManager(); |
Robert Phillips | c4039ea | 2018-03-01 11:36:45 -0500 | [diff] [blame] | 210 | } |
Robert Phillips | f35fd8d | 2018-01-22 10:48:15 -0500 | [diff] [blame] | 211 | |
Robert Phillips | 6200036 | 2018-02-01 09:10:04 -0500 | [diff] [blame] | 212 | void moveOpListsToDDL(SkDeferredDisplayList*); |
| 213 | void copyOpListsFromDDL(const SkDeferredDisplayList*, GrRenderTargetProxy* newDest); |
| 214 | |
Robert Phillips | 0c4b7b1 | 2018-03-06 08:20:37 -0500 | [diff] [blame] | 215 | /** |
| 216 | * Purge all the unlocked resources from the cache. |
| 217 | * This entry point is mainly meant for timing texture uploads |
| 218 | * and is not defined in normal builds of Skia. |
| 219 | */ |
| 220 | void purgeAllUnlockedResources_ForTesting(); |
| 221 | |
| 222 | |
| 223 | /* |
| 224 | * Create a new render target context backed by a deferred-style |
| 225 | * GrRenderTargetProxy. We guarantee that "asTextureProxy" will succeed for |
| 226 | * renderTargetContexts created via this entry point. |
| 227 | */ |
| 228 | sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContext( |
| 229 | SkBackingFit fit, |
| 230 | int width, int height, |
| 231 | GrPixelConfig config, |
| 232 | sk_sp<SkColorSpace> colorSpace, |
| 233 | int sampleCnt = 1, |
| 234 | GrMipMapped = GrMipMapped::kNo, |
| 235 | GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin, |
| 236 | const SkSurfaceProps* surfaceProps = nullptr, |
| 237 | SkBudgeted = SkBudgeted::kYes); |
| 238 | /* |
| 239 | * This method will attempt to create a renderTargetContext that has, at least, the number of |
| 240 | * channels and precision per channel as requested in 'config' (e.g., A8 and 888 can be |
| 241 | * converted to 8888). It may also swizzle the channels (e.g., BGRA -> RGBA). |
| 242 | * SRGB-ness will be preserved. |
| 243 | */ |
| 244 | sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback( |
| 245 | SkBackingFit fit, |
| 246 | int width, int height, |
| 247 | GrPixelConfig config, |
| 248 | sk_sp<SkColorSpace> colorSpace, |
| 249 | int sampleCnt = 1, |
| 250 | GrMipMapped = GrMipMapped::kNo, |
| 251 | GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin, |
| 252 | const SkSurfaceProps* surfaceProps = nullptr, |
| 253 | SkBudgeted budgeted = SkBudgeted::kYes); |
| 254 | |
| 255 | bool abandoned() const; |
| 256 | |
| 257 | /** Reset GPU stats */ |
| 258 | void resetGpuStats() const ; |
| 259 | |
| 260 | /** Prints cache stats to the string if GR_CACHE_STATS == 1. */ |
| 261 | void dumpCacheStats(SkString*) const; |
| 262 | void dumpCacheStatsKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* values) const; |
| 263 | void printCacheStats() const; |
| 264 | |
| 265 | /** Prints GPU stats to the string if GR_GPU_STATS == 1. */ |
| 266 | void dumpGpuStats(SkString*) const; |
| 267 | void dumpGpuStatsKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* values) const; |
| 268 | void printGpuStats() const; |
| 269 | |
| 270 | /** Returns a string with detailed information about the context & GPU, in JSON format. */ |
| 271 | SkString dump() const; |
| 272 | |
| 273 | /** Specify the TextBlob cache limit. If the current cache exceeds this limit it will purge. |
| 274 | this is for testing only */ |
| 275 | void setTextBlobCacheLimit_ForTesting(size_t bytes); |
| 276 | |
| 277 | /** Specify the sizes of the GrAtlasTextContext atlases. The configs pointer below should be |
| 278 | to an array of 3 entries */ |
| 279 | void setTextContextAtlasSizes_ForTesting(const GrDrawOpAtlasConfig* configs); |
| 280 | |
| 281 | /** Get pointer to atlas texture for given mask format. Note that this wraps an |
| 282 | actively mutating texture in an SkImage. This could yield unexpected results |
| 283 | if it gets cached or used more generally. */ |
| 284 | sk_sp<SkImage> getFontAtlasImage_ForTesting(GrMaskFormat format, unsigned int index = 0); |
| 285 | |
| 286 | GrAuditTrail* getAuditTrail() { return &fContext->fAuditTrail; } |
| 287 | |
| 288 | GrContextOptions::PersistentCache* getPersistentCache() { return fContext->fPersistentCache; } |
| 289 | |
| 290 | /** This is only useful for debug purposes */ |
| 291 | SkDEBUGCODE(GrSingleOwner* debugSingleOwner() const { return &fContext->fSingleOwner; } ) |
| 292 | |
robertphillips | 4fd74ae | 2016-08-03 14:26:53 -0700 | [diff] [blame] | 293 | private: |
| 294 | explicit GrContextPriv(GrContext* context) : fContext(context) {} |
Robert Phillips | eb35f4d | 2017-03-21 07:56:47 -0400 | [diff] [blame] | 295 | GrContextPriv(const GrContextPriv&); // unimpl |
robertphillips | 4fd74ae | 2016-08-03 14:26:53 -0700 | [diff] [blame] | 296 | GrContextPriv& operator=(const GrContextPriv&); // unimpl |
| 297 | |
| 298 | // No taking addresses of this type. |
| 299 | const GrContextPriv* operator&() const; |
| 300 | GrContextPriv* operator&(); |
| 301 | |
| 302 | GrContext* fContext; |
| 303 | |
| 304 | friend class GrContext; // to construct/copy this type. |
| 305 | }; |
| 306 | |
| 307 | inline GrContextPriv GrContext::contextPriv() { return GrContextPriv(this); } |
| 308 | |
| 309 | inline const GrContextPriv GrContext::contextPriv () const { |
| 310 | return GrContextPriv(const_cast<GrContext*>(this)); |
| 311 | } |
| 312 | |
| 313 | #endif |