| OLD | NEW |
| 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 | |
| 9 #ifndef SkShader_DEFINED | 8 #ifndef SkShader_DEFINED |
| 10 #define SkShader_DEFINED | 9 #define SkShader_DEFINED |
| 11 | 10 |
| 12 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 13 #include "SkFlattenable.h" | 12 #include "SkFlattenable.h" |
| 14 #include "SkMask.h" | 13 #include "SkMask.h" |
| 15 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
| 16 #include "SkPaint.h" | 15 #include "SkPaint.h" |
| 17 #include "../gpu/GrColor.h" | 16 #include "../gpu/GrColor.h" |
| 18 | 17 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 * colors, subject to the SkPaint using the shader to apply an opaque | 106 * colors, subject to the SkPaint using the shader to apply an opaque |
| 108 * alpha value. Subclasses should override this to allow some | 107 * alpha value. Subclasses should override this to allow some |
| 109 * optimizations. | 108 * optimizations. |
| 110 */ | 109 */ |
| 111 virtual bool isOpaque() const { return false; } | 110 virtual bool isOpaque() const { return false; } |
| 112 | 111 |
| 113 /** | 112 /** |
| 114 * ContextRec acts as a parameter bundle for creating Contexts. | 113 * ContextRec acts as a parameter bundle for creating Contexts. |
| 115 */ | 114 */ |
| 116 struct ContextRec { | 115 struct ContextRec { |
| 117 ContextRec() : fDevice(NULL), fPaint(NULL), fMatrix(NULL), fLocalMatrix(
NULL) {} | 116 ContextRec(const SkPaint& paint, const SkMatrix& matrix, const SkMatrix*
localM) |
| 118 ContextRec(const SkBitmap& device, const SkPaint& paint, const SkMatrix&
matrix) | 117 : fPaint(&paint) |
| 119 : fDevice(&device) | |
| 120 , fPaint(&paint) | |
| 121 , fMatrix(&matrix) | 118 , fMatrix(&matrix) |
| 122 , fLocalMatrix(NULL) {} | 119 , fLocalMatrix(localM) {} |
| 123 | 120 |
| 124 const SkBitmap* fDevice; // the bitmap we are drawing into | |
| 125 const SkPaint* fPaint; // the current paint associated with the
draw | 121 const SkPaint* fPaint; // the current paint associated with the
draw |
| 126 const SkMatrix* fMatrix; // the current matrix in the canvas | 122 const SkMatrix* fMatrix; // the current matrix in the canvas |
| 127 const SkMatrix* fLocalMatrix; // optional local matrix | 123 const SkMatrix* fLocalMatrix; // optional local matrix |
| 128 }; | 124 }; |
| 129 | 125 |
| 130 class Context : public ::SkNoncopyable { | 126 class Context : public ::SkNoncopyable { |
| 131 public: | 127 public: |
| 132 Context(const SkShader& shader, const ContextRec&); | 128 Context(const SkShader& shader, const ContextRec&); |
| 133 | 129 |
| 134 virtual ~Context(); | 130 virtual ~Context(); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // constructors. | 476 // constructors. |
| 481 SkMatrix fLocalMatrix; | 477 SkMatrix fLocalMatrix; |
| 482 | 478 |
| 483 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 479 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
| 484 friend class SkLocalMatrixShader; | 480 friend class SkLocalMatrixShader; |
| 485 | 481 |
| 486 typedef SkFlattenable INHERITED; | 482 typedef SkFlattenable INHERITED; |
| 487 }; | 483 }; |
| 488 | 484 |
| 489 #endif | 485 #endif |
| OLD | NEW |