OLD | NEW |
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 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that | 380 * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that |
381 * the client will resolve to a texture). | 381 * the client will resolve to a texture). |
382 * | 382 * |
383 * @param desc description of the object to create. | 383 * @param desc description of the object to create. |
384 * | 384 * |
385 * @return GrTexture object or NULL on failure. | 385 * @return GrTexture object or NULL on failure. |
386 */ | 386 */ |
387 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& de
sc); | 387 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& de
sc); |
388 | 388 |
389 /////////////////////////////////////////////////////////////////////////// | 389 /////////////////////////////////////////////////////////////////////////// |
390 // Matrix state | |
391 | |
392 /** | |
393 * Gets the current transformation matrix. | |
394 * @return the current matrix. | |
395 */ | |
396 const SkMatrix& getMatrix() const { return fViewMatrix; } | |
397 | |
398 /** | |
399 * Sets the transformation matrix. | |
400 * @param m the matrix to set. | |
401 */ | |
402 void setMatrix(const SkMatrix& m) { fViewMatrix = m; } | |
403 | |
404 /** | |
405 * Sets the current transformation matrix to identity. | |
406 */ | |
407 void setIdentityMatrix() { fViewMatrix.reset(); } | |
408 | |
409 /** | |
410 * Concats the current matrix. The passed matrix is applied before the | |
411 * current matrix. | |
412 * @param m the matrix to concat. | |
413 */ | |
414 void concatMatrix(const SkMatrix& m) { fViewMatrix.preConcat(m); } | |
415 | |
416 | |
417 /////////////////////////////////////////////////////////////////////////// | |
418 // Clip state | 390 // Clip state |
419 /** | 391 /** |
420 * Gets the current clip. | 392 * Gets the current clip. |
421 * @return the current clip. | 393 * @return the current clip. |
422 */ | 394 */ |
423 const GrClipData* getClip() const { return fClip; } | 395 const GrClipData* getClip() const { return fClip; } |
424 | 396 |
425 /** | 397 /** |
426 * Sets the clip. | 398 * Sets the clip. |
427 * @param clipData the clip to set. | 399 * @param clipData the clip to set. |
428 */ | 400 */ |
429 void setClip(const GrClipData* clipData) { fClip = clipData; } | 401 void setClip(const GrClipData* clipData) { fClip = clipData; } |
430 | 402 |
431 /////////////////////////////////////////////////////////////////////////// | 403 /////////////////////////////////////////////////////////////////////////// |
432 // Draws | 404 // Draws |
433 | 405 |
434 /** | 406 /** |
435 * Clear the entire or rect of the render target, ignoring any clips. | 407 * Clear the entire or rect of the render target, ignoring any clips. |
436 * @param rect the rect to clear or the whole thing if rect is NULL. | 408 * @param rect the rect to clear or the whole thing if rect is NULL. |
437 * @param color the color to clear to. | 409 * @param color the color to clear to. |
438 * @param canIgnoreRect allows partial clears to be converted to whole | 410 * @param canIgnoreRect allows partial clears to be converted to whole |
439 * clears on platforms for which that is cheap | 411 * clears on platforms for which that is cheap |
440 * @param target The render target to clear. | 412 * @param target The render target to clear. |
441 */ | 413 */ |
442 void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect, GrRenderT
arget* target); | 414 void clear(const SkIRect* rect, GrColor color, bool canIgnoreRect, GrRenderT
arget* target); |
443 | 415 |
444 /** | 416 /** |
445 * Draw everywhere (respecting the clip) with the paint. | 417 * Draw everywhere (respecting the clip) with the paint. |
446 */ | 418 */ |
447 void drawPaint(const GrPaint& paint); | 419 void drawPaint(const GrPaint&, const SkMatrix& viewMatrix); |
448 | 420 |
449 /** | 421 /** |
450 * Draw the rect using a paint. | 422 * Draw the rect using a paint. |
451 * @param paint describes how to color pixels. | 423 * @param paint describes how to color pixels. |
| 424 * @param viewMatrix transformation matrix |
452 * @param strokeInfo the stroke information (width, join, cap), and. | 425 * @param strokeInfo the stroke information (width, join, cap), and. |
453 * the dash information (intervals, count, phase). | 426 * the dash information (intervals, count, phase). |
454 * If strokeInfo == NULL, then the rect is filled. | 427 * If strokeInfo == NULL, then the rect is filled. |
455 * Otherwise, if stroke width == 0, then the stroke | 428 * Otherwise, if stroke width == 0, then the stroke |
456 * is always a single pixel thick, else the rect is | 429 * is always a single pixel thick, else the rect is |
457 * mitered/beveled stroked based on stroke width. | 430 * mitered/beveled stroked based on stroke width. |
458 * The rects coords are used to access the paint (through texture matrix) | 431 * The rects coords are used to access the paint (through texture matrix) |
459 */ | 432 */ |
460 void drawRect(const GrPaint& paint, | 433 void drawRect(const GrPaint& paint, |
| 434 const SkMatrix& viewMatrix, |
461 const SkRect&, | 435 const SkRect&, |
462 const GrStrokeInfo* strokeInfo = NULL); | 436 const GrStrokeInfo* strokeInfo = NULL); |
463 | 437 |
464 /** | 438 /** |
465 * Maps a rect of local coordinates onto the a rect of destination | 439 * Maps a rect of local coordinates onto the a rect of destination |
466 * coordinates. The localRect is stretched over the dstRect. The dstRect is | 440 * coordinates. The localRect is stretched over the dstRect. The dstRect is |
467 * transformed by the context's matrix. An additional optional matrix can be | 441 * transformed by the context's matrix. An additional optional matrix can be |
468 * provided to transform the local rect. | 442 * provided to transform the local rect. |
469 * | 443 * |
470 * @param paint describes how to color pixels. | 444 * @param paint describes how to color pixels. |
| 445 * @param viewMatrix transformation matrix |
471 * @param dstRect the destination rect to draw. | 446 * @param dstRect the destination rect to draw. |
472 * @param localRect rect of local coordinates to be mapped onto dstRect | 447 * @param localRect rect of local coordinates to be mapped onto dstRect |
473 * @param localMatrix Optional matrix to transform localRect. | |
474 */ | 448 */ |
475 void drawRectToRect(const GrPaint& paint, | 449 void drawRectToRect(const GrPaint& paint, |
| 450 const SkMatrix& viewMatrix, |
476 const SkRect& dstRect, | 451 const SkRect& dstRect, |
477 const SkRect& localRect, | 452 const SkRect& localRect); |
478 const SkMatrix* localMatrix = NULL); | |
479 | 453 |
480 /** | 454 /** |
481 * Draw a roundrect using a paint. | 455 * Draw a roundrect using a paint. |
482 * | 456 * |
483 * @param paint describes how to color pixels. | 457 * @param paint describes how to color pixels. |
| 458 * @param viewMatrix transformation matrix |
484 * @param rrect the roundrect to draw | 459 * @param rrect the roundrect to draw |
485 * @param strokeInfo the stroke information (width, join, cap) and | 460 * @param strokeInfo the stroke information (width, join, cap) and |
486 * the dash information (intervals, count, phase). | 461 * the dash information (intervals, count, phase). |
487 */ | 462 */ |
488 void drawRRect(const GrPaint& paint, const SkRRect& rrect, const GrStrokeInf
o& strokeInfo); | 463 void drawRRect(const GrPaint&, const SkMatrix& viewMatrix, const SkRRect& rr
ect, |
| 464 const GrStrokeInfo&); |
489 | 465 |
490 /** | 466 /** |
491 * Shortcut for drawing an SkPath consisting of nested rrects using a paint
. | 467 * Shortcut for drawing an SkPath consisting of nested rrects using a paint
. |
492 * Does not support stroking. The result is undefined if outer does not con
tain | 468 * Does not support stroking. The result is undefined if outer does not con
tain |
493 * inner. | 469 * inner. |
494 * | 470 * |
495 * @param paint describes how to color pixels. | 471 * @param paint describes how to color pixels. |
| 472 * @param viewMatrix transformation matrix |
496 * @param outer the outer roundrect | 473 * @param outer the outer roundrect |
497 * @param inner the inner roundrect | 474 * @param inner the inner roundrect |
498 */ | 475 */ |
499 void drawDRRect(const GrPaint& paint, const SkRRect& outer, const SkRRect& i
nner); | 476 void drawDRRect(const GrPaint&, const SkMatrix& viewMatrix, const SkRRect& o
uter, |
| 477 const SkRRect& inner); |
500 | 478 |
501 | 479 |
502 /** | 480 /** |
503 * Draws a path. | 481 * Draws a path. |
504 * | 482 * |
505 * @param paint describes how to color pixels. | 483 * @param paint describes how to color pixels. |
| 484 * @param viewMatrix transformation matrix |
506 * @param path the path to draw | 485 * @param path the path to draw |
507 * @param strokeInfo the stroke information (width, join, cap) and | 486 * @param strokeInfo the stroke information (width, join, cap) and |
508 * the dash information (intervals, count, phase). | 487 * the dash information (intervals, count, phase). |
509 */ | 488 */ |
510 void drawPath(const GrPaint& paint, const SkPath& path, const GrStrokeInfo&
strokeInfo); | 489 void drawPath(const GrPaint&, const SkMatrix& viewMatrix, const SkPath&, con
st GrStrokeInfo&); |
511 | 490 |
512 /** | 491 /** |
513 * Draws vertices with a paint. | 492 * Draws vertices with a paint. |
514 * | 493 * |
515 * @param paint describes how to color pixels. | 494 * @param paint describes how to color pixels. |
| 495 * @param viewMatrix transformation matrix |
516 * @param primitiveType primitives type to draw. | 496 * @param primitiveType primitives type to draw. |
517 * @param vertexCount number of vertices. | 497 * @param vertexCount number of vertices. |
518 * @param positions array of vertex positions, required. | 498 * @param positions array of vertex positions, required. |
519 * @param texCoords optional array of texture coordinates used | 499 * @param texCoords optional array of texture coordinates used |
520 * to access the paint. | 500 * to access the paint. |
521 * @param colors optional array of per-vertex colors, supercedes | 501 * @param colors optional array of per-vertex colors, supercedes |
522 * the paint's color field. | 502 * the paint's color field. |
523 * @param indices optional array of indices. If NULL vertices | 503 * @param indices optional array of indices. If NULL vertices |
524 * are drawn non-indexed. | 504 * are drawn non-indexed. |
525 * @param indexCount if indices is non-null then this is the | 505 * @param indexCount if indices is non-null then this is the |
526 * number of indices. | 506 * number of indices. |
527 */ | 507 */ |
528 void drawVertices(const GrPaint& paint, | 508 void drawVertices(const GrPaint& paint, |
| 509 const SkMatrix& viewMatrix, |
529 GrPrimitiveType primitiveType, | 510 GrPrimitiveType primitiveType, |
530 int vertexCount, | 511 int vertexCount, |
531 const SkPoint positions[], | 512 const SkPoint positions[], |
532 const SkPoint texs[], | 513 const SkPoint texs[], |
533 const GrColor colors[], | 514 const GrColor colors[], |
534 const uint16_t indices[], | 515 const uint16_t indices[], |
535 int indexCount); | 516 int indexCount); |
536 | 517 |
537 /** | 518 /** |
538 * Draws an oval. | 519 * Draws an oval. |
539 * | 520 * |
540 * @param paint describes how to color pixels. | 521 * @param paint describes how to color pixels. |
| 522 * @param viewMatrix transformation matrix |
541 * @param oval the bounding rect of the oval. | 523 * @param oval the bounding rect of the oval. |
542 * @param strokeInfo the stroke information (width, join, cap) and | 524 * @param strokeInfo the stroke information (width, join, cap) and |
543 * the dash information (intervals, count, phase). | 525 * the dash information (intervals, count, phase). |
544 */ | 526 */ |
545 void drawOval(const GrPaint& paint, | 527 void drawOval(const GrPaint& paint, |
| 528 const SkMatrix& viewMatrix, |
546 const SkRect& oval, | 529 const SkRect& oval, |
547 const GrStrokeInfo& strokeInfo); | 530 const GrStrokeInfo& strokeInfo); |
548 | 531 |
549 /////////////////////////////////////////////////////////////////////////// | 532 /////////////////////////////////////////////////////////////////////////// |
550 // Misc. | 533 // Misc. |
551 | 534 |
552 /** | 535 /** |
553 * Flags that affect flush() behavior. | 536 * Flags that affect flush() behavior. |
554 */ | 537 */ |
555 enum FlushBits { | 538 enum FlushBits { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 if (fContext) { | 685 if (fContext) { |
703 fContext->setRenderTarget(fPrevTarget); | 686 fContext->setRenderTarget(fPrevTarget); |
704 } | 687 } |
705 SkSafeUnref(fPrevTarget); | 688 SkSafeUnref(fPrevTarget); |
706 } | 689 } |
707 private: | 690 private: |
708 GrContext* fContext; | 691 GrContext* fContext; |
709 GrRenderTarget* fPrevTarget; | 692 GrRenderTarget* fPrevTarget; |
710 }; | 693 }; |
711 | 694 |
712 /** | |
713 * Save/restore the view-matrix in the context. It can optionally adjust a p
aint to account | |
714 * for a coordinate system change. Here is an example of how the paint param
can be used: | |
715 * | |
716 * A GrPaint is setup with GrProcessors. The stages will have access to the
pre-matrix source | |
717 * geometry positions when the draw is executed. Later on a decision is made
to transform the | |
718 * geometry to device space on the CPU. The effects now need to know that th
e space in which | |
719 * the geometry will be specified has changed. | |
720 * | |
721 * Note that when restore is called (or in the destructor) the context's mat
rix will be | |
722 * restored. However, the paint will not be restored. The caller must make a
copy of the | |
723 * paint if necessary. Hint: use SkTCopyOnFirstWrite if the AutoMatrix is co
nditionally | |
724 * initialized. | |
725 */ | |
726 class AutoMatrix : public ::SkNoncopyable { | |
727 public: | |
728 AutoMatrix() : fContext(NULL) {} | |
729 | |
730 ~AutoMatrix() { this->restore(); } | |
731 | |
732 /** | |
733 * Initializes by pre-concat'ing the context's current matrix with the p
reConcat param. | |
734 */ | |
735 void setPreConcat(GrContext* context, const SkMatrix& preConcat, GrPaint
* paint = NULL) { | |
736 SkASSERT(context); | |
737 | |
738 this->restore(); | |
739 | |
740 fContext = context; | |
741 fMatrix = context->getMatrix(); | |
742 this->preConcat(preConcat, paint); | |
743 } | |
744 | |
745 /** | |
746 * Sets the context's matrix to identity. Returns false if the inverse m
atrix is required to | |
747 * update a paint but the matrix cannot be inverted. | |
748 */ | |
749 bool setIdentity(GrContext* context, GrPaint* paint = NULL) { | |
750 SkASSERT(context); | |
751 | |
752 this->restore(); | |
753 | |
754 if (paint) { | |
755 if (!paint->localCoordChangeInverse(context->getMatrix())) { | |
756 return false; | |
757 } | |
758 } | |
759 fMatrix = context->getMatrix(); | |
760 fContext = context; | |
761 context->setIdentityMatrix(); | |
762 return true; | |
763 } | |
764 | |
765 /** | |
766 * Replaces the context's matrix with a new matrix. Returns false if the
inverse matrix is | |
767 * required to update a paint but the matrix cannot be inverted. | |
768 */ | |
769 bool set(GrContext* context, const SkMatrix& newMatrix, GrPaint* paint =
NULL) { | |
770 if (paint) { | |
771 if (!this->setIdentity(context, paint)) { | |
772 return false; | |
773 } | |
774 this->preConcat(newMatrix, paint); | |
775 } else { | |
776 this->restore(); | |
777 fContext = context; | |
778 fMatrix = context->getMatrix(); | |
779 context->setMatrix(newMatrix); | |
780 } | |
781 return true; | |
782 } | |
783 | |
784 /** | |
785 * If this has been initialized then the context's matrix will be furthe
r updated by | |
786 * pre-concat'ing the preConcat param. The matrix that will be restored
remains unchanged. | |
787 * The paint is assumed to be relative to the context's matrix at the ti
me this call is | |
788 * made, not the matrix at the time AutoMatrix was first initialized. In
other words, this | |
789 * performs an incremental update of the paint. | |
790 */ | |
791 void preConcat(const SkMatrix& preConcat, GrPaint* paint = NULL) { | |
792 if (paint) { | |
793 paint->localCoordChange(preConcat); | |
794 } | |
795 fContext->concatMatrix(preConcat); | |
796 } | |
797 | |
798 /** | |
799 * Returns false if never initialized or the inverse matrix was required
to update a paint | |
800 * but the matrix could not be inverted. | |
801 */ | |
802 bool succeeded() const { return SkToBool(fContext); } | |
803 | |
804 /** | |
805 * If this has been initialized then the context's original matrix is re
stored. | |
806 */ | |
807 void restore() { | |
808 if (fContext) { | |
809 fContext->setMatrix(fMatrix); | |
810 fContext = NULL; | |
811 } | |
812 } | |
813 | |
814 private: | |
815 GrContext* fContext; | |
816 SkMatrix fMatrix; | |
817 }; | |
818 | |
819 class AutoClip : public ::SkNoncopyable { | 695 class AutoClip : public ::SkNoncopyable { |
820 public: | 696 public: |
821 // This enum exists to require a caller of the constructor to acknowledg
e that the clip will | 697 // This enum exists to require a caller of the constructor to acknowledg
e that the clip will |
822 // initially be wide open. It also could be extended if there are other
desirable initial | 698 // initially be wide open. It also could be extended if there are other
desirable initial |
823 // clip states. | 699 // clip states. |
824 enum InitialClip { | 700 enum InitialClip { |
825 kWideOpen_InitialClip, | 701 kWideOpen_InitialClip, |
826 }; | 702 }; |
827 | 703 |
828 AutoClip(GrContext* context, InitialClip SkDEBUGCODE(initialState)) | 704 AutoClip(GrContext* context, InitialClip SkDEBUGCODE(initialState)) |
(...skipping 25 matching lines...) Expand all Loading... |
854 | 730 |
855 SkClipStack fNewClipStack; | 731 SkClipStack fNewClipStack; |
856 GrClipData fNewClipData; | 732 GrClipData fNewClipData; |
857 }; | 733 }; |
858 | 734 |
859 class AutoWideOpenIdentityDraw { | 735 class AutoWideOpenIdentityDraw { |
860 public: | 736 public: |
861 AutoWideOpenIdentityDraw(GrContext* ctx, GrRenderTarget* rt) | 737 AutoWideOpenIdentityDraw(GrContext* ctx, GrRenderTarget* rt) |
862 : fAutoClip(ctx, AutoClip::kWideOpen_InitialClip) | 738 : fAutoClip(ctx, AutoClip::kWideOpen_InitialClip) |
863 , fAutoRT(ctx, rt) { | 739 , fAutoRT(ctx, rt) { |
864 fAutoMatrix.setIdentity(ctx); | |
865 // should never fail with no paint param. | |
866 SkASSERT(fAutoMatrix.succeeded()); | |
867 } | 740 } |
868 | 741 |
869 private: | 742 private: |
870 AutoClip fAutoClip; | 743 AutoClip fAutoClip; |
871 AutoRenderTarget fAutoRT; | 744 AutoRenderTarget fAutoRT; |
872 AutoMatrix fAutoMatrix; | |
873 }; | 745 }; |
874 | 746 |
875 /////////////////////////////////////////////////////////////////////////// | 747 /////////////////////////////////////////////////////////////////////////// |
876 // Functions intended for internal use only. | 748 // Functions intended for internal use only. |
877 GrGpu* getGpu() { return fGpu; } | 749 GrGpu* getGpu() { return fGpu; } |
878 const GrGpu* getGpu() const { return fGpu; } | 750 const GrGpu* getGpu() const { return fGpu; } |
879 GrFontCache* getFontCache() { return fFontCache; } | 751 GrFontCache* getFontCache() { return fFontCache; } |
880 GrLayerCache* getLayerCache() { return fLayerCache.get(); } | 752 GrLayerCache* getLayerCache() { return fLayerCache.get(); } |
881 GrDrawTarget* getTextTarget(); | 753 GrDrawTarget* getTextTarget(); |
882 const GrIndexBuffer* getQuadIndexBuffer() const; | 754 const GrIndexBuffer* getQuadIndexBuffer() const; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 void incShaderCompilations() {} | 799 void incShaderCompilations() {} |
928 #endif | 800 #endif |
929 }; | 801 }; |
930 | 802 |
931 #if GR_GPU_STATS | 803 #if GR_GPU_STATS |
932 const GPUStats* gpuStats() const; | 804 const GPUStats* gpuStats() const; |
933 #endif | 805 #endif |
934 | 806 |
935 private: | 807 private: |
936 GrGpu* fGpu; | 808 GrGpu* fGpu; |
937 SkMatrix fViewMatrix; | |
938 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 809 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
939 const GrClipData* fClip; // TODO: make this ref counted | 810 const GrClipData* fClip; // TODO: make this ref counted |
940 | 811 |
941 GrResourceCache2* fResourceCache2; | 812 GrResourceCache2* fResourceCache2; |
942 GrFontCache* fFontCache; | 813 GrFontCache* fFontCache; |
943 SkAutoTDelete<GrLayerCache> fLayerCache; | 814 SkAutoTDelete<GrLayerCache> fLayerCache; |
944 | 815 |
945 GrPathRendererChain* fPathRendererChain; | 816 GrPathRendererChain* fPathRendererChain; |
946 GrSoftwarePathRenderer* fSoftwarePathRenderer; | 817 GrSoftwarePathRenderer* fSoftwarePathRenderer; |
947 | 818 |
(...skipping 24 matching lines...) Expand all Loading... |
972 GrContext(const Options&); // init must be called after the constructor. | 843 GrContext(const Options&); // init must be called after the constructor. |
973 bool init(GrBackend, GrBackendContext); | 844 bool init(GrBackend, GrBackendContext); |
974 void initMockContext(); | 845 void initMockContext(); |
975 void initCommon(); | 846 void initCommon(); |
976 | 847 |
977 void setupDrawBuffer(); | 848 void setupDrawBuffer(); |
978 | 849 |
979 class AutoCheckFlush; | 850 class AutoCheckFlush; |
980 /// Sets the paint and returns the target to draw into. The paint can be NUL
L in which case the | 851 /// Sets the paint and returns the target to draw into. The paint can be NUL
L in which case the |
981 /// draw state is left unmodified. | 852 /// draw state is left unmodified. |
982 GrDrawTarget* prepareToDraw(GrDrawState* ds, const GrPaint* paint, const Aut
oCheckFlush*); | 853 GrDrawTarget* prepareToDraw(GrDrawState* ds, |
| 854 const GrPaint* paint, |
| 855 const SkMatrix* viewMatrix, |
| 856 const AutoCheckFlush*); |
983 | 857 |
984 void internalDrawPath(GrDrawTarget*, | 858 void internalDrawPath(GrDrawTarget*, |
985 GrDrawState*, | 859 GrDrawState*, |
| 860 const SkMatrix& viewMatrix, |
986 GrColor, | 861 GrColor, |
987 bool useAA, | 862 bool useAA, |
988 const SkPath&, | 863 const SkPath&, |
989 const GrStrokeInfo&); | 864 const GrStrokeInfo&); |
990 | 865 |
991 GrTexture* createResizedTexture(const GrSurfaceDesc& desc, | 866 GrTexture* createResizedTexture(const GrSurfaceDesc& desc, |
992 const GrCacheID& cacheID, | 867 const GrCacheID& cacheID, |
993 const void* srcData, | 868 const void* srcData, |
994 size_t rowBytes, | 869 size_t rowBytes, |
995 bool filter); | 870 bool filter); |
996 | 871 |
997 /** | 872 /** |
998 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair | 873 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair |
999 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they | 874 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they |
1000 * return NULL. | 875 * return NULL. |
1001 */ | 876 */ |
1002 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); | 877 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
1003 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); | 878 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
1004 | 879 |
1005 /** | 880 /** |
1006 * This callback allows the resource cache to callback into the GrContext | 881 * This callback allows the resource cache to callback into the GrContext |
1007 * when the cache is still over budget after a purge. | 882 * when the cache is still over budget after a purge. |
1008 */ | 883 */ |
1009 static void OverBudgetCB(void* data); | 884 static void OverBudgetCB(void* data); |
1010 | 885 |
1011 typedef SkRefCnt INHERITED; | 886 typedef SkRefCnt INHERITED; |
1012 }; | 887 }; |
1013 | 888 |
1014 #endif | 889 #endif |
OLD | NEW |