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

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

Issue 492963002: extend SkShader to report a luminance-color to be used for gamma correction (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase, add SkShader::CreateColorShader(c) Created 6 years, 4 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
2 /* 1 /*
3 * Copyright 2007 The Android Open Source Project 2 * Copyright 2007 The Android Open Source Project
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9
10 #ifndef SkColorShader_DEFINED 8 #ifndef SkColorShader_DEFINED
11 #define SkColorShader_DEFINED 9 #define SkColorShader_DEFINED
12 10
13 #include "SkShader.h" 11 #include "SkShader.h"
14 12
15 /** \class SkColorShader 13 /** \class SkColorShader
16 A Shader that represents a single color. In general, this effect can be 14 A Shader that represents a single color. In general, this effect can be
17 accomplished by just using the color field on the paint, but if an 15 accomplished by just using the color field on the paint, but if an
18 actual shader object is needed, this provides that feature. 16 actual shader object is needed, this provides that feature.
19 */ 17 */
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 const SkMatrix* localMatrix, GrColor* paintColor, 58 const SkMatrix* localMatrix, GrColor* paintColor,
61 GrEffect** effect) const SK_OVERRIDE; 59 GrEffect** effect) const SK_OVERRIDE;
62 60
63 SK_TO_STRING_OVERRIDE() 61 SK_TO_STRING_OVERRIDE()
64 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader) 62 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader)
65 63
66 protected: 64 protected:
67 SkColorShader(SkReadBuffer&); 65 SkColorShader(SkReadBuffer&);
68 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 66 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
69 virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_ OVERRIDE; 67 virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_ OVERRIDE;
68 virtual bool onAsLuminanceColor(SkColor* lum) const SK_OVERRIDE {
69 *lum = fColor;
70 return true;
71 }
70 72
71 private: 73 private:
72 SkColor fColor; // ignored if fInheritColor is true 74 SkColor fColor;
73 75
74 typedef SkShader INHERITED; 76 typedef SkShader INHERITED;
75 }; 77 };
76 78
77 #endif 79 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698