| 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 bool SkPaint2GrPaintNoShader(GrContext* context, GrRenderTarget* rt, const SkPai
nt& skPaint, | 645 bool 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 // return false here? | 655 // return false here? |
| 656 xpFactory = GrPorterDuffXPFactory::Create(SkXfermode::kSrcOver_Mode); | 656 xpFactory = GrPorterDuffXPFactory::Create(SkXfermode::kSrcOver_Mode); |
| 657 } | 657 } |
| 658 SkASSERT(xpFactory); | 658 SkASSERT(xpFactory); |
| 659 grPaint->setXPFactory(xpFactory)->unref(); | 659 grPaint->setXPFactory(xpFactory)->unref(); |
| 660 | 660 |
| 661 //set the color of the paint to the one of the parameter | 661 //set the color of the paint to the one of the parameter |
| 662 grPaint->setColor(paintColor); | 662 grPaint->setColor(paintColor); |
| 663 | 663 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 if (fp) { | 727 if (fp) { |
| 728 grPaint->addColorProcessor(fp)->unref(); | 728 grPaint->addColorProcessor(fp)->unref(); |
| 729 constantColor = false; | 729 constantColor = false; |
| 730 } | 730 } |
| 731 } | 731 } |
| 732 | 732 |
| 733 // The grcolor is automatically set when calling asFragmentProcessor. | 733 // The grcolor is automatically set when calling asFragmentProcessor. |
| 734 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 734 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
| 735 return SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantCol
or, grPaint); | 735 return SkPaint2GrPaintNoShader(context, rt, skPaint, paintColor, constantCol
or, grPaint); |
| 736 } | 736 } |
| OLD | NEW |