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

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

Issue 262703002: add default impl for context methods on shader (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: update dox, keep contextSize() defaulting to 0 Created 6 years, 7 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/SkShader.h ('k') | 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 "SkBitmapProcShader.h" 8 #include "SkBitmapProcShader.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkMallocPixelRef.h" 10 #include "SkMallocPixelRef.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return m->invert(totalInverse); 56 return m->invert(totalInverse);
57 } 57 }
58 58
59 bool SkShader::validContext(const SkBitmap& device, 59 bool SkShader::validContext(const SkBitmap& device,
60 const SkPaint& paint, 60 const SkPaint& paint,
61 const SkMatrix& matrix, 61 const SkMatrix& matrix,
62 SkMatrix* totalInverse) const { 62 SkMatrix* totalInverse) const {
63 return this->computeTotalInverse(matrix, totalInverse); 63 return this->computeTotalInverse(matrix, totalInverse);
64 } 64 }
65 65
66 SkShader::Context* SkShader::createContext(const SkBitmap&, const SkPaint&, cons t SkMatrix&,
67 void* storage) const {
68 return NULL;
69 }
70
71 size_t SkShader::contextSize() const {
72 return 0;
scroggo 2014/04/30 21:38:23 This may assert in skia/ext/pixel_ref_utils_unitte
Dominik Grewe 2014/05/01 09:18:43 Yes, this will fail if a subclass doesn't overwrit
73 }
74
66 SkShader::Context::Context(const SkShader& shader, const SkBitmap& device, 75 SkShader::Context::Context(const SkShader& shader, const SkBitmap& device,
67 const SkPaint& paint, const SkMatrix& matrix) 76 const SkPaint& paint, const SkMatrix& matrix)
68 : fShader(shader) 77 : fShader(shader)
69 { 78 {
70 SkASSERT(fShader.validContext(device, paint, matrix)); 79 SkASSERT(fShader.validContext(device, paint, matrix));
71 80
72 // Because the context parameters must be valid at this point, we know that the matrix is 81 // Because the context parameters must be valid at this point, we know that the matrix is
73 // invertible. 82 // invertible.
74 SkAssertResult(fShader.computeTotalInverse(matrix, &fTotalInverse)); 83 SkAssertResult(fShader.computeTotalInverse(matrix, &fTotalInverse));
75 fTotalInverseClass = (uint8_t)ComputeMatrixClass(fTotalInverse); 84 fTotalInverseClass = (uint8_t)ComputeMatrixClass(fTotalInverse);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 #include "SkEmptyShader.h" 339 #include "SkEmptyShader.h"
331 340
332 void SkEmptyShader::toString(SkString* str) const { 341 void SkEmptyShader::toString(SkString* str) const {
333 str->append("SkEmptyShader: ("); 342 str->append("SkEmptyShader: (");
334 343
335 this->INHERITED::toString(str); 344 this->INHERITED::toString(str);
336 345
337 str->append(")"); 346 str->append(")");
338 } 347 }
339 #endif 348 #endif
OLDNEW
« no previous file with comments | « include/core/SkShader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698