collapse some unused type hierarchy
SkBitmapProcState is the only subclass of SkBitmapProcInfo, and
BitmapProcShaderContext the only subclass of BitmapProcInfoContext.
This folds it all together, and should be a no-op refactor.
Change-Id: I971c03dbbebfcd1651ddac2f1b624329f415cc35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313439
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/src/shaders/SkBitmapProcShader.cpp b/src/shaders/SkBitmapProcShader.cpp
index d630c45..a168b1a 100644
--- a/src/shaders/SkBitmapProcShader.cpp
+++ b/src/shaders/SkBitmapProcShader.cpp
@@ -11,48 +11,30 @@
#include "src/core/SkBitmapProcState.h"
#include "src/core/SkXfermodePriv.h"
-static bool only_scale_and_translate(const SkMatrix& matrix) {
- unsigned mask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask;
- return (matrix.getType() & ~mask) == 0;
-}
-
-class BitmapProcInfoContext : public SkShaderBase::Context {
+class BitmapProcShaderContext : public SkShaderBase::Context {
public:
- // The info has been allocated elsewhere, but we are responsible for calling its destructor.
- BitmapProcInfoContext(const SkShaderBase& shader, const SkShaderBase::ContextRec& rec,
- SkBitmapProcInfo* info)
+ BitmapProcShaderContext(const SkShaderBase& shader, const SkShaderBase::ContextRec& rec,
+ SkBitmapProcState* state)
: INHERITED(shader, rec)
- , fInfo(info)
+ , fState(state)
+ , fFlags(0)
{
- fFlags = 0;
- if (fInfo->fPixmap.isOpaque() && (255 == this->getPaintAlpha())) {
+ if (fState->fPixmap.isOpaque() && (255 == this->getPaintAlpha())) {
fFlags |= SkShaderBase::kOpaqueAlpha_Flag;
}
- if (1 == fInfo->fPixmap.height() && only_scale_and_translate(this->getTotalInverse())) {
+ auto only_scale_and_translate = [](const SkMatrix& matrix) {
+ unsigned mask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask;
+ return (matrix.getType() & ~mask) == 0;
+ };
+
+ if (1 == fState->fPixmap.height() && only_scale_and_translate(this->getTotalInverse())) {
fFlags |= SkShaderBase::kConstInY32_Flag;
}
}
uint32_t getFlags() const override { return fFlags; }
-private:
- SkBitmapProcInfo* fInfo;
- uint32_t fFlags;
-
- typedef SkShaderBase::Context INHERITED;
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-class BitmapProcShaderContext : public BitmapProcInfoContext {
-public:
- BitmapProcShaderContext(const SkShaderBase& shader, const SkShaderBase::ContextRec& rec,
- SkBitmapProcState* state)
- : INHERITED(shader, rec, state)
- , fState(state)
- {}
-
void shadeSpan(int x, int y, SkPMColor dstC[], int count) override {
const SkBitmapProcState& state = *fState;
if (state.getShaderProc32()) {
@@ -85,8 +67,9 @@
private:
SkBitmapProcState* fState;
+ uint32_t fFlags;
- typedef BitmapProcInfoContext INHERITED;
+ typedef SkShaderBase::Context INHERITED;
};
///////////////////////////////////////////////////////////////////////////////////////////////////