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 "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 | 763 |
764 GrColor paintColor = SkColor2GrColor(skPaint.getColor()); | 764 GrColor paintColor = SkColor2GrColor(skPaint.getColor()); |
765 | 765 |
766 // Start a new block here in order to preserve our context state after calli
ng | 766 // Start a new block here in order to preserve our context state after calli
ng |
767 // asFragmentProcessor(). Since these calls get passed back to the client, w
e don't really | 767 // asFragmentProcessor(). Since these calls get passed back to the client, w
e don't really |
768 // want them messing around with the context. | 768 // want them messing around with the context. |
769 { | 769 { |
770 // Allow the shader to modify paintColor and also create an effect to be
installed as | 770 // Allow the shader to modify paintColor and also create an effect to be
installed as |
771 // the first color effect on the GrPaint. | 771 // the first color effect on the GrPaint. |
772 GrFragmentProcessor* fp = NULL; | 772 GrFragmentProcessor* fp = NULL; |
773 if (!shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCo
lor, &fp)) { | 773 if (!shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCo
lor, |
| 774 grPaint->getShaderDataManager(), &fp))
{ |
774 return false; | 775 return false; |
775 } | 776 } |
776 if (fp) { | 777 if (fp) { |
777 grPaint->addColorProcessor(fp)->unref(); | 778 grPaint->addColorProcessor(fp)->unref(); |
778 constantColor = false; | 779 constantColor = false; |
779 } | 780 } |
780 } | 781 } |
781 | 782 |
782 // The grcolor is automatically set when calling asFragmentProcessor. | 783 // The grcolor is automatically set when calling asFragmentProcessor. |
783 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. | 784 // If the shader can be seen as an effect it returns true and adds its effec
t to the grpaint. |
(...skipping 14 matching lines...) Expand all Loading... |
798 } | 799 } |
799 return SkImageInfo::Make(w, h, ct, at); | 800 return SkImageInfo::Make(w, h, ct, at); |
800 } | 801 } |
801 | 802 |
802 | 803 |
803 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { | 804 void GrWrapTextureInBitmap(GrTexture* src, int w, int h, bool isOpaque, SkBitmap
* dst) { |
804 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); | 805 const SkImageInfo info = GrMakeInfoFromTexture(src, w, h, isOpaque); |
805 dst->setInfo(info); | 806 dst->setInfo(info); |
806 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); | 807 dst->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, src)))->unref(); |
807 } | 808 } |
OLD | NEW |