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

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

Issue 377503004: Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*. (Closed) Base URL: https://skia.googlesource.com/skia.git@no_ref
Patch Set: Update YUV effect to reflect these changes. Created 6 years, 5 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 | « include/core/SkMaskFilter.h ('k') | include/core/SkXfermode.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 8
9 #ifndef SkShader_DEFINED 9 #ifndef SkShader_DEFINED
10 #define SkShader_DEFINED 10 #define SkShader_DEFINED
11 11
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkFlattenable.h" 13 #include "SkFlattenable.h"
14 #include "SkMask.h" 14 #include "SkMask.h"
15 #include "SkMatrix.h" 15 #include "SkMatrix.h"
16 #include "SkPaint.h" 16 #include "SkPaint.h"
17 #include "../gpu/GrColor.h" 17 #include "../gpu/GrColor.h"
18 18
19 class SkPath; 19 class SkPath;
20 class SkPicture; 20 class SkPicture;
21 class SkXfermode; 21 class SkXfermode;
22 class GrContext; 22 class GrContext;
23 class GrEffectRef; 23 class GrEffect;
24 24
25 /** \class SkShader 25 /** \class SkShader
26 * 26 *
27 * Shaders specify the source color(s) for what is being drawn. If a paint 27 * Shaders specify the source color(s) for what is being drawn. If a paint
28 * has no shader, then the paint's color is used. If the paint has a 28 * has no shader, then the paint's color is used. If the paint has a
29 * shader, then the shader's color(s) are use instead, but they are 29 * shader, then the shader's color(s) are use instead, but they are
30 * modulated by the paint's alpha. This makes it easy to create a shader 30 * modulated by the paint's alpha. This makes it easy to create a shader
31 * once (e.g. bitmap tiling or gradient) and then change its transparency 31 * once (e.g. bitmap tiling or gradient) and then change its transparency
32 * w/o having to modify the original shader... only the paint's alpha needs 32 * w/o having to modify the original shader... only the paint's alpha needs
33 * to be modified. 33 * to be modified.
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 * Returns true if the shader subclass succeeds in setting the grEffect and the grColor output 377 * Returns true if the shader subclass succeeds in setting the grEffect and the grColor output
378 * parameters to a value, returns false if it fails or if there is not an i mplementation of 378 * parameters to a value, returns false if it fails or if there is not an i mplementation of
379 * this method in the shader subclass. 379 * this method in the shader subclass.
380 * The incoming color to the effect has r=g=b=a all extracted from the SkPa int's alpha. 380 * The incoming color to the effect has r=g=b=a all extracted from the SkPa int's alpha.
381 * The output color should be the computed SkShader premul color modulated by the incoming 381 * The output color should be the computed SkShader premul color modulated by the incoming
382 * color. The GrContext may be used by the effect to create textures. The G PU device does not 382 * color. The GrContext may be used by the effect to create textures. The G PU device does not
383 * call createContext. Instead we pass the SkPaint here in case the shader needs paint info. 383 * call createContext. Instead we pass the SkPaint here in case the shader needs paint info.
384 */ 384 */
385 virtual bool asNewEffect(GrContext* context, const SkPaint& paint, 385 virtual bool asNewEffect(GrContext* context, const SkPaint& paint,
386 const SkMatrix* localMatrixOrNull, GrColor* grColor , 386 const SkMatrix* localMatrixOrNull, GrColor* grColor ,
387 GrEffectRef** grEffect) const; 387 GrEffect** grEffect) const;
388 388
389 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 389 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
390 /** 390 /**
391 * If the shader is a custom shader which has data the caller might want, c all this function 391 * If the shader is a custom shader which has data the caller might want, c all this function
392 * to get that data. 392 * to get that data.
393 */ 393 */
394 virtual bool asACustomShader(void** customData) const { return false; } 394 virtual bool asACustomShader(void** customData) const { return false; }
395 #endif 395 #endif
396 396
397 ////////////////////////////////////////////////////////////////////////// 397 //////////////////////////////////////////////////////////////////////////
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 */ 465 */
466 virtual Context* onCreateContext(const ContextRec&, void* storage) const; 466 virtual Context* onCreateContext(const ContextRec&, void* storage) const;
467 467
468 private: 468 private:
469 SkMatrix fLocalMatrix; 469 SkMatrix fLocalMatrix;
470 470
471 typedef SkFlattenable INHERITED; 471 typedef SkFlattenable INHERITED;
472 }; 472 };
473 473
474 #endif 474 #endif
OLDNEW
« no previous file with comments | « include/core/SkMaskFilter.h ('k') | include/core/SkXfermode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698