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

Side by Side Diff: src/effects/SkColorCubeFilter.cpp

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanup Created 6 years, 1 month 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/effects/SkBlurMaskFilter.cpp ('k') | src/effects/SkColorFilters.cpp » ('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 "SkColorCubeFilter.h" 8 #include "SkColorCubeFilter.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkOnce.h" 10 #include "SkOnce.h"
11 #include "SkReadBuffer.h" 11 #include "SkReadBuffer.h"
12 #include "SkUnPreMultiply.h" 12 #include "SkUnPreMultiply.h"
13 #include "SkWriteBuffer.h" 13 #include "SkWriteBuffer.h"
14 #if SK_SUPPORT_GPU 14 #if SK_SUPPORT_GPU
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #include "GrCoordTransform.h" 16 #include "GrCoordTransform.h"
17 #include "GrInvariantOutput.h"
17 #include "gl/GrGLProcessor.h" 18 #include "gl/GrGLProcessor.h"
18 #include "gl/builders/GrGLProgramBuilder.h" 19 #include "gl/builders/GrGLProgramBuilder.h"
19 #include "GrTBackendProcessorFactory.h" 20 #include "GrTBackendProcessorFactory.h"
20 #include "GrTexturePriv.h" 21 #include "GrTexturePriv.h"
21 #include "SkGr.h" 22 #include "SkGr.h"
22 #endif 23 #endif
23 24
24 /////////////////////////////////////////////////////////////////////////////// 25 ///////////////////////////////////////////////////////////////////////////////
25 namespace { 26 namespace {
26 27
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 186 }
186 187
187 #ifndef SK_IGNORE_TO_STRING 188 #ifndef SK_IGNORE_TO_STRING
188 void SkColorCubeFilter::toString(SkString* str) const { 189 void SkColorCubeFilter::toString(SkString* str) const {
189 str->append("SkColorCubeFilter "); 190 str->append("SkColorCubeFilter ");
190 } 191 }
191 #endif 192 #endif
192 193
193 /////////////////////////////////////////////////////////////////////////////// 194 ///////////////////////////////////////////////////////////////////////////////
194 #if SK_SUPPORT_GPU 195 #if SK_SUPPORT_GPU
196
195 class GrColorCubeEffect : public GrFragmentProcessor { 197 class GrColorCubeEffect : public GrFragmentProcessor {
196 public: 198 public:
197 static GrFragmentProcessor* Create(GrTexture* colorCube) { 199 static GrFragmentProcessor* Create(GrTexture* colorCube) {
198 return (NULL != colorCube) ? SkNEW_ARGS(GrColorCubeEffect, (colorCube)) : NULL; 200 return (NULL != colorCube) ? SkNEW_ARGS(GrColorCubeEffect, (colorCube)) : NULL;
199 } 201 }
200 202
201 virtual ~GrColorCubeEffect(); 203 virtual ~GrColorCubeEffect();
202 204
203 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 205 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
204 int colorCubeSize() const { return fColorCubeAccess.getTexture()->width(); } 206 int colorCubeSize() const { return fColorCubeAccess.getTexture()->width(); }
205 207
206 static const char* Name() { return "ColorCube"; } 208 static const char* Name() { return "ColorCube"; }
207 209
208 virtual void onComputeInvariantOutput(GrProcessor::InvariantOutput*) const S K_OVERRIDE; 210 virtual void onComputeInvariantOutput(GrInvariantOutput*) const SK_OVERRIDE;
209 211
210 class GLProcessor : public GrGLFragmentProcessor { 212 class GLProcessor : public GrGLFragmentProcessor {
211 public: 213 public:
212 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor& ); 214 GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor& );
213 virtual ~GLProcessor(); 215 virtual ~GLProcessor();
214 216
215 virtual void emitCode(GrGLFPBuilder*, 217 virtual void emitCode(GrGLFPBuilder*,
216 const GrFragmentProcessor&, 218 const GrFragmentProcessor&,
217 const GrProcessorKey&, 219 const GrProcessorKey&,
218 const char* outputColor, 220 const char* outputColor,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 this->addTextureAccess(&fColorCubeAccess); 253 this->addTextureAccess(&fColorCubeAccess);
252 } 254 }
253 255
254 GrColorCubeEffect::~GrColorCubeEffect() { 256 GrColorCubeEffect::~GrColorCubeEffect() {
255 } 257 }
256 258
257 const GrBackendFragmentProcessorFactory& GrColorCubeEffect::getFactory() const { 259 const GrBackendFragmentProcessorFactory& GrColorCubeEffect::getFactory() const {
258 return GrTBackendFragmentProcessorFactory<GrColorCubeEffect>::getInstance(); 260 return GrTBackendFragmentProcessorFactory<GrColorCubeEffect>::getInstance();
259 } 261 }
260 262
261 void GrColorCubeEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 263 void GrColorCubeEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
262 inout->setToUnknown(InvariantOutput::kWill_ReadInput); 264 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
263 } 265 }
264 266
265 /////////////////////////////////////////////////////////////////////////////// 267 ///////////////////////////////////////////////////////////////////////////////
266 268
267 GrColorCubeEffect::GLProcessor::GLProcessor(const GrBackendProcessorFactory& fac tory, 269 GrColorCubeEffect::GLProcessor::GLProcessor(const GrBackendProcessorFactory& fac tory,
268 const GrProcessor&) 270 const GrProcessor&)
269 : INHERITED(factory) { 271 : INHERITED(factory) {
270 } 272 }
271 273
272 GrColorCubeEffect::GLProcessor::~GLProcessor() { 274 GrColorCubeEffect::GLProcessor::~GLProcessor() {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 SkAutoTUnref<GrTexture> textureCube; 363 SkAutoTUnref<GrTexture> textureCube;
362 if (surface) { 364 if (surface) {
363 textureCube.reset(surface->asTexture()); 365 textureCube.reset(surface->asTexture());
364 } else { 366 } else {
365 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData- >data(), 0)); 367 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData- >data(), 0));
366 } 368 }
367 369
368 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; 370 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL;
369 } 371 }
370 #endif 372 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/effects/SkColorFilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698