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

Side by Side Diff: include/core/SkShader.h

Issue 1724503002: Add dest type hint to SkShader::ContextRec (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « gm/SkLinearBitmapPipelineGM.cpp ('k') | src/core/SkBlitter.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 #ifndef SkShader_DEFINED 8 #ifndef SkShader_DEFINED
9 #define SkShader_DEFINED 9 #define SkShader_DEFINED
10 10
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkFlattenable.h" 12 #include "SkFlattenable.h"
13 #include "SkImageInfo.h"
13 #include "SkMask.h" 14 #include "SkMask.h"
14 #include "SkMatrix.h" 15 #include "SkMatrix.h"
15 #include "SkPaint.h" 16 #include "SkPaint.h"
16 #include "../gpu/GrColor.h" 17 #include "../gpu/GrColor.h"
17 18
18 class SkColorFilter; 19 class SkColorFilter;
19 class SkPath; 20 class SkPath;
20 class SkPicture; 21 class SkPicture;
21 class SkXfermode; 22 class SkXfermode;
22 class GrContext; 23 class GrContext;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 * colors, subject to the SkPaint using the shader to apply an opaque 90 * colors, subject to the SkPaint using the shader to apply an opaque
90 * alpha value. Subclasses should override this to allow some 91 * alpha value. Subclasses should override this to allow some
91 * optimizations. 92 * optimizations.
92 */ 93 */
93 virtual bool isOpaque() const { return false; } 94 virtual bool isOpaque() const { return false; }
94 95
95 /** 96 /**
96 * ContextRec acts as a parameter bundle for creating Contexts. 97 * ContextRec acts as a parameter bundle for creating Contexts.
97 */ 98 */
98 struct ContextRec { 99 struct ContextRec {
99 ContextRec(const SkPaint& paint, const SkMatrix& matrix, const SkMatrix* localM) 100 enum DstType {
101 kPMColor_DstType, // clients prefer shading into PMColor dest
102 kPM4f_DstType, // clients prefer shading into PM4f dest
103 };
104
105 ContextRec(const SkPaint& paint, const SkMatrix& matrix, const SkMatrix* localM,
106 DstType dstType)
100 : fPaint(&paint) 107 : fPaint(&paint)
101 , fMatrix(&matrix) 108 , fMatrix(&matrix)
102 , fLocalMatrix(localM) {} 109 , fLocalMatrix(localM)
110 , fPreferredDstType(dstType) {}
103 111
104 const SkPaint* fPaint; // the current paint associated with the draw 112 const SkPaint* fPaint; // the current paint associated with the draw
105 const SkMatrix* fMatrix; // the current matrix in the canvas 113 const SkMatrix* fMatrix; // the current matrix in the canvas
106 const SkMatrix* fLocalMatrix; // optional local matrix 114 const SkMatrix* fLocalMatrix; // optional local matrix
115 const DstType fPreferredDstType; // the "natural" client dest type
107 }; 116 };
108 117
109 class Context : public ::SkNoncopyable { 118 class Context : public ::SkNoncopyable {
110 public: 119 public:
111 Context(const SkShader& shader, const ContextRec&); 120 Context(const SkShader& shader, const ContextRec&);
112 121
113 virtual ~Context(); 122 virtual ~Context();
114 123
115 /** 124 /**
116 * Called sometimes before drawing with this shader. Return the type of 125 * Called sometimes before drawing with this shader. Return the type of
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 SkMatrix fLocalMatrix; 435 SkMatrix fLocalMatrix;
427 436
428 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con structor. 437 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con structor.
429 friend class SkLocalMatrixShader; 438 friend class SkLocalMatrixShader;
430 friend class SkBitmapProcShader; // for computeTotalInverse() 439 friend class SkBitmapProcShader; // for computeTotalInverse()
431 440
432 typedef SkFlattenable INHERITED; 441 typedef SkFlattenable INHERITED;
433 }; 442 };
434 443
435 #endif 444 #endif
OLDNEW
« no previous file with comments | « gm/SkLinearBitmapPipelineGM.cpp ('k') | src/core/SkBlitter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698