Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: include/gpu/GrContext.h

Issue 2211473002: Move GrContext::makeDrawContext to new GrContextPriv object (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix fragment Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrContext_DEFINED 8 #ifndef GrContext_DEFINED
9 #define GrContext_DEFINED 9 #define GrContext_DEFINED
10 10
11 #include "GrCaps.h" 11 #include "GrCaps.h"
12 #include "GrClip.h" 12 #include "GrClip.h"
13 #include "GrColor.h" 13 #include "GrColor.h"
14 #include "GrPaint.h" 14 #include "GrPaint.h"
15 #include "GrRenderTarget.h" 15 #include "GrRenderTarget.h"
16 #include "GrTextureProvider.h" 16 #include "GrTextureProvider.h"
17 #include "SkMatrix.h" 17 #include "SkMatrix.h"
18 #include "SkPathEffect.h" 18 #include "SkPathEffect.h"
19 #include "SkTypes.h" 19 #include "SkTypes.h"
20 #include "../private/GrAuditTrail.h" 20 #include "../private/GrAuditTrail.h"
21 #include "../private/GrSingleOwner.h" 21 #include "../private/GrSingleOwner.h"
22 #include "../private/SkMutex.h" 22 #include "../private/SkMutex.h"
23 23
24 struct GrBatchAtlasConfig; 24 struct GrBatchAtlasConfig;
25 class GrBatchFontCache; 25 class GrBatchFontCache;
26 struct GrContextOptions; 26 struct GrContextOptions;
27 class GrContextPriv;
27 class GrContextThreadSafeProxy; 28 class GrContextThreadSafeProxy;
28 class GrDrawingManager; 29 class GrDrawingManager;
29 class GrDrawContext; 30 class GrDrawContext;
30 class GrFragmentProcessor; 31 class GrFragmentProcessor;
31 class GrGpu; 32 class GrGpu;
32 class GrIndexBuffer; 33 class GrIndexBuffer;
33 class GrOvalRenderer; 34 class GrOvalRenderer;
34 class GrPath; 35 class GrPath;
35 class GrPipelineBuilder; 36 class GrPipelineBuilder;
36 class GrResourceEntry; 37 class GrResourceEntry;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 * @param config the configuration of the render target. 174 * @param config the configuration of the render target.
174 * @param dpi the display density in dots per inch. 175 * @param dpi the display density in dots per inch.
175 * 176 *
176 * @return sample count that should be perform well and have good enough 177 * @return sample count that should be perform well and have good enough
177 * rendering quality for the display. Alternatively returns 0 if 178 * rendering quality for the display. Alternatively returns 0 if
178 * MSAA is not supported or recommended to be used by default. 179 * MSAA is not supported or recommended to be used by default.
179 */ 180 */
180 int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const; 181 int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const;
181 182
182 /** 183 /**
183 * Returns a helper object to orchestrate draws.
184 * Callers assume the creation ref of the drawContext
185 * NULL will be returned if the context has been abandoned.
186 *
187 * @param rt the render target receiving the draws
188 * @param surfaceProps the surface properties (mainly defines text drawing)
189 *
190 * @return a draw context
191 */
192 sk_sp<GrDrawContext> makeDrawContext(sk_sp<GrRenderTarget> rt, sk_sp<SkColor Space> colorSpace,
193 const SkSurfaceProps* = nullptr);
194
195 /**
196 * Create both a GrRenderTarget and a matching GrDrawContext to wrap it. 184 * Create both a GrRenderTarget and a matching GrDrawContext to wrap it.
197 * We guarantee that "asTexture" will succeed for drawContexts created 185 * We guarantee that "asTexture" will succeed for drawContexts created
198 * via this entry point. 186 * via this entry point.
199 */ 187 */
200 sk_sp<GrDrawContext> makeDrawContext(SkBackingFit fit, 188 sk_sp<GrDrawContext> makeDrawContext(SkBackingFit fit,
201 int width, int height, 189 int width, int height,
202 GrPixelConfig config, 190 GrPixelConfig config,
203 sk_sp<SkColorSpace> colorSpace, 191 sk_sp<SkColorSpace> colorSpace,
204 int sampleCnt = 0, 192 int sampleCnt = 0,
205 GrSurfaceOrigin origin = kDefault_GrSur faceOrigin, 193 GrSurfaceOrigin origin = kDefault_GrSur faceOrigin,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const; 360 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const;
373 361
374 /** Get pointer to atlas texture for given mask format */ 362 /** Get pointer to atlas texture for given mask format */
375 GrTexture* getFontAtlasTexture(GrMaskFormat format); 363 GrTexture* getFontAtlasTexture(GrMaskFormat format);
376 364
377 GrAuditTrail* getAuditTrail() { return &fAuditTrail; } 365 GrAuditTrail* getAuditTrail() { return &fAuditTrail; }
378 366
379 /** This is only useful for debug purposes */ 367 /** This is only useful for debug purposes */
380 SkDEBUGCODE(GrSingleOwner* debugSingleOwner() const { return &fSingleOwner; } ) 368 SkDEBUGCODE(GrSingleOwner* debugSingleOwner() const { return &fSingleOwner; } )
381 369
370 // Provides access to functions that aren't part of the public API.
371 GrContextPriv contextPriv();
372 const GrContextPriv contextPriv() const;
373
382 private: 374 private:
383 GrGpu* fGpu; 375 GrGpu* fGpu;
384 const GrCaps* fCaps; 376 const GrCaps* fCaps;
385 GrResourceCache* fResourceCache; 377 GrResourceCache* fResourceCache;
386 // this union exists because the inheritance of GrTextureProvider->GrResourc eProvider 378 // this union exists because the inheritance of GrTextureProvider->GrResourc eProvider
387 // is in a private header. 379 // is in a private header.
388 union { 380 union {
389 GrResourceProvider* fResourceProvider; 381 GrResourceProvider* fResourceProvider;
390 GrTextureProvider* fTextureProvider; 382 GrTextureProvider* fTextureProvider;
391 }; 383 };
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 419
428 const uint32_t fUniqueID; 420 const uint32_t fUniqueID;
429 421
430 SkAutoTDelete<GrDrawingManager> fDrawingManager; 422 SkAutoTDelete<GrDrawingManager> fDrawingManager;
431 423
432 GrAuditTrail fAuditTrail; 424 GrAuditTrail fAuditTrail;
433 425
434 // TODO: have the CMM use drawContexts and rm this friending 426 // TODO: have the CMM use drawContexts and rm this friending
435 friend class GrClipMaskManager; // the CMM is friended just so it can call ' drawingManager' 427 friend class GrClipMaskManager; // the CMM is friended just so it can call ' drawingManager'
436 friend class GrDrawingManager; // for access to drawingManager for ProgramU nitTest 428 friend class GrDrawingManager; // for access to drawingManager for ProgramU nitTest
429 friend class GrContextPriv;
437 GrDrawingManager* drawingManager() { return fDrawingManager; } 430 GrDrawingManager* drawingManager() { return fDrawingManager; }
438 431
439 GrContext(); // init must be called after the constructor. 432 GrContext(); // init must be called after the constructor.
440 bool init(GrBackend, GrBackendContext, const GrContextOptions& options); 433 bool init(GrBackend, GrBackendContext, const GrContextOptions& options);
441 434
442 void initMockContext(); 435 void initMockContext();
443 void initCommon(const GrContextOptions&); 436 void initCommon(const GrContextOptions&);
444 437
445 /** 438 /**
446 * These functions create premul <-> unpremul effects if it is possible to g enerate a pair 439 * These functions create premul <-> unpremul effects if it is possible to g enerate a pair
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 SkAutoTUnref<const GrCaps> fCaps; 480 SkAutoTUnref<const GrCaps> fCaps;
488 uint32_t fContextUniqueID; 481 uint32_t fContextUniqueID;
489 482
490 friend class GrContext; 483 friend class GrContext;
491 friend class SkImage; 484 friend class SkImage;
492 485
493 typedef SkRefCnt INHERITED; 486 typedef SkRefCnt INHERITED;
494 }; 487 };
495 488
496 #endif 489 #endif
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698