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

Unified Diff: src/core/SkBlitter.cpp

Issue 267923005: remove unneeded SkShader::validContext (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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/SkBlitter.cpp
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index 74cd29824e1bf4f08b4b4701da2efea9862a1a44..2f3cdef6e3f9b70c1a0d42a364f1c9d19d61f258 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -591,29 +591,14 @@ public:
return size;
}
- virtual bool validContext(const ContextRec& rec, SkMatrix* totalInverse) const SK_OVERRIDE {
- if (!this->INHERITED::validContext(rec, totalInverse)) {
- return false;
- }
- if (fProxy) {
- return fProxy->validContext(rec);
- }
- return true;
- }
-
- virtual SkShader::Context* createContext(const ContextRec& rec, void* storage) const SK_OVERRIDE
- {
- if (!this->validContext(rec, NULL)) {
- return NULL;
- }
-
- SkShader::Context* proxyContext;
+ virtual Context* onCreateContext(const ContextRec& rec, void* storage) const SK_OVERRIDE {
+ SkShader::Context* proxyContext = NULL;
if (fProxy) {
char* proxyContextStorage = (char*) storage + sizeof(Sk3DShaderContext);
proxyContext = fProxy->createContext(rec, proxyContextStorage);
- SkASSERT(proxyContext);
- } else {
- proxyContext = NULL;
+ if (!proxyContext) {
+ return NULL;
+ }
}
return SkNEW_PLACEMENT_ARGS(storage, Sk3DShaderContext, (*this, rec, proxyContext));
}
@@ -1035,9 +1020,6 @@ SkShaderBlitter::~SkShaderBlitter() {
bool SkShaderBlitter::resetShaderContext(const SkBitmap& device, const SkPaint& paint,
const SkMatrix& matrix) {
SkShader::ContextRec rec(device, paint, matrix);
- if (!fShader->validContext(rec)) {
- return false;
- }
// Only destroy the old context if we have a new one. We need to ensure to have a
// live context in fShaderContext because the storage is owned by an SkSmallAllocator
@@ -1046,7 +1028,5 @@ bool SkShaderBlitter::resetShaderContext(const SkBitmap& device, const SkPaint&
// shader to create it. It is therefore safe to re-use the storage.
fShaderContext->~Context();
fShaderContext = fShader->createContext(rec, (void*)fShaderContext);
- SkASSERT(fShaderContext);
-
- return true;
+ return fShaderContext != NULL;
}

Powered by Google App Engine
This is Rietveld 408576698