aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-03-04 07:38:11 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-04 07:38:12 -0800
commita0cee5f30e9254187a6bb943e6b8a9296214c353 (patch)
treeaacfb981277ecf224a86e643b1973768a44894e0 /src/core
parent8b6394c24f755db39936e4e5111a3f251cc56857 (diff)
remove align16 calls in skhader context sizes. will handle this elsewhere as needed
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1768433003 TBR= basically reverts previous CL, but keeps the create --> onCreate change Review URL: https://codereview.chromium.org/1768433003
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkBitmapProcShader.cpp2
-rw-r--r--src/core/SkBlitter.cpp2
-rw-r--r--src/core/SkColorFilterShader.cpp2
-rw-r--r--src/core/SkColorShader.h4
-rw-r--r--src/core/SkComposeShader.cpp4
-rw-r--r--src/core/SkDraw.cpp2
-rw-r--r--src/core/SkEmptyShader.h2
-rw-r--r--src/core/SkLightingShader.cpp2
-rw-r--r--src/core/SkPictureShader.cpp2
-rw-r--r--src/core/SkShader.cpp12
-rw-r--r--src/core/SkSmallAllocator.h6
11 files changed, 13 insertions, 27 deletions
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index 6c87ebeda4..895922c6b8 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -120,7 +120,7 @@ private:
size_t SkBitmapProcShader::ContextSize(const ContextRec& rec) {
// The SkBitmapProcState is stored outside of the context object, with the context holding
// a pointer to it.
- return SkAlign16(sizeof(BitmapProcShaderContext) + sizeof(SkBitmapProcState));
+ return sizeof(BitmapProcShaderContext) + sizeof(SkBitmapProcState);
}
SkShader::Context* SkBitmapProcShader::MakeContext(const SkShader& shader,
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index ce7c4e8ccd..bb5cfb72e3 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -593,7 +593,7 @@ public:
}
size_t onContextSize(const ContextRec& rec) const override {
- size_t size = SkAlign16(sizeof(Sk3DShaderContext));
+ size_t size = sizeof(Sk3DShaderContext);
if (fProxy) {
size += fProxy->contextSize(rec);
}
diff --git a/src/core/SkColorFilterShader.cpp b/src/core/SkColorFilterShader.cpp
index c856f19150..c7cf76b53e 100644
--- a/src/core/SkColorFilterShader.cpp
+++ b/src/core/SkColorFilterShader.cpp
@@ -63,7 +63,7 @@ SkShader::Context* SkColorFilterShader::onCreateContext(const ContextRec& rec,
}
size_t SkColorFilterShader::onContextSize(const ContextRec& rec) const {
- return SkAlign16(sizeof(FilterShaderContext)) + fShader->contextSize(rec);
+ return sizeof(FilterShaderContext) + fShader->contextSize(rec);
}
SkColorFilterShader::FilterShaderContext::FilterShaderContext(
diff --git a/src/core/SkColorShader.h b/src/core/SkColorShader.h
index 985ab201cd..7f817b54be 100644
--- a/src/core/SkColorShader.h
+++ b/src/core/SkColorShader.h
@@ -57,9 +57,7 @@ protected:
SkColorShader(SkReadBuffer&);
void flatten(SkWriteBuffer&) const override;
Context* onCreateContext(const ContextRec&, void* storage) const override;
- size_t onContextSize(const ContextRec&) const override {
- return SkAlign16(sizeof(ColorShaderContext));
- }
+ size_t onContextSize(const ContextRec&) const override { return sizeof(ColorShaderContext); }
bool onAsLuminanceColor(SkColor* lum) const override {
*lum = fColor;
return true;
diff --git a/src/core/SkComposeShader.cpp b/src/core/SkComposeShader.cpp
index e4ad6e9eda..b6ba3729d1 100644
--- a/src/core/SkComposeShader.cpp
+++ b/src/core/SkComposeShader.cpp
@@ -31,7 +31,7 @@ SkComposeShader::~SkComposeShader() {
}
size_t SkComposeShader::onContextSize(const ContextRec& rec) const {
- return SkAlign16(sizeof(ComposeShaderContext))
+ return sizeof(ComposeShaderContext)
+ fShaderA->contextSize(rec)
+ fShaderB->contextSize(rec);
}
@@ -76,7 +76,7 @@ template <typename T> void safe_call_destructor(T* obj) {
}
SkShader::Context* SkComposeShader::onCreateContext(const ContextRec& rec, void* storage) const {
- char* aStorage = (char*) storage + SkAlign16(sizeof(ComposeShaderContext));
+ char* aStorage = (char*) storage + sizeof(ComposeShaderContext);
char* bStorage = aStorage + fShaderA->contextSize(rec);
// we preconcat our localMatrix (if any) with the device matrix
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index e9b0677c33..efb19e2ec9 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1772,7 +1772,7 @@ SkTriColorShader::TriColorShaderContext::TriColorShaderContext(const SkTriColorS
SkTriColorShader::TriColorShaderContext::~TriColorShaderContext() {}
size_t SkTriColorShader::onContextSize(const ContextRec&) const {
- return SkAlign16(sizeof(TriColorShaderContext));
+ return sizeof(TriColorShaderContext);
}
void SkTriColorShader::TriColorShaderContext::shadeSpan(int x, int y, SkPMColor dstC[], int count) {
diff --git a/src/core/SkEmptyShader.h b/src/core/SkEmptyShader.h
index 42b61c52fe..528ceeabee 100644
--- a/src/core/SkEmptyShader.h
+++ b/src/core/SkEmptyShader.h
@@ -27,7 +27,7 @@ protected:
size_t onContextSize(const ContextRec&) const override {
// Even though createContext returns nullptr we have to return a value of at least
// sizeof(SkShader::Context) to satisfy SkSmallAllocator.
- return SkAlign16(sizeof(SkShader::Context));
+ return sizeof(SkShader::Context);
}
SkShader::Context* onCreateContext(const ContextRec&, void*) const override {
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp
index 2b43e500d7..02f75f3516 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -651,7 +651,7 @@ bool SkLightingShaderImpl::computeNormTotalInverse(const ContextRec& rec,
}
size_t SkLightingShaderImpl::onContextSize(const ContextRec&) const {
- return SkAlign16(2 * sizeof(SkBitmapProcState) + sizeof(LightingShaderContext));
+ return 2 * sizeof(SkBitmapProcState) + sizeof(LightingShaderContext);
}
SkShader::Context* SkLightingShaderImpl::onCreateContext(const ContextRec& rec,
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index 630b1bf8e1..3919471b1b 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -242,7 +242,7 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& viewMatrix, const SkM
}
size_t SkPictureShader::onContextSize(const ContextRec&) const {
- return SkAlign16(sizeof(PictureShaderContext));
+ return sizeof(PictureShaderContext);
}
SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void* storage) const {
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index 93d3bc91a6..75f527bff3 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -86,10 +86,6 @@ bool SkShader::asLuminanceColor(SkColor* colorPtr) const {
}
SkShader::Context* SkShader::createContext(const ContextRec& rec, void* storage) const {
- // Currently we require each context to be allocated on 16byte boundary as some of our
- // subclasses need that. Hence we check the ptr here.
-// SkASSERT(SkIsAlign16((intptr_t)storage));
-
if (!this->computeTotalInverse(rec, nullptr)) {
return nullptr;
}
@@ -101,13 +97,7 @@ SkShader::Context* SkShader::onCreateContext(const ContextRec& rec, void*) const
}
size_t SkShader::contextSize(const ContextRec& rec) const {
- size_t size = this->onContextSize(rec);
-
- // Currently we require each context to be allocated on 16byte boundary as some of our
- // subclasses need that. Hence we check the size here.
-// SkASSERT(SkIsAlign16(size));
-
- return size;
+ return this->onContextSize(rec);
}
size_t SkShader::onContextSize(const ContextRec&) const {
diff --git a/src/core/SkSmallAllocator.h b/src/core/SkSmallAllocator.h
index 63c02eca33..22baa898ea 100644
--- a/src/core/SkSmallAllocator.h
+++ b/src/core/SkSmallAllocator.h
@@ -71,14 +71,13 @@ public:
* allocation if necessary.
* Unlike createT(), this method will not call the constructor of T.
*/
- template<typename T> void* reserveT(size_t storageRequested = sizeof(T)) {
+ template<typename T> void* reserveT(size_t storageRequired = sizeof(T)) {
SkASSERT(fNumObjects < kMaxObjects);
- SkASSERT(storageRequested >= sizeof(T));
+ SkASSERT(storageRequired >= sizeof(T));
if (kMaxObjects == fNumObjects) {
return nullptr;
}
const size_t storageRemaining = sizeof(fStorage) - fStorageUsed;
- const size_t storageRequired = SkAlign16(storageRequested);
Rec* rec = &fRecs[fNumObjects];
if (storageRequired > storageRemaining) {
// Allocate on the heap. Ideally we want to avoid this situation,
@@ -92,7 +91,6 @@ public:
// There is space in fStorage.
rec->fStorageSize = storageRequired;
rec->fHeapStorage = nullptr;
- SkASSERT(SkIsAlign16(fStorageUsed));
rec->fObj = static_cast<void*>(fStorage.fBytes + fStorageUsed);
fStorageUsed += storageRequired;
}