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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrCustomXfermodePriv.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 2015 Google Inc. 2 * Copyright 2015 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 "effects/GrCustomXfermode.h" 8 #include "effects/GrCustomXfermode.h"
9 9
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 return true; 69 return true;
70 } 70 }
71 71
72 /////////////////////////////////////////////////////////////////////////////// 72 ///////////////////////////////////////////////////////////////////////////////
73 // Xfer Processor 73 // Xfer Processor
74 /////////////////////////////////////////////////////////////////////////////// 74 ///////////////////////////////////////////////////////////////////////////////
75 75
76 class CustomXP : public GrXferProcessor { 76 class CustomXP : public GrXferProcessor {
77 public: 77 public:
78 CustomXP(SkXfermode::Mode mode, GrBlendEquation hwBlendEquation) 78 CustomXP(SkXfermode::Mode mode, GrBlendEquation hwBlendEquation, GrRenderTar get* dst)
79 : fMode(mode), 79 : INHERITED(dst), fMode(mode),
80 fHWBlendEquation(hwBlendEquation) { 80 fHWBlendEquation(hwBlendEquation) {
81 this->initClassID<CustomXP>(); 81 this->initClassID<CustomXP>();
82 } 82 }
83 83
84 CustomXP(const DstTexture* dstTexture, bool hasMixedSamples, SkXfermode::Mod e mode) 84 CustomXP(const DstTexture* dstTexture, bool hasMixedSamples, SkXfermode::Mod e mode, GrRenderTarget* dst)
85 : INHERITED(dstTexture, true, hasMixedSamples), 85 : INHERITED(dstTexture, true, hasMixedSamples, dst),
86 fMode(mode), 86 fMode(mode),
87 fHWBlendEquation(static_cast<GrBlendEquation>(-1)) { 87 fHWBlendEquation(static_cast<GrBlendEquation>(-1)) {
88 this->initClassID<CustomXP>(); 88 this->initClassID<CustomXP>();
89 } 89 }
90 90
91 const char* name() const override { return "Custom Xfermode"; } 91 const char* name() const override { return "Custom Xfermode"; }
92 92
93 GrGLXferProcessor* createGLInstance() const override; 93 GrGLXferProcessor* createGLInstance() const override;
94 94
95 SkXfermode::Mode mode() const { return fMode; } 95 SkXfermode::Mode mode() const { return fMode; }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 325 }
326 326
327 void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, 327 void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
328 GrXPFactory::InvariantBlendedColor*) const ove rride; 328 GrXPFactory::InvariantBlendedColor*) const ove rride;
329 329
330 private: 330 private:
331 GrXferProcessor* onCreateXferProcessor(const GrCaps& caps, 331 GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
332 const GrProcOptInfo& colorPOI, 332 const GrProcOptInfo& colorPOI,
333 const GrProcOptInfo& coveragePOI, 333 const GrProcOptInfo& coveragePOI,
334 bool hasMixedSamples, 334 bool hasMixedSamples,
335 const DstTexture*) const override; 335 const DstTexture*,
336 GrRenderTarget* dst) const override;
336 337
337 bool willReadDstColor(const GrCaps& caps, 338 bool willReadDstColor(const GrCaps& caps,
338 const GrProcOptInfo& colorPOI, 339 const GrProcOptInfo& colorPOI,
339 const GrProcOptInfo& coveragePOI, 340 const GrProcOptInfo& coveragePOI,
340 bool hasMixedSamples) const override; 341 bool hasMixedSamples) const override;
341 342
342 bool onIsEqual(const GrXPFactory& xpfBase) const override { 343 bool onIsEqual(const GrXPFactory& xpfBase) const override {
343 const CustomXPFactory& xpf = xpfBase.cast<CustomXPFactory>(); 344 const CustomXPFactory& xpf = xpfBase.cast<CustomXPFactory>();
344 return fMode == xpf.fMode; 345 return fMode == xpf.fMode;
345 } 346 }
(...skipping 10 matching lines...) Expand all
356 : fMode(mode), 357 : fMode(mode),
357 fHWBlendEquation(hw_blend_equation(mode)) { 358 fHWBlendEquation(hw_blend_equation(mode)) {
358 SkASSERT(GrCustomXfermode::IsSupportedMode(fMode)); 359 SkASSERT(GrCustomXfermode::IsSupportedMode(fMode));
359 this->initClassID<CustomXPFactory>(); 360 this->initClassID<CustomXPFactory>();
360 } 361 }
361 362
362 GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps, 363 GrXferProcessor* CustomXPFactory::onCreateXferProcessor(const GrCaps& caps,
363 const GrProcOptInfo& col orPOI, 364 const GrProcOptInfo& col orPOI,
364 const GrProcOptInfo& cov eragePOI, 365 const GrProcOptInfo& cov eragePOI,
365 bool hasMixedSamples, 366 bool hasMixedSamples,
366 const DstTexture* dstTex ture) const { 367 const DstTexture* dstTex ture, GrRenderTarget* dst) const {
367 if (can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps)) { 368 if (can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps)) {
368 SkASSERT(!dstTexture || !dstTexture->texture()); 369 SkASSERT(!dstTexture || !dstTexture->texture());
369 return new CustomXP(fMode, fHWBlendEquation); 370 return new CustomXP(fMode, fHWBlendEquation, dst);
370 } 371 }
371 return new CustomXP(dstTexture, hasMixedSamples, fMode); 372 return new CustomXP(dstTexture, hasMixedSamples, fMode, dst);
372 } 373 }
373 374
374 bool CustomXPFactory::willReadDstColor(const GrCaps& caps, 375 bool CustomXPFactory::willReadDstColor(const GrCaps& caps,
375 const GrProcOptInfo& colorPOI, 376 const GrProcOptInfo& colorPOI,
376 const GrProcOptInfo& coveragePOI, 377 const GrProcOptInfo& coveragePOI,
377 bool hasMixedSamples) const { 378 bool hasMixedSamples) const {
378 return !can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps); 379 return !can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps);
379 } 380 }
380 381
381 void CustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI, 382 void CustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
(...skipping 12 matching lines...) Expand all
394 395
395 /////////////////////////////////////////////////////////////////////////////// 396 ///////////////////////////////////////////////////////////////////////////////
396 397
397 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) { 398 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) {
398 if (!GrCustomXfermode::IsSupportedMode(mode)) { 399 if (!GrCustomXfermode::IsSupportedMode(mode)) {
399 return nullptr; 400 return nullptr;
400 } else { 401 } else {
401 return new CustomXPFactory(mode); 402 return new CustomXPFactory(mode);
402 } 403 }
403 } 404 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrCustomXfermodePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698