| OLD | NEW |
| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 return fRenderTarget->isStencilBufferMultisampled(); | 257 return fRenderTarget->isStencilBufferMultisampled(); |
| 258 } | 258 } |
| 259 bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisam
pled(); } | 259 bool isUnifiedMultisampled() const { return fRenderTarget->isUnifiedMultisam
pled(); } |
| 260 bool hasMixedSamples() const { return fRenderTarget->hasMixedSamples(); } | 260 bool hasMixedSamples() const { return fRenderTarget->hasMixedSamples(); } |
| 261 | 261 |
| 262 bool mustUseHWAA(const GrPaint& paint) const { | 262 bool mustUseHWAA(const GrPaint& paint) const { |
| 263 return paint.isAntiAlias() && fRenderTarget->isUnifiedMultisampled(); | 263 return paint.isAntiAlias() && fRenderTarget->isUnifiedMultisampled(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); } | 266 const GrSurfaceDesc& desc() const { return fRenderTarget->desc(); } |
| 267 int width() const { return fRenderTarget->width(); } | 267 int width() const { return fWidth; } |
| 268 int height() const { return fRenderTarget->height(); } | 268 int height() const { return fHeight; } |
| 269 GrPixelConfig config() const { return fRenderTarget->config(); } | 269 GrPixelConfig config() const { return fRenderTarget->config(); } |
| 270 int numColorSamples() const { return fRenderTarget->numColorSamples(); } | 270 int numColorSamples() const { return fRenderTarget->numColorSamples(); } |
| 271 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } | 271 bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); } |
| 272 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } | 272 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } |
| 273 | 273 |
| 274 bool wasAbandoned() const; | 274 bool wasAbandoned() const; |
| 275 | 275 |
| 276 GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); } | 276 GrRenderTarget* accessRenderTarget() { return fRenderTarget.get(); } |
| 277 | 277 |
| 278 sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; } | 278 sk_sp<GrRenderTarget> renderTarget() { return fRenderTarget; } |
| 279 | 279 |
| 280 sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture());
} | 280 sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture());
} |
| 281 | 281 |
| 282 // Provides access to functions that aren't part of the public API. | 282 // Provides access to functions that aren't part of the public API. |
| 283 GrDrawContextPriv drawContextPriv(); | 283 GrDrawContextPriv drawContextPriv(); |
| 284 const GrDrawContextPriv drawContextPriv() const; | 284 const GrDrawContextPriv drawContextPriv() const; |
| 285 | 285 |
| 286 GrAuditTrail* auditTrail() { return fAuditTrail; } | 286 GrAuditTrail* auditTrail() { return fAuditTrail; } |
| 287 | 287 |
| 288 protected: | 288 protected: |
| 289 GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>, | 289 GrDrawContext(GrContext*, GrDrawingManager*, int width, int height, sk_sp<Gr
RenderTarget>, |
| 290 const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwn
er*); | 290 const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwn
er*); |
| 291 | 291 |
| 292 GrDrawingManager* drawingManager() { return fDrawingManager; } | 292 GrDrawingManager* drawingManager() { return fDrawingManager; } |
| 293 | 293 |
| 294 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) | 294 SkDEBUGCODE(GrSingleOwner* singleOwner() { return fSingleOwner; }) |
| 295 SkDEBUGCODE(void validate() const;) | 295 SkDEBUGCODE(void validate() const;) |
| 296 | 296 |
| 297 private: | 297 private: |
| 298 friend class GrAtlasTextBlob; // for access to drawBatch | 298 friend class GrAtlasTextBlob; // for access to drawBatch |
| 299 friend class GrStencilAndCoverTextContext; // for access to drawBatch | 299 friend class GrStencilAndCoverTextContext; // for access to drawBatch |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 const SkPath& path, | 343 const SkPath& path, |
| 344 const GrStyle& style); | 344 const GrStyle& style); |
| 345 | 345 |
| 346 // This entry point allows the GrTextContext-derived classes to add their ba
tches to | 346 // This entry point allows the GrTextContext-derived classes to add their ba
tches to |
| 347 // the drawTarget. | 347 // the drawTarget. |
| 348 void drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip&, GrDr
awBatch* batch); | 348 void drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip&, GrDr
awBatch* batch); |
| 349 | 349 |
| 350 GrDrawTarget* getDrawTarget(); | 350 GrDrawTarget* getDrawTarget(); |
| 351 | 351 |
| 352 GrDrawingManager* fDrawingManager; | 352 GrDrawingManager* fDrawingManager; |
| 353 |
| 354 // The width & height of the drawContext may be less than the width & height
of the |
| 355 // underlying renderTarget |
| 356 int fWidth; |
| 357 int fHeight; |
| 353 sk_sp<GrRenderTarget> fRenderTarget; | 358 sk_sp<GrRenderTarget> fRenderTarget; |
| 354 | 359 |
| 355 // In MDB-mode the drawTarget can be closed by some other drawContext that h
as picked | 360 // In MDB-mode the drawTarget can be closed by some other drawContext that h
as picked |
| 356 // it up. For this reason, the drawTarget should only ever be accessed via '
getDrawTarget'. | 361 // it up. For this reason, the drawTarget should only ever be accessed via '
getDrawTarget'. |
| 357 GrDrawTarget* fDrawTarget; | 362 GrDrawTarget* fDrawTarget; |
| 358 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; | 363 SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext; |
| 359 GrContext* fContext; | 364 GrContext* fContext; |
| 360 GrInstancedPipelineInfo fInstancedPipelineInfo; | 365 GrInstancedPipelineInfo fInstancedPipelineInfo; |
| 361 | 366 |
| 362 SkSurfaceProps fSurfaceProps; | 367 SkSurfaceProps fSurfaceProps; |
| 363 GrAuditTrail* fAuditTrail; | 368 GrAuditTrail* fAuditTrail; |
| 364 | 369 |
| 365 // In debug builds we guard against improper thread handling | 370 // In debug builds we guard against improper thread handling |
| 366 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) | 371 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
| 367 }; | 372 }; |
| 368 | 373 |
| 369 #endif | 374 #endif |
| OLD | NEW |