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/SkBlitter.cpp

Issue 563563002: make set3DMask virtual, so we can safely notify the shadercontext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ad gm Created 6 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
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkFilterShader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBlitter.cpp
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index b9e991789142f7d019d88dbb250902bebddf6e57..f4669d595995099e49217cb2aacefe03af056eab 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -620,7 +620,7 @@ public:
}
}
- void setMask(const SkMask* mask) { fMask = mask; }
+ virtual void set3DMask(const SkMask* mask) SK_OVERRIDE { fMask = mask; }
virtual void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVERRIDE {
if (fProxyContext) {
@@ -740,9 +740,9 @@ SkFlattenable* Sk3DShader::CreateProc(SkReadBuffer& buffer) {
class Sk3DBlitter : public SkBlitter {
public:
- Sk3DBlitter(SkBlitter* proxy, Sk3DShader::Sk3DShaderContext* shaderContext)
+ Sk3DBlitter(SkBlitter* proxy, SkShader::Context* shaderContext)
: fProxy(proxy)
- , f3DShaderContext(shaderContext)
+ , fShaderContext(shaderContext)
{}
virtual void blitH(int x, int y, int width) {
@@ -764,13 +764,13 @@ public:
virtual void blitMask(const SkMask& mask, const SkIRect& clip) {
if (mask.fFormat == SkMask::k3D_Format) {
- f3DShaderContext->setMask(&mask);
+ fShaderContext->set3DMask(&mask);
((SkMask*)&mask)->fFormat = SkMask::kA8_Format;
fProxy->blitMask(mask, clip);
((SkMask*)&mask)->fFormat = SkMask::k3D_Format;
- f3DShaderContext->setMask(NULL);
+ fShaderContext->set3DMask(NULL);
} else {
fProxy->blitMask(mask, clip);
}
@@ -778,8 +778,8 @@ public:
private:
// Both pointers are unowned. They will be deleted by SkSmallAllocator.
- SkBlitter* fProxy;
- Sk3DShader::Sk3DShaderContext* f3DShaderContext;
+ SkBlitter* fProxy;
+ SkShader::Context* fShaderContext;
};
///////////////////////////////////////////////////////////////////////////////
@@ -987,9 +987,9 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
if (shader3D) {
SkBlitter* innerBlitter = blitter;
// innerBlitter was allocated by allocator, which will delete it.
- // We know shaderContext is of type Sk3DShaderContext because it belongs to shader3D.
- blitter = allocator->createT<Sk3DBlitter>(innerBlitter,
- static_cast<Sk3DShader::Sk3DShaderContext*>(shaderContext));
+ // We know shaderContext or its proxies is of type Sk3DShaderContext, so we need to
+ // wrapper the blitter to notify it when we see an emboss mask.
+ blitter = allocator->createT<Sk3DBlitter>(innerBlitter, shaderContext);
}
return blitter;
}
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkFilterShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698