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

Unified Diff: src/core/SkBitmapProcShader.h

Issue 1342113002: add ImageShader, sharing code with its Bitmap cousin (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: now with actual added files Created 5 years, 3 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
Index: src/core/SkBitmapProcShader.h
diff --git a/src/core/SkBitmapProcShader.h b/src/core/SkBitmapProcShader.h
index 63985c06c514472a2194ef498ed86c728c9ff1a7..fd8a5b7e20cc912a83a886da359ca2c933d8a17a 100644
--- a/src/core/SkBitmapProcShader.h
+++ b/src/core/SkBitmapProcShader.h
@@ -22,7 +22,7 @@ public:
bool isOpaque() const override;
- size_t contextSize() const override;
+ size_t contextSize() const override { return ContextSize(); }
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader)
@@ -33,11 +33,12 @@ public:
GrProcessorDataManager*) const override;
#endif
+protected:
class BitmapProcShaderContext : public SkShader::Context {
public:
// The context takes ownership of the state. It will call its destructor
// but will NOT free the memory.
- BitmapProcShaderContext(const SkBitmapProcShader&, const ContextRec&, SkBitmapProcState*);
+ BitmapProcShaderContext(const SkShader&, const ContextRec&, SkBitmapProcState*);
~BitmapProcShaderContext() override;
void shadeSpan(int x, int y, SkPMColor dstC[], int count) override;
@@ -52,8 +53,7 @@ public:
typedef SkShader::Context INHERITED;
};
-
-protected:
+
void flatten(SkWriteBuffer&) const override;
Context* onCreateContext(const ContextRec&, void* storage) const override;
bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode*) const override;
@@ -62,6 +62,12 @@ protected:
uint8_t fTileModeX, fTileModeY;
private:
+ friend class SkImageShader;
+
+ static size_t ContextSize();
+ static Context* MakeContext(const SkShader&, TileMode tmx, TileMode tmy, const SkBitmap&,
+ const ContextRec&, void* storage);
+
typedef SkShader INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698