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 #include "SkGr.h" | 8 #include "SkGr.h" |
9 | 9 |
10 #include "GrXferProcessor.h" | 10 #include "GrXferProcessor.h" |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 /////////////////////////////////////////////////////////////////////////////// | 643 /////////////////////////////////////////////////////////////////////////////// |
644 | 644 |
645 void SkPaint2GrPaintNoShader(GrContext* context, GrRenderTarget* rt, const SkPai
nt& skPaint, | 645 void SkPaint2GrPaintNoShader(GrContext* context, GrRenderTarget* rt, const SkPai
nt& skPaint, |
646 GrColor paintColor, bool constantColor, GrPaint* gr
Paint) { | 646 GrColor paintColor, bool constantColor, GrPaint* gr
Paint) { |
647 | 647 |
648 grPaint->setDither(skPaint.isDither()); | 648 grPaint->setDither(skPaint.isDither()); |
649 grPaint->setAntiAlias(skPaint.isAntiAlias()); | 649 grPaint->setAntiAlias(skPaint.isAntiAlias()); |
650 | 650 |
651 SkXfermode* mode = skPaint.getXfermode(); | 651 SkXfermode* mode = skPaint.getXfermode(); |
652 GrXPFactory* xpFactory = NULL; | 652 GrXPFactory* xpFactory = NULL; |
653 if (!SkXfermode::AsXPFactory(mode, &xpFactory)) { | 653 if (!SkXfermode::AsXPFactory(mode, context, &xpFactory)) { |
654 // Fall back to src-over | 654 // Fall back to src-over |
655 xpFactory = GrPorterDuffXPFactory::Create(SkXfermode::kSrcOver_Mode); | 655 xpFactory = GrPorterDuffXPFactory::Create(SkXfermode::kSrcOver_Mode); |
656 } | 656 } |
657 SkASSERT(xpFactory); | 657 SkASSERT(xpFactory); |
658 grPaint->setXPFactory(xpFactory)->unref(); | 658 grPaint->setXPFactory(xpFactory)->unref(); |
659 | 659 |
660 //set the color of the paint to the one of the parameter | 660 //set the color of the paint to the one of the parameter |
661 grPaint->setColor(paintColor); | 661 grPaint->setColor(paintColor); |
662 | 662 |
663 SkColorFilter* colorFilter = skPaint.getColorFilter(); | 663 SkColorFilter* colorFilter = skPaint.getColorFilter(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol
or, &fp) && fp) { | 722 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol
or, &fp) && fp) { |
723 grPaint->addColorProcessor(fp)->unref(); | 723 grPaint->addColorProcessor(fp)->unref(); |
724 constantColor = false; | 724 constantColor = false; |
725 } | 725 } |
726 } | 726 } |
727 | 727 |
728 // The grcolor is automatically set when calling asFragmentProcessor. | 728 // The grcolor is automatically set when calling asFragmentProcessor. |
729 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 729 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
730 SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantColor, grP
aint); | 730 SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantColor, grP
aint); |
731 } | 731 } |
OLD | NEW |