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

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

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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 | « src/core/SkBuffer.h ('k') | src/core/SkCoreBlitters.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 2007 The Android Open Source Project 2 * Copyright 2007 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 SkColorShader_DEFINED 8 #ifndef SkColorShader_DEFINED
9 #define SkColorShader_DEFINED 9 #define SkColorShader_DEFINED
10 10
11 #include "SkShader.h" 11 #include "SkShader.h"
12 12
13 /** \class SkColorShader 13 /** \class SkColorShader
14 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
15 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
16 actual shader object is needed, this provides that feature. 16 actual shader object is needed, this provides that feature.
17 */ 17 */
18 class SK_API SkColorShader : public SkShader { 18 class SK_API SkColorShader : public SkShader {
19 public: 19 public:
20 /** Create a ColorShader that ignores the color in the paint, and uses the 20 /** Create a ColorShader that ignores the color in the paint, and uses the
21 specified color. Note: like all shaders, at draw time the paint's alpha 21 specified color. Note: like all shaders, at draw time the paint's alpha
22 will be respected, and is applied to the specified color. 22 will be respected, and is applied to the specified color.
23 */ 23 */
24 explicit SkColorShader(SkColor c); 24 explicit SkColorShader(SkColor c);
25 25
26 virtual bool isOpaque() const SK_OVERRIDE; 26 bool isOpaque() const SK_OVERRIDE;
27 27
28 virtual size_t contextSize() const SK_OVERRIDE { 28 size_t contextSize() const SK_OVERRIDE {
29 return sizeof(ColorShaderContext); 29 return sizeof(ColorShaderContext);
30 } 30 }
31 31
32 class ColorShaderContext : public SkShader::Context { 32 class ColorShaderContext : public SkShader::Context {
33 public: 33 public:
34 ColorShaderContext(const SkColorShader& shader, const ContextRec&); 34 ColorShaderContext(const SkColorShader& shader, const ContextRec&);
35 35
36 virtual uint32_t getFlags() const SK_OVERRIDE; 36 uint32_t getFlags() const SK_OVERRIDE;
37 virtual uint8_t getSpan16Alpha() const SK_OVERRIDE; 37 uint8_t getSpan16Alpha() const SK_OVERRIDE;
38 virtual void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVE RRIDE; 38 void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVERRIDE;
39 virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OV ERRIDE; 39 void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
40 virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK _OVERRIDE; 40 void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRID E;
41 41
42 private: 42 private:
43 SkPMColor fPMColor; 43 SkPMColor fPMColor;
44 uint32_t fFlags; 44 uint32_t fFlags;
45 uint16_t fColor16; 45 uint16_t fColor16;
46 46
47 typedef SkShader::Context INHERITED; 47 typedef SkShader::Context INHERITED;
48 }; 48 };
49 49
50 // we return false for this, use asAGradient 50 // we return false for this, use asAGradient
51 virtual BitmapType asABitmap(SkBitmap* outTexture, 51 virtual BitmapType asABitmap(SkBitmap* outTexture,
52 SkMatrix* outMatrix, 52 SkMatrix* outMatrix,
53 TileMode xy[2]) const SK_OVERRIDE; 53 TileMode xy[2]) const SK_OVERRIDE;
54 54
55 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; 55 GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
56 56
57 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix& viewM, 57 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix& viewM,
58 const SkMatrix*, GrColor*, 58 const SkMatrix*, GrColor*,
59 GrFragmentProcessor**) const SK_OVERRIDE; 59 GrFragmentProcessor**) const SK_OVERRIDE;
60 60
61 SK_TO_STRING_OVERRIDE() 61 SK_TO_STRING_OVERRIDE()
62 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader) 62 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader)
63 63
64 protected: 64 protected:
65 SkColorShader(SkReadBuffer&); 65 SkColorShader(SkReadBuffer&);
66 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 66 void flatten(SkWriteBuffer&) const SK_OVERRIDE;
67 virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_ OVERRIDE; 67 Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE ;
68 virtual bool onAsLuminanceColor(SkColor* lum) const SK_OVERRIDE { 68 bool onAsLuminanceColor(SkColor* lum) const SK_OVERRIDE {
69 *lum = fColor; 69 *lum = fColor;
70 return true; 70 return true;
71 } 71 }
72 72
73 private: 73 private:
74 SkColor fColor; 74 SkColor fColor;
75 75
76 typedef SkShader INHERITED; 76 typedef SkShader INHERITED;
77 }; 77 };
78 78
79 #endif 79 #endif
OLDNEW
« no previous file with comments | « src/core/SkBuffer.h ('k') | src/core/SkCoreBlitters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698