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

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: 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
« include/core/SkShader.h ('K') | « 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 // should be overridden by subclass
69 return NULL;
70 }
71
72 size_t SkShader::contextSize() const {
73 // should be overridden by subclass
74 return 0;
75 }
76
66 SkShader::Context::Context(const SkShader& shader, const SkBitmap& device, 77 SkShader::Context::Context(const SkShader& shader, const SkBitmap& device,
67 const SkPaint& paint, const SkMatrix& matrix) 78 const SkPaint& paint, const SkMatrix& matrix)
68 : fShader(shader) 79 : fShader(shader)
69 { 80 {
70 SkASSERT(fShader.validContext(device, paint, matrix)); 81 SkASSERT(fShader.validContext(device, paint, matrix));
71 82
72 // Because the context parameters must be valid at this point, we know that the matrix is 83 // Because the context parameters must be valid at this point, we know that the matrix is
73 // invertible. 84 // invertible.
74 SkAssertResult(fShader.computeTotalInverse(matrix, &fTotalInverse)); 85 SkAssertResult(fShader.computeTotalInverse(matrix, &fTotalInverse));
75 fTotalInverseClass = (uint8_t)ComputeMatrixClass(fTotalInverse); 86 fTotalInverseClass = (uint8_t)ComputeMatrixClass(fTotalInverse);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 #include "SkEmptyShader.h" 341 #include "SkEmptyShader.h"
331 342
332 void SkEmptyShader::toString(SkString* str) const { 343 void SkEmptyShader::toString(SkString* str) const {
333 str->append("SkEmptyShader: ("); 344 str->append("SkEmptyShader: (");
334 345
335 this->INHERITED::toString(str); 346 this->INHERITED::toString(str);
336 347
337 str->append(")"); 348 str->append(")");
338 } 349 }
339 #endif 350 #endif
OLDNEW
« include/core/SkShader.h ('K') | « include/core/SkShader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698