Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: src/core/SkDraw.cpp

Issue 1720933002: Add ContextRec param to SkShader::contextSize() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: ContextRec plumbing only Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkComposeShader.cpp ('k') | src/core/SkEmptyShader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkComposeShader.cpp ('k') | src/core/SkEmptyShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698