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

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

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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 | « src/core/SkColorTable.cpp ('k') | src/core/SkConfig8888.h » ('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 "SkComposeShader.h" 10 #include "SkComposeShader.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 SkPaint* fPaint; 51 SkPaint* fPaint;
52 uint8_t fAlpha; 52 uint8_t fAlpha;
53 }; 53 };
54 #define SkAutoAlphaRestore(...) SK_REQUIRE_LOCAL_VAR(SkAutoAlphaRestore) 54 #define SkAutoAlphaRestore(...) SK_REQUIRE_LOCAL_VAR(SkAutoAlphaRestore)
55 55
56 SkFlattenable* SkComposeShader::CreateProc(SkReadBuffer& buffer) { 56 SkFlattenable* SkComposeShader::CreateProc(SkReadBuffer& buffer) {
57 SkAutoTUnref<SkShader> shaderA(buffer.readShader()); 57 SkAutoTUnref<SkShader> shaderA(buffer.readShader());
58 SkAutoTUnref<SkShader> shaderB(buffer.readShader()); 58 SkAutoTUnref<SkShader> shaderB(buffer.readShader());
59 SkAutoTUnref<SkXfermode> mode(buffer.readXfermode()); 59 SkAutoTUnref<SkXfermode> mode(buffer.readXfermode());
60 if (!shaderA.get() || !shaderB.get()) { 60 if (!shaderA.get() || !shaderB.get()) {
61 return NULL; 61 return nullptr;
62 } 62 }
63 return new SkComposeShader(shaderA, shaderB, mode); 63 return new SkComposeShader(shaderA, shaderB, mode);
64 } 64 }
65 65
66 void SkComposeShader::flatten(SkWriteBuffer& buffer) const { 66 void SkComposeShader::flatten(SkWriteBuffer& buffer) const {
67 buffer.writeFlattenable(fShaderA); 67 buffer.writeFlattenable(fShaderA);
68 buffer.writeFlattenable(fShaderB); 68 buffer.writeFlattenable(fShaderB);
69 buffer.writeFlattenable(fMode); 69 buffer.writeFlattenable(fMode);
70 } 70 }
71 71
(...skipping 20 matching lines...) Expand all
92 92
93 ContextRec newRec(rec); 93 ContextRec newRec(rec);
94 newRec.fMatrix = &tmpM; 94 newRec.fMatrix = &tmpM;
95 newRec.fPaint = &opaquePaint; 95 newRec.fPaint = &opaquePaint;
96 96
97 SkShader::Context* contextA = fShaderA->createContext(newRec, aStorage); 97 SkShader::Context* contextA = fShaderA->createContext(newRec, aStorage);
98 SkShader::Context* contextB = fShaderB->createContext(newRec, bStorage); 98 SkShader::Context* contextB = fShaderB->createContext(newRec, bStorage);
99 if (!contextA || !contextB) { 99 if (!contextA || !contextB) {
100 safe_call_destructor(contextA); 100 safe_call_destructor(contextA);
101 safe_call_destructor(contextB); 101 safe_call_destructor(contextB);
102 return NULL; 102 return nullptr;
103 } 103 }
104 104
105 return new (storage) ComposeShaderContext(*this, rec, contextA, contextB); 105 return new (storage) ComposeShaderContext(*this, rec, contextA, contextB);
106 } 106 }
107 107
108 SkComposeShader::ComposeShaderContext::ComposeShaderContext( 108 SkComposeShader::ComposeShaderContext::ComposeShaderContext(
109 const SkComposeShader& shader, const ContextRec& rec, 109 const SkComposeShader& shader, const ContextRec& rec,
110 SkShader::Context* contextA, SkShader::Context* contextB) 110 SkShader::Context* contextA, SkShader::Context* contextB)
111 : INHERITED(shader, rec) 111 : INHERITED(shader, rec)
112 , fShaderContextA(contextA) 112 , fShaderContextA(contextA)
(...skipping 23 matching lines...) Expand all
136 SkShader::Context* shaderContextB = fShaderContextB; 136 SkShader::Context* shaderContextB = fShaderContextB;
137 SkXfermode* mode = static_cast<const SkComposeShader&>(fShader).fMode ; 137 SkXfermode* mode = static_cast<const SkComposeShader&>(fShader).fMode ;
138 unsigned scale = SkAlpha255To256(this->getPaintAlpha()); 138 unsigned scale = SkAlpha255To256(this->getPaintAlpha());
139 139
140 #ifdef SK_BUILD_FOR_ANDROID 140 #ifdef SK_BUILD_FOR_ANDROID
141 scale = 256; // ugh -- maintain old bug/behavior for now 141 scale = 256; // ugh -- maintain old bug/behavior for now
142 #endif 142 #endif
143 143
144 SkPMColor tmp[TMP_COLOR_COUNT]; 144 SkPMColor tmp[TMP_COLOR_COUNT];
145 145
146 if (NULL == mode) { // implied SRC_OVER 146 if (nullptr == mode) { // implied SRC_OVER
147 // TODO: when we have a good test-case, should use SkBlitRow::Proc32 147 // TODO: when we have a good test-case, should use SkBlitRow::Proc32
148 // for these loops 148 // for these loops
149 do { 149 do {
150 int n = count; 150 int n = count;
151 if (n > TMP_COLOR_COUNT) { 151 if (n > TMP_COLOR_COUNT) {
152 n = TMP_COLOR_COUNT; 152 n = TMP_COLOR_COUNT;
153 } 153 }
154 154
155 shaderContextA->shadeSpan(x, y, result, n); 155 shaderContextA->shadeSpan(x, y, result, n);
156 shaderContextB->shadeSpan(x, y, tmp, n); 156 shaderContextB->shadeSpan(x, y, tmp, n);
(...skipping 15 matching lines...) Expand all
172 } while (count > 0); 172 } while (count > 0);
173 } else { // use mode for the composition 173 } else { // use mode for the composition
174 do { 174 do {
175 int n = count; 175 int n = count;
176 if (n > TMP_COLOR_COUNT) { 176 if (n > TMP_COLOR_COUNT) {
177 n = TMP_COLOR_COUNT; 177 n = TMP_COLOR_COUNT;
178 } 178 }
179 179
180 shaderContextA->shadeSpan(x, y, result, n); 180 shaderContextA->shadeSpan(x, y, result, n);
181 shaderContextB->shadeSpan(x, y, tmp, n); 181 shaderContextB->shadeSpan(x, y, tmp, n);
182 mode->xfer32(result, tmp, n, NULL); 182 mode->xfer32(result, tmp, n, nullptr);
183 183
184 if (256 != scale) { 184 if (256 != scale) {
185 for (int i = 0; i < n; i++) { 185 for (int i = 0; i < n; i++) {
186 result[i] = SkAlphaMulQ(result[i], scale); 186 result[i] = SkAlphaMulQ(result[i], scale);
187 } 187 }
188 } 188 }
189 189
190 result += n; 190 result += n;
191 x += n; 191 x += n;
192 count -= n; 192 count -= n;
(...skipping 12 matching lines...) Expand all
205 if (fMode) { 205 if (fMode) {
206 str->append(" Xfermode: "); 206 str->append(" Xfermode: ");
207 fMode->toString(str); 207 fMode->toString(str);
208 } 208 }
209 209
210 this->INHERITED::toString(str); 210 this->INHERITED::toString(str);
211 211
212 str->append(")"); 212 str->append(")");
213 } 213 }
214 #endif 214 #endif
OLDNEW
« no previous file with comments | « src/core/SkColorTable.cpp ('k') | src/core/SkConfig8888.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698