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

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

Issue 318923005: SkShader::asNewEffect Refactoring (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Style corrections Created 6 years, 6 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 | « no previous file | include/effects/SkPerlinNoiseShader.h » ('j') | src/core/SkBitmapProcShader.h » ('J')
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 18
18 class SkPath; 19 class SkPath;
19 class SkPicture; 20 class SkPicture;
20 class SkXfermode; 21 class SkXfermode;
21 class GrContext; 22 class GrContext;
22 class GrEffectRef; 23 class GrEffectRef;
23 24
24 /** \class SkShader 25 /** \class SkShader
25 * 26 *
26 * 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
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 struct ComposeRec { 367 struct ComposeRec {
367 const SkShader* fShaderA; 368 const SkShader* fShaderA;
368 const SkShader* fShaderB; 369 const SkShader* fShaderB;
369 const SkXfermode* fMode; 370 const SkXfermode* fMode;
370 }; 371 };
371 372
372 virtual bool asACompose(ComposeRec* rec) const { return false; } 373 virtual bool asACompose(ComposeRec* rec) const { return false; }
373 374
374 375
375 /** 376 /**
376 * If the shader subclass has a GrEffect implementation, this resturns the effect to install. 377 * If the shader subclass has a GrEffect implementation, this resturns the effect to install.
bsalomon 2014/06/05 17:32:44 These comments need updating.
dandov 2014/06/06 21:50:43 Done.
377 * The incoming color to the effect has r=g=b=a all extracted from the SkPa int's alpha. 378 * The incoming color to the effect has r=g=b=a all extracted from the SkPa int's alpha.
378 * The output color should be the computed SkShader premul color modulated by the incoming 379 * The output color should be the computed SkShader premul color modulated by the incoming
379 * color. The GrContext may be used by the effect to create textures. The G PU device does not 380 * color. The GrContext may be used by the effect to create textures. The G PU device does not
380 * call createContext. Instead we pass the SkPaint here in case the shader needs paint info. 381 * call createContext. Instead we pass the SkPaint here in case the shader needs paint info.
381 */ 382 */
382 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint& paint, 383 virtual bool asNewEffect(GrContext* context, const SkPaint& paint, GrColor* grColor,
jvanverth1 2014/06/05 17:03:07 I'd probably put grColor and grEffect at the end o
dandov 2014/06/06 21:50:43 Done.
383 const SkMatrix* localMatrixOrNull) const; 384 GrEffectRef** grEffect, const SkMatrix* localMatrix OrNull) const;
384 385
385 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 386 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
386 /** 387 /**
387 * If the shader is a custom shader which has data the caller might want, c all this function 388 * If the shader is a custom shader which has data the caller might want, c all this function
388 * to get that data. 389 * to get that data.
389 */ 390 */
390 virtual bool asACustomShader(void** customData) const { return false; } 391 virtual bool asACustomShader(void** customData) const { return false; }
391 #endif 392 #endif
392 393
393 ////////////////////////////////////////////////////////////////////////// 394 //////////////////////////////////////////////////////////////////////////
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 */ 462 */
462 virtual Context* onCreateContext(const ContextRec&, void* storage) const; 463 virtual Context* onCreateContext(const ContextRec&, void* storage) const;
463 464
464 private: 465 private:
465 SkMatrix fLocalMatrix; 466 SkMatrix fLocalMatrix;
466 467
467 typedef SkFlattenable INHERITED; 468 typedef SkFlattenable INHERITED;
468 }; 469 };
469 470
470 #endif 471 #endif
OLDNEW
« no previous file with comments | « no previous file | include/effects/SkPerlinNoiseShader.h » ('j') | src/core/SkBitmapProcShader.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698