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

Unified Diff: src/core/SkLinearBitmapPipeline.h

Issue 2486523002: Change code to not store Sk4* in data structures. (Closed)
Patch Set: Address comments 2 Created 4 years, 1 month 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 | « no previous file | src/core/SkLinearBitmapPipeline.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLinearBitmapPipeline.h
diff --git a/src/core/SkLinearBitmapPipeline.h b/src/core/SkLinearBitmapPipeline.h
index 3abdb8014aa134503d7694c7c9ba25705572d42e..776f8d86039ca65e9d1629bcc03d1d69da025f69 100644
--- a/src/core/SkLinearBitmapPipeline.h
+++ b/src/core/SkLinearBitmapPipeline.h
@@ -84,7 +84,7 @@ public:
private:
std::function<void (Next*, void*)> fStageCloner;
- alignas(16) mutable char fSpace[kSize];
+ mutable char fSpace[kSize];
bool fIsInitialized;
};
@@ -113,8 +113,8 @@ public:
Base& operator*() const { return *(this->get()); }
private:
- alignas(16) mutable char fSpace[kSize];
- bool fIsInitialized;
+ mutable char fSpace[kSize];
+ bool fIsInitialized;
};
@@ -125,8 +125,8 @@ public:
class PixelAccessorInterface;
// These values were generated by the assert above in Stage::init{Sink|Stage}.
- using MatrixStage = Stage<PointProcessorInterface, 160, PointProcessorInterface>;
- using TileStage = Stage<PointProcessorInterface, 160, SampleProcessorInterface>;
+ using MatrixStage = Stage<PointProcessorInterface, 56, PointProcessorInterface>;
+ using TileStage = Stage<PointProcessorInterface, 48, SampleProcessorInterface>;
using SampleStage = Stage<SampleProcessorInterface, 160, BlendProcessorInterface>;
using BlenderStage = Stage<BlendProcessorInterface, 48>;
using Accessor = PolyMemory<PixelAccessorInterface, 64>;
@@ -147,29 +147,26 @@ class SkEmbeddableLinearPipeline {
public:
SkEmbeddableLinearPipeline() { }
~SkEmbeddableLinearPipeline() {
- if (get() != nullptr) {
+ if (fInitialized) {
get()->~SkLinearBitmapPipeline();
}
}
template <typename... Args>
void init(Args&&... args) {
- // Ensure that our pipeline is created at a 16 byte aligned address.
- fPipeline = (SkLinearBitmapPipeline*)SkAlign16((intptr_t)fPipelineStorage);
- new (fPipeline) SkLinearBitmapPipeline{std::forward<Args>(args)...};
+ new (fPipelineStorage) SkLinearBitmapPipeline{std::forward<Args>(args)...};
+ fInitialized = true;
}
- SkLinearBitmapPipeline* get() const { return fPipeline; }
+ SkLinearBitmapPipeline* get() const {
+ return reinterpret_cast<SkLinearBitmapPipeline*>(fPipelineStorage);
+ }
SkLinearBitmapPipeline& operator*() const { return *this->get(); }
SkLinearBitmapPipeline* operator->() const { return this->get(); }
private:
- enum {
- kActualSize = sizeof(SkLinearBitmapPipeline),
- kPaddedSize = SkAlignPtr(kActualSize + 12),
- };
- void* fPipelineStorage[kPaddedSize / sizeof(void*)];
- SkLinearBitmapPipeline* fPipeline{nullptr};
+ alignas(SkLinearBitmapPipeline) mutable char fPipelineStorage[sizeof(SkLinearBitmapPipeline)];
+ bool fInitialized {false};
};
#endif // SkLinearBitmapPipeline_DEFINED
« no previous file with comments | « no previous file | src/core/SkLinearBitmapPipeline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698