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

Side by Side Diff: src/core/SkShader.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/SkSemaphore.cpp ('k') | src/core/SkSmallAllocator.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 * 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 "SkAtomics.h" 8 #include "SkAtomics.h"
9 #include "SkBitmapProcShader.h" 9 #include "SkBitmapProcShader.h"
10 #include "SkColorShader.h" 10 #include "SkColorShader.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const SkMatrix* m = &total; 68 const SkMatrix* m = &total;
69 if (rec.fLocalMatrix) { 69 if (rec.fLocalMatrix) {
70 total.setConcat(*m, *rec.fLocalMatrix); 70 total.setConcat(*m, *rec.fLocalMatrix);
71 m = &total; 71 m = &total;
72 } 72 }
73 return m->invert(totalInverse); 73 return m->invert(totalInverse);
74 } 74 }
75 75
76 bool SkShader::asLuminanceColor(SkColor* colorPtr) const { 76 bool SkShader::asLuminanceColor(SkColor* colorPtr) const {
77 SkColor storage; 77 SkColor storage;
78 if (NULL == colorPtr) { 78 if (nullptr == colorPtr) {
79 colorPtr = &storage; 79 colorPtr = &storage;
80 } 80 }
81 if (this->onAsLuminanceColor(colorPtr)) { 81 if (this->onAsLuminanceColor(colorPtr)) {
82 *colorPtr = SkColorSetA(*colorPtr, 0xFF); // we only return opaque 82 *colorPtr = SkColorSetA(*colorPtr, 0xFF); // we only return opaque
83 return true; 83 return true;
84 } 84 }
85 return false; 85 return false;
86 } 86 }
87 87
88 SkShader::Context* SkShader::createContext(const ContextRec& rec, void* storage) const { 88 SkShader::Context* SkShader::createContext(const ContextRec& rec, void* storage) const {
89 if (!this->computeTotalInverse(rec, NULL)) { 89 if (!this->computeTotalInverse(rec, nullptr)) {
90 return NULL; 90 return nullptr;
91 } 91 }
92 return this->onCreateContext(rec, storage); 92 return this->onCreateContext(rec, storage);
93 } 93 }
94 94
95 SkShader::Context* SkShader::onCreateContext(const ContextRec& rec, void*) const { 95 SkShader::Context* SkShader::onCreateContext(const ContextRec& rec, void*) const {
96 return NULL; 96 return nullptr;
97 } 97 }
98 98
99 size_t SkShader::contextSize() const { 99 size_t SkShader::contextSize() const {
100 return 0; 100 return 0;
101 } 101 }
102 102
103 SkShader::Context::Context(const SkShader& shader, const ContextRec& rec) 103 SkShader::Context::Context(const SkShader& shader, const ContextRec& rec)
104 : fShader(shader), fCTM(*rec.fMatrix) 104 : fShader(shader), fCTM(*rec.fMatrix)
105 { 105 {
106 // Because the context parameters must be valid at this point, we know that the matrix is 106 // Because the context parameters must be valid at this point, we know that the matrix is
107 // invertible. 107 // invertible.
108 SkAssertResult(fShader.computeTotalInverse(rec, &fTotalInverse)); 108 SkAssertResult(fShader.computeTotalInverse(rec, &fTotalInverse));
109 fTotalInverseClass = (uint8_t)ComputeMatrixClass(fTotalInverse); 109 fTotalInverseClass = (uint8_t)ComputeMatrixClass(fTotalInverse);
110 110
111 fPaintAlpha = rec.fPaint->getAlpha(); 111 fPaintAlpha = rec.fPaint->getAlpha();
112 } 112 }
113 113
114 SkShader::Context::~Context() {} 114 SkShader::Context::~Context() {}
115 115
116 SkShader::Context::ShadeProc SkShader::Context::asAShadeProc(void** ctx) { 116 SkShader::Context::ShadeProc SkShader::Context::asAShadeProc(void** ctx) {
117 return NULL; 117 return nullptr;
118 } 118 }
119 119
120 #include "SkColorPriv.h" 120 #include "SkColorPriv.h"
121 121
122 void SkShader::Context::shadeSpan16(int x, int y, uint16_t span16[], int count) { 122 void SkShader::Context::shadeSpan16(int x, int y, uint16_t span16[], int count) {
123 SkASSERT(span16); 123 SkASSERT(span16);
124 SkASSERT(count > 0); 124 SkASSERT(count > 0);
125 SkASSERT(this->canCallShadeSpan16()); 125 SkASSERT(this->canCallShadeSpan16());
126 126
127 // basically, if we get here, the subclass screwed up 127 // basically, if we get here, the subclass screwed up
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 srcA += 4; 188 srcA += 4;
189 } while (--n != 0); 189 } while (--n != 0);
190 } while (count > 0); 190 } while (count > 0);
191 #endif 191 #endif
192 } 192 }
193 193
194 SkShader::Context::MatrixClass SkShader::Context::ComputeMatrixClass(const SkMat rix& mat) { 194 SkShader::Context::MatrixClass SkShader::Context::ComputeMatrixClass(const SkMat rix& mat) {
195 MatrixClass mc = kLinear_MatrixClass; 195 MatrixClass mc = kLinear_MatrixClass;
196 196
197 if (mat.hasPerspective()) { 197 if (mat.hasPerspective()) {
198 if (mat.fixedStepInX(0, NULL, NULL)) { 198 if (mat.fixedStepInX(0, nullptr, nullptr)) {
199 mc = kFixedStepInX_MatrixClass; 199 mc = kFixedStepInX_MatrixClass;
200 } else { 200 } else {
201 mc = kPerspective_MatrixClass; 201 mc = kPerspective_MatrixClass;
202 } 202 }
203 } 203 }
204 return mc; 204 return mc;
205 } 205 }
206 206
207 ////////////////////////////////////////////////////////////////////////////// 207 //////////////////////////////////////////////////////////////////////////////
208 208
209 SkShader::BitmapType SkShader::asABitmap(SkBitmap*, SkMatrix*, TileMode*) const { 209 SkShader::BitmapType SkShader::asABitmap(SkBitmap*, SkMatrix*, TileMode*) const {
210 return kNone_BitmapType; 210 return kNone_BitmapType;
211 } 211 }
212 212
213 SkShader::GradientType SkShader::asAGradient(GradientInfo* info) const { 213 SkShader::GradientType SkShader::asAGradient(GradientInfo* info) const {
214 return kNone_GradientType; 214 return kNone_GradientType;
215 } 215 }
216 216
217 bool SkShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&, const SkMatrix*, 217 bool SkShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&, const SkMatrix*,
218 GrColor*, GrProcessorDataManager*, 218 GrColor*, GrProcessorDataManager*,
219 GrFragmentProcessor**) const { 219 GrFragmentProcessor**) const {
220 return false; 220 return false;
221 } 221 }
222 222
223 SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const { 223 SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const {
224 return NULL; 224 return nullptr;
225 } 225 }
226 226
227 SkShader* SkShader::CreateEmptyShader() { return new SkEmptyShader; } 227 SkShader* SkShader::CreateEmptyShader() { return new SkEmptyShader; }
228 228
229 SkShader* SkShader::CreateColorShader(SkColor color) { return new SkColorShader( color); } 229 SkShader* SkShader::CreateColorShader(SkColor color) { return new SkColorShader( color); }
230 230
231 SkShader* SkShader::CreateBitmapShader(const SkBitmap& src, TileMode tmx, TileMo de tmy, 231 SkShader* SkShader::CreateBitmapShader(const SkBitmap& src, TileMode tmx, TileMo de tmy,
232 const SkMatrix* localMatrix) { 232 const SkMatrix* localMatrix) {
233 return SkCreateBitmapShader(src, tmx, tmy, localMatrix, NULL); 233 return SkCreateBitmapShader(src, tmx, tmy, localMatrix, nullptr);
234 } 234 }
235 235
236 SkShader* SkShader::CreatePictureShader(const SkPicture* src, TileMode tmx, Tile Mode tmy, 236 SkShader* SkShader::CreatePictureShader(const SkPicture* src, TileMode tmx, Tile Mode tmy,
237 const SkMatrix* localMatrix, const SkRec t* tile) { 237 const SkMatrix* localMatrix, const SkRec t* tile) {
238 return SkPictureShader::Create(src, tmx, tmy, localMatrix, tile); 238 return SkPictureShader::Create(src, tmx, tmy, localMatrix, tile);
239 } 239 }
240 240
241 #ifndef SK_IGNORE_TO_STRING 241 #ifndef SK_IGNORE_TO_STRING
242 void SkShader::toString(SkString* str) const { 242 void SkShader::toString(SkString* str) const {
243 if (!fLocalMatrix.isIdentity()) { 243 if (!fLocalMatrix.isIdentity()) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 return kColor_GradientType; 332 return kColor_GradientType;
333 } 333 }
334 334
335 #if SK_SUPPORT_GPU 335 #if SK_SUPPORT_GPU
336 336
337 #include "SkGr.h" 337 #include "SkGr.h"
338 338
339 bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMatrix&, 339 bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const SkMatrix&,
340 const SkMatrix*, GrColor* paintColor, 340 const SkMatrix*, GrColor* paintColor,
341 GrProcessorDataManager*, GrFragmentProce ssor** fp) const { 341 GrProcessorDataManager*, GrFragmentProce ssor** fp) const {
342 *fp = NULL; 342 *fp = nullptr;
343 SkColor skColor = fColor; 343 SkColor skColor = fColor;
344 U8CPU newA = SkMulDiv255Round(SkColorGetA(fColor), paint.getAlpha()); 344 U8CPU newA = SkMulDiv255Round(SkColorGetA(fColor), paint.getAlpha());
345 *paintColor = SkColor2GrColor(SkColorSetA(skColor, newA)); 345 *paintColor = SkColor2GrColor(SkColorSetA(skColor, newA));
346 return true; 346 return true;
347 } 347 }
348 348
349 #else 349 #else
350 350
351 bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatr ix&, 351 bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatr ix&,
352 const SkMatrix*, GrColor*, GrProcessorDa taManager*, 352 const SkMatrix*, GrColor*, GrProcessorDa taManager*,
(...skipping 27 matching lines...) Expand all
380 #include "SkEmptyShader.h" 380 #include "SkEmptyShader.h"
381 381
382 void SkEmptyShader::toString(SkString* str) const { 382 void SkEmptyShader::toString(SkString* str) const {
383 str->append("SkEmptyShader: ("); 383 str->append("SkEmptyShader: (");
384 384
385 this->INHERITED::toString(str); 385 this->INHERITED::toString(str);
386 386
387 str->append(")"); 387 str->append(")");
388 } 388 }
389 #endif 389 #endif
OLDNEW
« no previous file with comments | « src/core/SkSemaphore.cpp ('k') | src/core/SkSmallAllocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698