OLD | NEW |
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 #include "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 #if 0 | 1642 #if 0 |
1643 return | 1643 return |
1644 #endif | 1644 #endif |
1645 } | 1645 } |
1646 } | 1646 } |
1647 | 1647 |
1648 SkAutoSTMalloc<128, GrColor> convertedColors(0); | 1648 SkAutoSTMalloc<128, GrColor> convertedColors(0); |
1649 if (NULL != colors) { | 1649 if (NULL != colors) { |
1650 // need to convert byte order and from non-PM to PM | 1650 // need to convert byte order and from non-PM to PM |
1651 convertedColors.reset(vertexCount); | 1651 convertedColors.reset(vertexCount); |
| 1652 SkColor color; |
1652 for (int i = 0; i < vertexCount; ++i) { | 1653 for (int i = 0; i < vertexCount; ++i) { |
1653 convertedColors[i] = SkColor2GrColor(colors[i]); | 1654 color = colors[i]; |
| 1655 if (paint.getAlpha() != 255) { |
| 1656 color = SkColorSetA(color, SkMulDiv255Round(SkColorGetA(color),
paint.getAlpha())); |
| 1657 } |
| 1658 convertedColors[i] = SkColor2GrColor(color); |
1654 } | 1659 } |
1655 colors = convertedColors.get(); | 1660 colors = convertedColors.get(); |
1656 } | 1661 } |
1657 fContext->drawVertices(grPaint, | 1662 fContext->drawVertices(grPaint, |
1658 gVertexMode2PrimitiveType[vmode], | 1663 gVertexMode2PrimitiveType[vmode], |
1659 vertexCount, | 1664 vertexCount, |
1660 vertices, | 1665 vertices, |
1661 texs, | 1666 texs, |
1662 colors, | 1667 colors, |
1663 indices, | 1668 indices, |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); | 1991 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); |
1987 | 1992 |
1988 if (NULL != layer->getTexture()) { | 1993 if (NULL != layer->getTexture()) { |
1989 fContext->unlockScratchTexture(layer->getTexture()); | 1994 fContext->unlockScratchTexture(layer->getTexture()); |
1990 layer->setTexture(NULL); | 1995 layer->setTexture(NULL); |
1991 } | 1996 } |
1992 } | 1997 } |
1993 | 1998 |
1994 return true; | 1999 return true; |
1995 } | 2000 } |
OLD | NEW |