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

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

Issue 1918003003: Bring sk_sp to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 GrDrawContext_DEFINED 8 #ifndef GrDrawContext_DEFINED
9 #define GrDrawContext_DEFINED 9 #define GrDrawContext_DEFINED
10 10
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 * 271 *
272 * TODO: Figure out a better model that allows us to roll this method into d rawBatch. 272 * TODO: Figure out a better model that allows us to roll this method into d rawBatch.
273 */ 273 */
274 void drawPathBatch(const GrPipelineBuilder&, GrDrawPathBatchBase*); 274 void drawPathBatch(const GrPipelineBuilder&, GrDrawPathBatchBase*);
275 275
276 int width() const { return fRenderTarget->width(); } 276 int width() const { return fRenderTarget->width(); }
277 int height() const { return fRenderTarget->height(); } 277 int height() const { return fRenderTarget->height(); }
278 int numColorSamples() const { return fRenderTarget->numColorSamples(); } 278 int numColorSamples() const { return fRenderTarget->numColorSamples(); }
279 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } 279 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); }
280 280
281 GrRenderTarget* accessRenderTarget() { return fRenderTarget; } 281 GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); }
282
283 sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; }
284
285 sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture()); }
282 286
283 // Provides access to functions that aren't part of the public API. 287 // Provides access to functions that aren't part of the public API.
284 GrDrawContextPriv drawContextPriv(); 288 GrDrawContextPriv drawContextPriv();
285 const GrDrawContextPriv drawContextPriv() const; 289 const GrDrawContextPriv drawContextPriv() const;
286 290
287 protected: 291 protected:
288 GrDrawContext(GrContext*, GrDrawingManager*, GrRenderTarget*, 292 GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>,
289 const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwn er*); 293 const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwn er*);
290 294
291 GrDrawingManager* drawingManager() { return fDrawingManager; } 295 GrDrawingManager* drawingManager() { return fDrawingManager; }
292 GrAuditTrail* auditTrail() { return fAuditTrail; } 296 GrAuditTrail* auditTrail() { return fAuditTrail; }
293 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } 297 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
294 298
295 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) 299 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; })
296 SkDEBUGCODE(void validate() const;) 300 SkDEBUGCODE(void validate() const;)
297 301
298 private: 302 private:
(...skipping 17 matching lines...) Expand all
316 const SkPath& path, 320 const SkPath& path,
317 const GrStrokeInfo& strokeInfo); 321 const GrStrokeInfo& strokeInfo);
318 322
319 // This entry point allows the GrTextContext-derived classes to add their ba tches to 323 // This entry point allows the GrTextContext-derived classes to add their ba tches to
320 // the drawTarget. 324 // the drawTarget.
321 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch); 325 void drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch);
322 326
323 GrDrawTarget* getDrawTarget(); 327 GrDrawTarget* getDrawTarget();
324 328
325 GrDrawingManager* fDrawingManager; 329 GrDrawingManager* fDrawingManager;
326 GrRenderTarget* fRenderTarget; 330 sk_sp<GrRenderTarget> fRenderTarget;
327 331
328 // In MDB-mode the drawTarget can be closed by some other drawContext that h as picked 332 // In MDB-mode the drawTarget can be closed by some other drawContext that h as picked
329 // it up. For this reason, the drawTarget should only ever be accessed via ' getDrawTarget'. 333 // it up. For this reason, the drawTarget should only ever be accessed via ' getDrawTarget'.
330 GrDrawTarget* fDrawTarget; 334 GrDrawTarget* fDrawTarget;
331 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; 335 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext;
332 GrContext* fContext; 336 GrContext* fContext;
333 337
334 SkSurfaceProps fSurfaceProps; 338 SkSurfaceProps fSurfaceProps;
335 GrAuditTrail* fAuditTrail; 339 GrAuditTrail* fAuditTrail;
336 340
337 // In debug builds we guard against improper thread handling 341 // In debug builds we guard against improper thread handling
338 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) 342 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)
339 }; 343 };
340 344
341 #endif 345 #endif
OLDNEW
« gm/beziereffects.cpp ('K') | « include/gpu/GrContext.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698