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

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

Issue 1225673007: Initial CL to create dummy GrShaderDataManager and thread it through (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 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
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 "SkMask.h" 13 #include "SkMask.h"
14 #include "SkMatrix.h" 14 #include "SkMatrix.h"
15 #include "SkPaint.h" 15 #include "SkPaint.h"
16 #include "../gpu/GrColor.h" 16 #include "../gpu/GrColor.h"
17 17
18 class SkPath; 18 class SkPath;
19 class SkPicture; 19 class SkPicture;
20 class SkXfermode; 20 class SkXfermode;
21 class GrContext; 21 class GrContext;
22 class GrFragmentProcessor; 22 class GrFragmentProcessor;
23 class GrShaderDataManager;
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
27 * 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
28 * 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
29 * 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
30 * 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
31 * 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
32 * to be modified. 33 * to be modified.
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 * the paint's color as then many GPU shaders may be generated. 358 * the paint's color as then many GPU shaders may be generated.
358 * 359 *
359 * The GrContext may be used by the effect to create textures. The GPU devi ce does not 360 * The GrContext may be used by the effect to create textures. The GPU devi ce does not
360 * call createContext. Instead we pass the SkPaint here in case the shader needs paint info. 361 * call createContext. Instead we pass the SkPaint here in case the shader needs paint info.
361 * 362 *
362 * A view matrix is always required to create the correct GrFragmentProcess or. Some shaders 363 * A view matrix is always required to create the correct GrFragmentProcess or. Some shaders
363 * may also use the optional localMatrix to define a matrix relevant only f or sampling. 364 * may also use the optional localMatrix to define a matrix relevant only f or sampling.
364 */ 365 */
365 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix& viewM, 366 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix& viewM,
366 const SkMatrix* localMatrix, GrColor*, 367 const SkMatrix* localMatrix, GrColor*,
367 GrFragmentProcessor**) const; 368 GrShaderDataManager*, GrFragmentProcessor** ) const;
368 369
369 /** 370 /**
370 * If the shader can represent its "average" luminance in a single color, r eturn true and 371 * If the shader can represent its "average" luminance in a single color, r eturn true and
371 * if color is not NULL, return that color. If it cannot, return false and ignore the color 372 * if color is not NULL, return that color. If it cannot, return false and ignore the color
372 * parameter. 373 * parameter.
373 * 374 *
374 * Note: if this returns true, the returned color will always be opaque, as only the RGB 375 * Note: if this returns true, the returned color will always be opaque, as only the RGB
375 * components are used to compute luminance. 376 * components are used to compute luminance.
376 */ 377 */
377 bool asLuminanceColor(SkColor*) const; 378 bool asLuminanceColor(SkColor*) const;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // constructors. 475 // constructors.
475 SkMatrix fLocalMatrix; 476 SkMatrix fLocalMatrix;
476 477
477 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con structor. 478 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con structor.
478 friend class SkLocalMatrixShader; 479 friend class SkLocalMatrixShader;
479 480
480 typedef SkFlattenable INHERITED; 481 typedef SkFlattenable INHERITED;
481 }; 482 };
482 483
483 #endif 484 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698