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

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 261773005: Remove SkShader virtual method validContext (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: correctly call shaderA/B in composeshader Created 6 years, 7 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/SkBlitter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcShader.cpp
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index 46cf7db136d93e8bd2391d134d17e009a666c706..503269ac10690de985354836c32869898672e11c 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -97,39 +97,25 @@ static bool valid_for_drawing(const SkBitmap& bm) {
return true;
}
-bool SkBitmapProcShader::validInternal(const ContextRec& rec, SkMatrix* totalInverse,
- SkBitmapProcState* state) const {
+SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, void* storage) const {
if (!fRawBitmap.getTexture() && !valid_for_drawing(fRawBitmap)) {
- return false;
- }
-
- // Make sure we can use totalInverse as a cache.
- SkMatrix totalInverseLocal;
- if (NULL == totalInverse) {
- totalInverse = &totalInverseLocal;
+ return NULL;
}
-
+
+ SkMatrix totalInverse;
// Do this first, so we know the matrix can be inverted.
- if (!this->INHERITED::validContext(rec, totalInverse)) {
- return false;
+ if (!this->computeTotalInverse(rec, &totalInverse)) {
+ return NULL;
}
+
+ void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext);
+ SkBitmapProcState* state = SkNEW_PLACEMENT(stateStorage, SkBitmapProcState);
SkASSERT(state);
state->fTileModeX = fTileModeX;
state->fTileModeY = fTileModeY;
state->fOrigBitmap = fRawBitmap;
- return state->chooseProcs(*totalInverse, *rec.fPaint);
-}
-
-bool SkBitmapProcShader::validContext(const ContextRec& rec, SkMatrix* totalInverse) const {
- SkBitmapProcState state;
- return this->validInternal(rec, totalInverse, &state);
-}
-
-SkShader::Context* SkBitmapProcShader::createContext(const ContextRec& rec, void* storage) const {
- void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext);
- SkBitmapProcState* state = SkNEW_PLACEMENT(stateStorage, SkBitmapProcState);
- if (!this->validInternal(rec, NULL, state)) {
+ if (!state->chooseProcs(totalInverse, *rec.fPaint)) {
state->~SkBitmapProcState();
return NULL;
}
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698