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

Unified Diff: src/core/SkBlitter.cpp

Issue 816003002: Add device space skshader GM to test kDevice_GrCoordSet (Closed) Base URL: https://skia.googlesource.com/skia.git@kpos
Patch Set: add #if SK_SUPPORT_GPU, make FP a non-local class so it can be a template param in c++03. Created 6 years 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 | « include/gpu/GrColor.h ('k') | tests/GpuColorFilterTest.cpp » ('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 792661bc6f1a588d8c6490c430d5764a26f6ef60..5bb7ac8d015a9ac113020a076f86880dd435ee14 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -841,14 +841,11 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
bool drawCoverage) {
SkASSERT(allocator != NULL);
- SkBlitter* blitter = NULL;
-
// which check, in case we're being called by a client with a dummy device
// (e.g. they have a bounder that always aborts the draw)
if (kUnknown_SkColorType == device.colorType() ||
(drawCoverage && (kAlpha_8_SkColorType != device.colorType()))) {
- blitter = allocator->createT<SkNullBlitter>();
- return blitter;
+ return allocator->createT<SkNullBlitter>();
}
SkShader* shader = origPaint.getShader();
@@ -873,8 +870,7 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
paint.writable()->setXfermode(NULL);
break;
case kSkipDrawing_XferInterp:{
- blitter = allocator->createT<SkNullBlitter>();
- return blitter;
+ return allocator->createT<SkNullBlitter>();
}
default:
break;
@@ -921,24 +917,26 @@ SkBlitter* SkBlitter::Choose(const SkBitmap& device,
/*
* We create a SkShader::Context object, and store it on the blitter.
*/
- SkShader::Context* shaderContext;
+ SkShader::Context* shaderContext = NULL;
if (shader) {
SkShader::ContextRec rec(device, *paint, matrix);
- // Try to create the ShaderContext
- void* storage = allocator->reserveT<SkShader::Context>(shader->contextSize());
- shaderContext = shader->createContext(rec, storage);
- if (!shaderContext) {
- allocator->freeLast();
- blitter = allocator->createT<SkNullBlitter>();
- return blitter;
+ size_t contextSize = shader->contextSize();
+ if (contextSize) {
+ // Try to create the ShaderContext
+ void* storage = allocator->reserveT<SkShader::Context>(contextSize);
+ shaderContext = shader->createContext(rec, storage);
+ if (!shaderContext) {
+ allocator->freeLast();
+ return allocator->createT<SkNullBlitter>();
+ }
+ SkASSERT(shaderContext);
+ SkASSERT((void*) shaderContext == storage);
+ } else {
+ return allocator->createT<SkNullBlitter>();
}
- SkASSERT(shaderContext);
- SkASSERT((void*) shaderContext == storage);
- } else {
- shaderContext = NULL;
}
-
+ SkBlitter* blitter = NULL;
switch (device.colorType()) {
case kAlpha_8_SkColorType:
if (drawCoverage) {
« no previous file with comments | « include/gpu/GrColor.h ('k') | tests/GpuColorFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698