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

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

Issue 248033003: Remove support for inheriting the paint color from SkColorShader (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fColor -> color 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkPicture.h ('k') | src/core/SkShader.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 SkPaint* p = paint.writable(); 921 SkPaint* p = paint.writable();
922 shader = p->setShader(NULL); 922 shader = p->setShader(NULL);
923 cf = p->setColorFilter(NULL); 923 cf = p->setColorFilter(NULL);
924 mode = p->setXfermodeMode(SkXfermode::kSrc_Mode); 924 mode = p->setXfermodeMode(SkXfermode::kSrc_Mode);
925 p->setColor(0); 925 p->setColor(0);
926 } 926 }
927 927
928 if (NULL == shader) { 928 if (NULL == shader) {
929 if (mode) { 929 if (mode) {
930 // xfermodes (and filters) require shaders for our current blitters 930 // xfermodes (and filters) require shaders for our current blitters
931 shader = SkNEW(SkColorShader); 931 shader = SkNEW_ARGS(SkColorShader, (paint->getColor()));
932 paint.writable()->setShader(shader)->unref(); 932 paint.writable()->setShader(shader)->unref();
933 paint.writable()->setAlpha(0xFF);
933 } else if (cf) { 934 } else if (cf) {
934 // if no shader && no xfermode, we just apply the colorfilter to 935 // if no shader && no xfermode, we just apply the colorfilter to
935 // our color and move on. 936 // our color and move on.
936 SkPaint* writablePaint = paint.writable(); 937 SkPaint* writablePaint = paint.writable();
937 writablePaint->setColor(cf->filterColor(paint->getColor())); 938 writablePaint->setColor(cf->filterColor(paint->getColor()));
938 writablePaint->setColorFilter(NULL); 939 writablePaint->setColorFilter(NULL);
939 cf = NULL; 940 cf = NULL;
940 } 941 }
941 } 942 }
942 943
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 // live context in fShaderContext because the storage is owned by an SkSmall Allocator 1048 // live context in fShaderContext because the storage is owned by an SkSmall Allocator
1048 // outside of this class. 1049 // outside of this class.
1049 // The new context will be of the same size as the old one because we use th e same 1050 // The new context will be of the same size as the old one because we use th e same
1050 // shader to create it. It is therefore safe to re-use the storage. 1051 // shader to create it. It is therefore safe to re-use the storage.
1051 fShaderContext->~Context(); 1052 fShaderContext->~Context();
1052 fShaderContext = fShader->createContext(device, paint, matrix, (void*)fShade rContext); 1053 fShaderContext = fShader->createContext(device, paint, matrix, (void*)fShade rContext);
1053 SkASSERT(fShaderContext); 1054 SkASSERT(fShaderContext);
1054 1055
1055 return true; 1056 return true;
1056 } 1057 }
OLDNEW
« no previous file with comments | « include/core/SkPicture.h ('k') | src/core/SkShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698