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

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

Issue 374923002: Goodbye GrEffectRef. (Closed) Base URL: https://skia.googlesource.com/skia.git@noref3
Patch Set: Address comments 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/SkColorShader.h ('k') | include/gpu/GrContext.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
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 struct ComposeRec { 367 struct ComposeRec {
368 const SkShader* fShaderA; 368 const SkShader* fShaderA;
369 const SkShader* fShaderB; 369 const SkShader* fShaderB;
370 const SkXfermode* fMode; 370 const SkXfermode* fMode;
371 }; 371 };
372 372
373 virtual bool asACompose(ComposeRec* rec) const { return false; } 373 virtual bool asACompose(ComposeRec* rec) const { return false; }
374 374
375 375
376 /** 376 /**
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 creating an effect or if none is required.
378 * parameters to a value, returns false if it fails or if there is not an i mplementation of 378 * False is returned if it fails or if there is not an implementation of th is method in the
379 * this method in the shader subclass. 379 * shader subclass.
380 * The incoming color to the effect has r=g=b=a all extracted from the SkPa int's alpha. 380 *
381 * The output color should be the computed SkShader premul color modulated by the incoming 381 * On success an implementation of this method must inspect the SkPaint and set paintColor to
382 * color. The GrContext may be used by the effect to create textures. The G PU device does not 382 * the color the effect expects as its input color. If the SkShader wishes to emit a solid
383 * color then it should set paintColor to that color and not create an effe ct. Note that
384 * GrColor is always premul. The common patterns are to convert paint's SkC olor to GrColor or
385 * to extract paint's alpha and replicate it to all channels in paintColor. Upon failure
386 * paintColor should not be modified. It is not recommended to specialize t he effect to
387 * the paint's color as then many GPU shaders may be generated.
388 *
389 * The GrContext may be used by the effect to create textures. The GPU devi ce does not
383 * call createContext. Instead we pass the SkPaint here in case the shader needs paint info. 390 * call createContext. Instead we pass the SkPaint here in case the shader needs paint info.
384 */ 391 */
385 virtual bool asNewEffect(GrContext* context, const SkPaint& paint, 392 virtual bool asNewEffect(GrContext* context, const SkPaint& paint,
386 const SkMatrix* localMatrixOrNull, GrColor* grColor , 393 const SkMatrix* localMatrixOrNull, GrColor* paintCo lor,
387 GrEffect** grEffect) const; 394 GrEffect** effect) const;
388 395
389 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 396 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
390 /** 397 /**
391 * If the shader is a custom shader which has data the caller might want, c all this function 398 * If the shader is a custom shader which has data the caller might want, c all this function
392 * to get that data. 399 * to get that data.
393 */ 400 */
394 virtual bool asACustomShader(void** customData) const { return false; } 401 virtual bool asACustomShader(void** customData) const { return false; }
395 #endif 402 #endif
396 403
397 ////////////////////////////////////////////////////////////////////////// 404 //////////////////////////////////////////////////////////////////////////
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 */ 472 */
466 virtual Context* onCreateContext(const ContextRec&, void* storage) const; 473 virtual Context* onCreateContext(const ContextRec&, void* storage) const;
467 474
468 private: 475 private:
469 SkMatrix fLocalMatrix; 476 SkMatrix fLocalMatrix;
470 477
471 typedef SkFlattenable INHERITED; 478 typedef SkFlattenable INHERITED;
472 }; 479 };
473 480
474 #endif 481 #endif
OLDNEW
« no previous file with comments | « include/core/SkColorShader.h ('k') | include/gpu/GrContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698