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

Side by Side Diff: src/gpu/effects/GrYUVtoRGBEffect.cpp

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/gpu/effects/GrTextureDomain.cpp ('k') | src/gpu/gl/GrGLCaps.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 2014 Google Inc. 2 * Copyright 2014 Google Inc.
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 #include "GrYUVtoRGBEffect.h" 8 #include "GrYUVtoRGBEffect.h"
9 9
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
11 #include "GrInvariantOutput.h" 11 #include "GrInvariantOutput.h"
12 #include "GrProcessor.h" 12 #include "GrProcessor.h"
13 #include "gl/GrGLProcessor.h" 13 #include "gl/GrGLProcessor.h"
14 #include "gl/builders/GrGLProgramBuilder.h" 14 #include "gl/builders/GrGLProgramBuilder.h"
15 15
16 namespace { 16 namespace {
17 17
18 class YUVtoRGBEffect : public GrFragmentProcessor { 18 class YUVtoRGBEffect : public GrFragmentProcessor {
19 public: 19 public:
20 static GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture, 20 static GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture,
21 GrTexture* vTexture, SkYUVColorSpace colo rSpace) { 21 GrTexture* vTexture, SkYUVColorSpace colo rSpace) {
22 return SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture, colorSp ace)); 22 return SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture, colorSp ace));
23 } 23 }
24 24
25 virtual const char* name() const SK_OVERRIDE { return "YUV to RGB"; } 25 const char* name() const SK_OVERRIDE { return "YUV to RGB"; }
26 26
27 SkYUVColorSpace getColorSpace() const { 27 SkYUVColorSpace getColorSpace() const {
28 return fColorSpace; 28 return fColorSpace;
29 } 29 }
30 30
31 class GLProcessor : public GrGLFragmentProcessor { 31 class GLProcessor : public GrGLFragmentProcessor {
32 public: 32 public:
33 static const GrGLfloat kJPEGConversionMatrix[16]; 33 static const GrGLfloat kJPEGConversionMatrix[16];
34 static const GrGLfloat kRec601ConversionMatrix[16]; 34 static const GrGLfloat kRec601ConversionMatrix[16];
35 35
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 GrGLProgramDataManager::UniformHandle fMatrixUni; 76 GrGLProgramDataManager::UniformHandle fMatrixUni;
77 77
78 typedef GrGLFragmentProcessor INHERITED; 78 typedef GrGLFragmentProcessor INHERITED;
79 }; 79 };
80 80
81 virtual void getGLProcessorKey(const GrGLCaps& caps, 81 virtual void getGLProcessorKey(const GrGLCaps& caps,
82 GrProcessorKeyBuilder* b) const SK_OVERRIDE { 82 GrProcessorKeyBuilder* b) const SK_OVERRIDE {
83 GLProcessor::GenKey(*this, caps, b); 83 GLProcessor::GenKey(*this, caps, b);
84 } 84 }
85 85
86 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE { 86 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE {
87 return SkNEW_ARGS(GLProcessor, (*this)); 87 return SkNEW_ARGS(GLProcessor, (*this));
88 } 88 }
89 89
90 private: 90 private:
91 YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture , 91 YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture ,
92 SkYUVColorSpace colorSpace) 92 SkYUVColorSpace colorSpace)
93 : fCoordTransform(kLocal_GrCoordSet, 93 : fCoordTransform(kLocal_GrCoordSet,
94 GrCoordTransform::MakeDivByTextureWHMatrix(yTexture), 94 GrCoordTransform::MakeDivByTextureWHMatrix(yTexture),
95 yTexture, GrTextureParams::kNone_FilterMode) 95 yTexture, GrTextureParams::kNone_FilterMode)
96 , fYAccess(yTexture) 96 , fYAccess(yTexture)
97 , fUAccess(uTexture) 97 , fUAccess(uTexture)
98 , fVAccess(vTexture) 98 , fVAccess(vTexture)
99 , fColorSpace(colorSpace) { 99 , fColorSpace(colorSpace) {
100 this->initClassID<YUVtoRGBEffect>(); 100 this->initClassID<YUVtoRGBEffect>();
101 this->addCoordTransform(&fCoordTransform); 101 this->addCoordTransform(&fCoordTransform);
102 this->addTextureAccess(&fYAccess); 102 this->addTextureAccess(&fYAccess);
103 this->addTextureAccess(&fUAccess); 103 this->addTextureAccess(&fUAccess);
104 this->addTextureAccess(&fVAccess); 104 this->addTextureAccess(&fVAccess);
105 } 105 }
106 106
107 virtual bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE { 107 bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE {
108 const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>(); 108 const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>();
109 return fColorSpace == s.getColorSpace(); 109 return fColorSpace == s.getColorSpace();
110 } 110 }
111 111
112 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE { 112 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE {
113 // YUV is opaque 113 // YUV is opaque
114 inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A, 114 inout->setToOther(kA_GrColorComponentFlag, 0xFF << GrColor_SHIFT_A,
115 GrInvariantOutput::kWillNot_ReadInput); 115 GrInvariantOutput::kWillNot_ReadInput);
116 } 116 }
117 117
118 GrCoordTransform fCoordTransform; 118 GrCoordTransform fCoordTransform;
119 GrTextureAccess fYAccess; 119 GrTextureAccess fYAccess;
120 GrTextureAccess fUAccess; 120 GrTextureAccess fUAccess;
121 GrTextureAccess fVAccess; 121 GrTextureAccess fVAccess;
122 SkYUVColorSpace fColorSpace; 122 SkYUVColorSpace fColorSpace;
(...skipping 13 matching lines...) Expand all
136 0.0f, 0.0f, 0.0f, 1.0}; 136 0.0f, 0.0f, 0.0f, 1.0};
137 } 137 }
138 138
139 ////////////////////////////////////////////////////////////////////////////// 139 //////////////////////////////////////////////////////////////////////////////
140 140
141 GrFragmentProcessor* 141 GrFragmentProcessor*
142 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT exture, 142 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT exture,
143 SkYUVColorSpace colorSpace) { 143 SkYUVColorSpace colorSpace) {
144 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace); 144 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace);
145 } 145 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureDomain.cpp ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698