| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 #define __STDC_LIMIT_MACROS | 7 #define __STDC_LIMIT_MACROS |
| 8 | 8 |
| 9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
| 10 #include "SkBlitter.h" | 10 #include "SkBlitter.h" |
| (...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 dst[0] = verts[state.f0]; | 1690 dst[0] = verts[state.f0]; |
| 1691 dst[1] = verts[state.f1]; | 1691 dst[1] = verts[state.f1]; |
| 1692 dst[2] = verts[state.f2]; | 1692 dst[2] = verts[state.f2]; |
| 1693 return matrix->setPolyToPoly(src, dst, 3); | 1693 return matrix->setPolyToPoly(src, dst, 3); |
| 1694 } | 1694 } |
| 1695 | 1695 |
| 1696 class SkTriColorShader : public SkShader { | 1696 class SkTriColorShader : public SkShader { |
| 1697 public: | 1697 public: |
| 1698 SkTriColorShader() {} | 1698 SkTriColorShader() {} |
| 1699 | 1699 |
| 1700 size_t contextSize() const override; | 1700 size_t contextSize(const ContextRec&) const override; |
| 1701 | 1701 |
| 1702 class TriColorShaderContext : public SkShader::Context { | 1702 class TriColorShaderContext : public SkShader::Context { |
| 1703 public: | 1703 public: |
| 1704 TriColorShaderContext(const SkTriColorShader& shader, const ContextRec&)
; | 1704 TriColorShaderContext(const SkTriColorShader& shader, const ContextRec&)
; |
| 1705 virtual ~TriColorShaderContext(); | 1705 virtual ~TriColorShaderContext(); |
| 1706 | 1706 |
| 1707 bool setup(const SkPoint pts[], const SkColor colors[], int, int, int); | 1707 bool setup(const SkPoint pts[], const SkColor colors[], int, int, int); |
| 1708 | 1708 |
| 1709 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; | 1709 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; |
| 1710 | 1710 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1764 return static_cast<int>(SkScalarPin(v, 0, 1) * 256); | 1764 return static_cast<int>(SkScalarPin(v, 0, 1) * 256); |
| 1765 } | 1765 } |
| 1766 | 1766 |
| 1767 | 1767 |
| 1768 SkTriColorShader::TriColorShaderContext::TriColorShaderContext(const SkTriColorS
hader& shader, | 1768 SkTriColorShader::TriColorShaderContext::TriColorShaderContext(const SkTriColorS
hader& shader, |
| 1769 const ContextRec&
rec) | 1769 const ContextRec&
rec) |
| 1770 : INHERITED(shader, rec) {} | 1770 : INHERITED(shader, rec) {} |
| 1771 | 1771 |
| 1772 SkTriColorShader::TriColorShaderContext::~TriColorShaderContext() {} | 1772 SkTriColorShader::TriColorShaderContext::~TriColorShaderContext() {} |
| 1773 | 1773 |
| 1774 size_t SkTriColorShader::contextSize() const { | 1774 size_t SkTriColorShader::contextSize(const ContextRec&) const { |
| 1775 return sizeof(TriColorShaderContext); | 1775 return sizeof(TriColorShaderContext); |
| 1776 } | 1776 } |
| 1777 void SkTriColorShader::TriColorShaderContext::shadeSpan(int x, int y, SkPMColor
dstC[], int count) { | 1777 void SkTriColorShader::TriColorShaderContext::shadeSpan(int x, int y, SkPMColor
dstC[], int count) { |
| 1778 const int alphaScale = Sk255To256(this->getPaintAlpha()); | 1778 const int alphaScale = Sk255To256(this->getPaintAlpha()); |
| 1779 | 1779 |
| 1780 SkPoint src; | 1780 SkPoint src; |
| 1781 | 1781 |
| 1782 for (int i = 0; i < count; i++) { | 1782 for (int i = 0; i < count; i++) { |
| 1783 fDstToUnit.mapXY(SkIntToScalar(x), SkIntToScalar(y), &src); | 1783 fDstToUnit.mapXY(SkIntToScalar(x), SkIntToScalar(y), &src); |
| 1784 x += 1; | 1784 x += 1; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 mask->fImage = SkMask::AllocImage(size); | 2055 mask->fImage = SkMask::AllocImage(size); |
| 2056 memset(mask->fImage, 0, mask->computeImageSize()); | 2056 memset(mask->fImage, 0, mask->computeImageSize()); |
| 2057 } | 2057 } |
| 2058 | 2058 |
| 2059 if (SkMask::kJustComputeBounds_CreateMode != mode) { | 2059 if (SkMask::kJustComputeBounds_CreateMode != mode) { |
| 2060 draw_into_mask(*mask, devPath, style); | 2060 draw_into_mask(*mask, devPath, style); |
| 2061 } | 2061 } |
| 2062 | 2062 |
| 2063 return true; | 2063 return true; |
| 2064 } | 2064 } |
| OLD | NEW |