OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBlitter.h" | 8 #include "SkBlitter.h" |
9 #include "SkAntiRun.h" | 9 #include "SkAntiRun.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 static_cast<Sk3DShader::Sk3DShaderContext*>(shaderContext)); | 989 static_cast<Sk3DShader::Sk3DShaderContext*>(shaderContext)); |
990 } | 990 } |
991 return blitter; | 991 return blitter; |
992 } | 992 } |
993 | 993 |
994 /////////////////////////////////////////////////////////////////////////////// | 994 /////////////////////////////////////////////////////////////////////////////// |
995 | 995 |
996 class SkTransparentShaderContext : public SkShader::Context { | 996 class SkTransparentShaderContext : public SkShader::Context { |
997 public: | 997 public: |
998 SkTransparentShaderContext(const SkShader& shader, const SkShader::ContextRe
c& rec) | 998 SkTransparentShaderContext(const SkShader& shader, const SkShader::ContextRe
c& rec) |
999 : INHERITED(shader, rec) {} | 999 // Override rec with the identity matrix, so it is guaranteed to be inve
rtible. |
| 1000 : INHERITED(shader, SkShader::ContextRec(*rec.fDevice, *rec.fPaint, SkMa
trix::I())) {} |
1000 | 1001 |
1001 virtual void shadeSpan(int x, int y, SkPMColor colors[], int count) SK_OVERR
IDE { | 1002 virtual void shadeSpan(int x, int y, SkPMColor colors[], int count) SK_OVERR
IDE { |
1002 sk_bzero(colors, count * sizeof(SkPMColor)); | 1003 sk_bzero(colors, count * sizeof(SkPMColor)); |
1003 } | 1004 } |
1004 | 1005 |
1005 private: | 1006 private: |
1006 typedef SkShader::Context INHERITED; | 1007 typedef SkShader::Context INHERITED; |
1007 }; | 1008 }; |
1008 | 1009 |
1009 SkShaderBlitter::SkShaderBlitter(const SkBitmap& device, const SkPaint& paint, | 1010 SkShaderBlitter::SkShaderBlitter(const SkBitmap& device, const SkPaint& paint, |
(...skipping 21 matching lines...) Expand all Loading... |
1031 fShaderContext->~Context(); | 1032 fShaderContext->~Context(); |
1032 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); | 1033 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); |
1033 if (NULL == ctx) { | 1034 if (NULL == ctx) { |
1034 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call | 1035 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call |
1035 // the in-place destructor. | 1036 // the in-place destructor. |
1036 SkNEW_PLACEMENT_ARGS(fShaderContext, SkTransparentShaderContext, (*fShad
er, rec)); | 1037 SkNEW_PLACEMENT_ARGS(fShaderContext, SkTransparentShaderContext, (*fShad
er, rec)); |
1037 return false; | 1038 return false; |
1038 } | 1039 } |
1039 return true; | 1040 return true; |
1040 } | 1041 } |
OLD | NEW |