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

Side by Side Diff: src/core/SkBlitter.cpp

Issue 315743003: Use Identity matrix for SkTransparentShader. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698