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

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

Issue 1530743002: Fix UB function problems for shaders and mask. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix 16-bit masks Created 5 years 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 | « no previous file | src/core/SkBitmapProcShader.cpp » ('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
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 */ 142 */
143 virtual uint8_t getSpan16Alpha() const { return fPaintAlpha; } 143 virtual uint8_t getSpan16Alpha() const { return fPaintAlpha; }
144 144
145 /** 145 /**
146 * Called for each span of the object being drawn. Your subclass should 146 * Called for each span of the object being drawn. Your subclass should
147 * set the appropriate colors (with premultiplied alpha) that correspon d 147 * set the appropriate colors (with premultiplied alpha) that correspon d
148 * to the specified device coordinates. 148 * to the specified device coordinates.
149 */ 149 */
150 virtual void shadeSpan(int x, int y, SkPMColor[], int count) = 0; 150 virtual void shadeSpan(int x, int y, SkPMColor[], int count) = 0;
151 151
152 typedef void (*ShadeProc)(void* ctx, int x, int y, SkPMColor[], int coun t); 152 /**
153 * The const void* ctx is only const because all the implementations are const.
154 * This can be changed to non-const if a new shade proc needs to change the ctx.
155 */
156 typedef void (*ShadeProc)(const void* ctx, int x, int y, SkPMColor[], in t count);
153 virtual ShadeProc asAShadeProc(void** ctx); 157 virtual ShadeProc asAShadeProc(void** ctx);
154 158
155 /** 159 /**
156 * Called only for 16bit devices when getFlags() returns 160 * Called only for 16bit devices when getFlags() returns
157 * kOpaqueAlphaFlag | kHasSpan16_Flag 161 * kOpaqueAlphaFlag | kHasSpan16_Flag
158 */ 162 */
159 virtual void shadeSpan16(int x, int y, uint16_t[], int count); 163 virtual void shadeSpan16(int x, int y, uint16_t[], int count);
160 164
161 /** 165 /**
162 * Similar to shadeSpan, but only returns the alpha-channel for a span. 166 * Similar to shadeSpan, but only returns the alpha-channel for a span.
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 SkMatrix fLocalMatrix; 443 SkMatrix fLocalMatrix;
440 444
441 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con structor. 445 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con structor.
442 friend class SkLocalMatrixShader; 446 friend class SkLocalMatrixShader;
443 friend class SkBitmapProcShader; // for computeTotalInverse() 447 friend class SkBitmapProcShader; // for computeTotalInverse()
444 448
445 typedef SkFlattenable INHERITED; 449 typedef SkFlattenable INHERITED;
446 }; 450 };
447 451
448 #endif 452 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBitmapProcShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698