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

Unified Diff: src/core/SkDraw.cpp

Issue 1759653004: enforce 16byte alignment in shader contexts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkComposeShader.cpp ('k') | src/core/SkEmptyShader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index cff4252579b41c89d3eb5148ad7735f5557d38b1..e9b0677c33600031b99cd48460a5bcc63a6295f4 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1698,8 +1698,6 @@ class SkTriColorShader : public SkShader {
public:
SkTriColorShader() {}
- size_t contextSize(const ContextRec&) const override;
-
class TriColorShaderContext : public SkShader::Context {
public:
TriColorShaderContext(const SkTriColorShader& shader, const ContextRec&);
@@ -1722,6 +1720,7 @@ public:
Factory getFactory() const override { sk_throw(); return nullptr; }
protected:
+ size_t onContextSize(const ContextRec&) const override;
Context* onCreateContext(const ContextRec& rec, void* storage) const override {
return new (storage) TriColorShaderContext(*this, rec);
}
@@ -1772,9 +1771,10 @@ SkTriColorShader::TriColorShaderContext::TriColorShaderContext(const SkTriColorS
SkTriColorShader::TriColorShaderContext::~TriColorShaderContext() {}
-size_t SkTriColorShader::contextSize(const ContextRec&) const {
- return sizeof(TriColorShaderContext);
+size_t SkTriColorShader::onContextSize(const ContextRec&) const {
+ return SkAlign16(sizeof(TriColorShaderContext));
}
+
void SkTriColorShader::TriColorShaderContext::shadeSpan(int x, int y, SkPMColor dstC[], int count) {
const int alphaScale = Sk255To256(this->getPaintAlpha());
« 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