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

Side by Side Diff: src/gpu/GrGpu.h

Issue 22686002: Implement path cover with nv_path_rendering (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebased to issue 23537028 Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 GrGpu_DEFINED 8 #ifndef GrGpu_DEFINED
9 #define GrGpu_DEFINED 9 #define GrGpu_DEFINED
10 10
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 virtual void clearStencilClip(const SkIRect& rect, bool insideClip) = 0; 328 virtual void clearStencilClip(const SkIRect& rect, bool insideClip) = 0;
329 329
330 enum PrivateDrawStateStateBits { 330 enum PrivateDrawStateStateBits {
331 kFirstBit = (GrDrawState::kLastPublicStateBit << 1), 331 kFirstBit = (GrDrawState::kLastPublicStateBit << 1),
332 332
333 kModifyStencilClip_StateBit = kFirstBit, // allows draws to modify 333 kModifyStencilClip_StateBit = kFirstBit, // allows draws to modify
334 // stencil bits used for 334 // stencil bits used for
335 // clipping. 335 // clipping.
336 }; 336 };
337 337
338 void setStencilPathSettings(const GrStencilSettings& settings) {
339 fStencilPathSettings = settings;
340 }
341
338 protected: 342 protected:
339 enum DrawType { 343 enum DrawType {
340 kDrawPoints_DrawType, 344 kDrawPoints_DrawType,
341 kDrawLines_DrawType, 345 kDrawLines_DrawType,
342 kDrawTriangles_DrawType, 346 kDrawTriangles_DrawType,
343 kStencilPath_DrawType, 347 kStencilPath_DrawType,
348 kDrawPath_DrawType,
344 }; 349 };
345 350
346 DrawType PrimTypeToDrawType(GrPrimitiveType type) { 351 DrawType PrimTypeToDrawType(GrPrimitiveType type) {
347 switch (type) { 352 switch (type) {
348 case kTriangles_GrPrimitiveType: 353 case kTriangles_GrPrimitiveType:
349 case kTriangleStrip_GrPrimitiveType: 354 case kTriangleStrip_GrPrimitiveType:
350 case kTriangleFan_GrPrimitiveType: 355 case kTriangleFan_GrPrimitiveType:
351 return kDrawTriangles_DrawType; 356 return kDrawTriangles_DrawType;
352 case kPoints_GrPrimitiveType: 357 case kPoints_GrPrimitiveType:
353 return kDrawPoints_DrawType; 358 return kDrawPoints_DrawType;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 395 }
391 396
392 // The state of the scissor is controlled by the clip manager 397 // The state of the scissor is controlled by the clip manager
393 struct ScissorState { 398 struct ScissorState {
394 bool fEnabled; 399 bool fEnabled;
395 SkIRect fRect; 400 SkIRect fRect;
396 } fScissorState; 401 } fScissorState;
397 402
398 // The final stencil settings to use as determined by the clip manager. 403 // The final stencil settings to use as determined by the clip manager.
399 GrStencilSettings fStencilSettings; 404 GrStencilSettings fStencilSettings;
405 GrStencilSettings fStencilPathSettings;
400 406
401 // Derived classes need access to this so they can fill it out in their 407 // Derived classes need access to this so they can fill it out in their
402 // constructors 408 // constructors
403 bool fConfigRenderSupport[kGrPixelConfigCnt]; 409 bool fConfigRenderSupport[kGrPixelConfigCnt];
404 410
405 // Helpers for setting up geometry state 411 // Helpers for setting up geometry state
406 void finalizeReservedVertices(); 412 void finalizeReservedVertices();
407 void finalizeReservedIndices(); 413 void finalizeReservedIndices();
408 414
409 private: 415 private:
(...skipping 23 matching lines...) Expand all
433 virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size, bool dynamic) = 0; 439 virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size, bool dynamic) = 0;
434 virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0; 440 virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0;
435 virtual GrPath* onCreatePath(const SkPath& path) = 0; 441 virtual GrPath* onCreatePath(const SkPath& path) = 0;
436 442
437 // overridden by backend-specific derived class to perform the clear and 443 // overridden by backend-specific derived class to perform the clear and
438 // clearRect. NULL rect means clear whole target. 444 // clearRect. NULL rect means clear whole target.
439 virtual void onClear(const SkIRect* rect, GrColor color) = 0; 445 virtual void onClear(const SkIRect* rect, GrColor color) = 0;
440 446
441 // overridden by backend-specific derived class to perform the draw call. 447 // overridden by backend-specific derived class to perform the draw call.
442 virtual void onGpuDraw(const DrawInfo&) = 0; 448 virtual void onGpuDraw(const DrawInfo&) = 0;
443 // when GrDrawTarget::stencilPath is called the draw state's current stencil 449
444 // settings are ignored. Instead the GrGpu decides the stencil rules
445 // necessary to stencil the path. These are still subject to filtering by
446 // the clip mask manager.
447 virtual void setStencilPathSettings(const GrPath&,
448 SkPath::FillType,
449 GrStencilSettings* settings) = 0;
450 // overridden by backend-specific derived class to perform the path stencili ng. 450 // overridden by backend-specific derived class to perform the path stencili ng.
451 virtual const GrStencilSettings& getStencilPathSettings(const GrPath&,
452 SkPath::FillType) = 0;
451 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0; 453 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0;
454 virtual void onGpuDrawPath(const GrPath*, SkPath::FillType) = 0;
452 455
453 // overridden by backend-specific derived class to perform flush 456 // overridden by backend-specific derived class to perform flush
454 virtual void onForceRenderTargetFlush() = 0; 457 virtual void onForceRenderTargetFlush() = 0;
455 458
456 // overridden by backend-specific derived class to perform the read pixels. 459 // overridden by backend-specific derived class to perform the read pixels.
457 virtual bool onReadPixels(GrRenderTarget* target, 460 virtual bool onReadPixels(GrRenderTarget* target,
458 int left, int top, int width, int height, 461 int left, int top, int width, int height,
459 GrPixelConfig, 462 GrPixelConfig,
460 void* buffer, 463 void* buffer,
461 size_t rowBytes) = 0; 464 size_t rowBytes) = 0;
(...skipping 25 matching lines...) Expand all
487 virtual void clearStencil() = 0; 490 virtual void clearStencil() = 0;
488 491
489 // Given a rt, find or create a stencil buffer and attach it 492 // Given a rt, find or create a stencil buffer and attach it
490 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); 493 bool attachStencilBufferToRenderTarget(GrRenderTarget* target);
491 494
492 // GrDrawTarget overrides 495 // GrDrawTarget overrides
493 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; 496 virtual void onDraw(const DrawInfo&) SK_OVERRIDE;
494 virtual void onStencilPath(const GrPath* path, const SkStrokeRec& stroke, 497 virtual void onStencilPath(const GrPath* path, const SkStrokeRec& stroke,
495 SkPath::FillType) SK_OVERRIDE; 498 SkPath::FillType) SK_OVERRIDE;
496 499
500 virtual void onDrawPath(const GrPath* path, const SkStrokeRec& stroke,
501 SkPath::FillType) SK_OVERRIDE;
502
497 // readies the pools to provide vertex/index data. 503 // readies the pools to provide vertex/index data.
498 void prepareVertexPool(); 504 void prepareVertexPool();
499 void prepareIndexPool(); 505 void prepareIndexPool();
500 506
501 void resetContext() { 507 void resetContext() {
502 // We call this because the client may have messed with the 508 // We call this because the client may have messed with the
503 // stencil buffer. Perhaps we should detect whether it is a 509 // stencil buffer. Perhaps we should detect whether it is a
504 // internally created stencil buffer and if so skip the invalidate. 510 // internally created stencil buffer and if so skip the invalidate.
505 fClipMaskManager.invalidateStencilMask(); 511 fClipMaskManager.invalidateStencilMask();
506 this->onResetContext(fResetBits); 512 this->onResetContext(fResetBits);
(...skipping 22 matching lines...) Expand all
529 // these are mutable so they can be created on-demand 535 // these are mutable so they can be created on-demand
530 mutable GrIndexBuffer* fQuadInd exBuffer; 536 mutable GrIndexBuffer* fQuadInd exBuffer;
531 // Used to abandon/release all resources created by this GrGpu. TODO: Move t his 537 // Used to abandon/release all resources created by this GrGpu. TODO: Move t his
532 // functionality to GrResourceCache. 538 // functionality to GrResourceCache.
533 ResourceList fResourc eList; 539 ResourceList fResourc eList;
534 540
535 typedef GrDrawTarget INHERITED; 541 typedef GrDrawTarget INHERITED;
536 }; 542 };
537 543
538 #endif 544 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698