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

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: Omission with non-inverted path bounds fixed 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 setPathStencilSettings(const GrStencilSettings& settings) {
339 fPathStencilSettings = settings;
340 }
341
342 // overridden by backend-specific derived class to perform the path stencili ng.
343 virtual const GrStencilSettings& getPathStencilSettingsForFillType(SkPath::F illType) = 0;
bsalomon 2013/09/18 14:24:22 I wonder if this needs to be virtual. It seems lik
344
338 protected: 345 protected:
339 enum DrawType { 346 enum DrawType {
340 kDrawPoints_DrawType, 347 kDrawPoints_DrawType,
341 kDrawLines_DrawType, 348 kDrawLines_DrawType,
342 kDrawTriangles_DrawType, 349 kDrawTriangles_DrawType,
343 kStencilPath_DrawType, 350 kStencilPath_DrawType,
351 kFillPath_DrawType,
344 }; 352 };
345 353
346 DrawType PrimTypeToDrawType(GrPrimitiveType type) { 354 DrawType PrimTypeToDrawType(GrPrimitiveType type) {
347 switch (type) { 355 switch (type) {
348 case kTriangles_GrPrimitiveType: 356 case kTriangles_GrPrimitiveType:
349 case kTriangleStrip_GrPrimitiveType: 357 case kTriangleStrip_GrPrimitiveType:
350 case kTriangleFan_GrPrimitiveType: 358 case kTriangleFan_GrPrimitiveType:
351 return kDrawTriangles_DrawType; 359 return kDrawTriangles_DrawType;
352 case kPoints_GrPrimitiveType: 360 case kPoints_GrPrimitiveType:
353 return kDrawPoints_DrawType; 361 return kDrawPoints_DrawType;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 398 }
391 399
392 // The state of the scissor is controlled by the clip manager 400 // The state of the scissor is controlled by the clip manager
393 struct ScissorState { 401 struct ScissorState {
394 bool fEnabled; 402 bool fEnabled;
395 SkIRect fRect; 403 SkIRect fRect;
396 } fScissorState; 404 } fScissorState;
397 405
398 // The final stencil settings to use as determined by the clip manager. 406 // The final stencil settings to use as determined by the clip manager.
399 GrStencilSettings fStencilSettings; 407 GrStencilSettings fStencilSettings;
408 // The final stencil setting to use when stenciling a path with stencilPath.
409 GrStencilSettings fPathStencilSettings;
400 410
401 // Derived classes need access to this so they can fill it out in their 411 // Derived classes need access to this so they can fill it out in their
402 // constructors 412 // constructors
403 bool fConfigRenderSupport[kGrPixelConfigCnt]; 413 bool fConfigRenderSupport[kGrPixelConfigCnt];
404 414
405 // Helpers for setting up geometry state 415 // Helpers for setting up geometry state
406 void finalizeReservedVertices(); 416 void finalizeReservedVertices();
407 void finalizeReservedIndices(); 417 void finalizeReservedIndices();
408 418
409 private: 419 private:
(...skipping 23 matching lines...) Expand all
433 virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size, bool dynamic) = 0; 443 virtual GrVertexBuffer* onCreateVertexBuffer(uint32_t size, bool dynamic) = 0;
434 virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0; 444 virtual GrIndexBuffer* onCreateIndexBuffer(uint32_t size, bool dynamic) = 0;
435 virtual GrPath* onCreatePath(const SkPath& path) = 0; 445 virtual GrPath* onCreatePath(const SkPath& path) = 0;
436 446
437 // overridden by backend-specific derived class to perform the clear and 447 // overridden by backend-specific derived class to perform the clear and
438 // clearRect. NULL rect means clear whole target. 448 // clearRect. NULL rect means clear whole target.
439 virtual void onClear(const SkIRect* rect, GrColor color) = 0; 449 virtual void onClear(const SkIRect* rect, GrColor color) = 0;
440 450
441 // overridden by backend-specific derived class to perform the draw call. 451 // overridden by backend-specific derived class to perform the draw call.
442 virtual void onGpuDraw(const DrawInfo&) = 0; 452 virtual void onGpuDraw(const DrawInfo&) = 0;
443 // when GrDrawTarget::stencilPath is called the draw state's current stencil 453
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. 454 // overridden by backend-specific derived class to perform the path stencili ng.
451 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0; 455 virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) = 0;
456 virtual void onGpuFillPath(const GrPath*, SkPath::FillType) = 0;
452 457
453 // overridden by backend-specific derived class to perform flush 458 // overridden by backend-specific derived class to perform flush
454 virtual void onForceRenderTargetFlush() = 0; 459 virtual void onForceRenderTargetFlush() = 0;
455 460
456 // overridden by backend-specific derived class to perform the read pixels. 461 // overridden by backend-specific derived class to perform the read pixels.
457 virtual bool onReadPixels(GrRenderTarget* target, 462 virtual bool onReadPixels(GrRenderTarget* target,
458 int left, int top, int width, int height, 463 int left, int top, int width, int height,
459 GrPixelConfig, 464 GrPixelConfig,
460 void* buffer, 465 void* buffer,
461 size_t rowBytes) = 0; 466 size_t rowBytes) = 0;
(...skipping 25 matching lines...) Expand all
487 virtual void clearStencil() = 0; 492 virtual void clearStencil() = 0;
488 493
489 // Given a rt, find or create a stencil buffer and attach it 494 // Given a rt, find or create a stencil buffer and attach it
490 bool attachStencilBufferToRenderTarget(GrRenderTarget* target); 495 bool attachStencilBufferToRenderTarget(GrRenderTarget* target);
491 496
492 // GrDrawTarget overrides 497 // GrDrawTarget overrides
493 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; 498 virtual void onDraw(const DrawInfo&) SK_OVERRIDE;
494 virtual void onStencilPath(const GrPath* path, const SkStrokeRec& stroke, 499 virtual void onStencilPath(const GrPath* path, const SkStrokeRec& stroke,
495 SkPath::FillType) SK_OVERRIDE; 500 SkPath::FillType) SK_OVERRIDE;
496 501
502 virtual void onFillPath(const GrPath* path, const SkStrokeRec& stroke,
503 SkPath::FillType) SK_OVERRIDE;
504
497 // readies the pools to provide vertex/index data. 505 // readies the pools to provide vertex/index data.
498 void prepareVertexPool(); 506 void prepareVertexPool();
499 void prepareIndexPool(); 507 void prepareIndexPool();
500 508
501 void resetContext() { 509 void resetContext() {
502 // We call this because the client may have messed with the 510 // We call this because the client may have messed with the
503 // stencil buffer. Perhaps we should detect whether it is a 511 // stencil buffer. Perhaps we should detect whether it is a
504 // internally created stencil buffer and if so skip the invalidate. 512 // internally created stencil buffer and if so skip the invalidate.
505 fClipMaskManager.invalidateStencilMask(); 513 fClipMaskManager.invalidateStencilMask();
506 this->onResetContext(fResetBits); 514 this->onResetContext(fResetBits);
(...skipping 22 matching lines...) Expand all
529 // these are mutable so they can be created on-demand 537 // these are mutable so they can be created on-demand
530 mutable GrIndexBuffer* fQuadInd exBuffer; 538 mutable GrIndexBuffer* fQuadInd exBuffer;
531 // Used to abandon/release all resources created by this GrGpu. TODO: Move t his 539 // Used to abandon/release all resources created by this GrGpu. TODO: Move t his
532 // functionality to GrResourceCache. 540 // functionality to GrResourceCache.
533 ResourceList fResourc eList; 541 ResourceList fResourc eList;
534 542
535 typedef GrDrawTarget INHERITED; 543 typedef GrDrawTarget INHERITED;
536 }; 544 };
537 545
538 #endif 546 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698