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

Unified Diff: src/gpu/GrProcessor.cpp

Issue 1350523004: Move GrFragmentProcessor implementation to its own cpp file (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: whitespace Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrFragmentProcessor.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrProcessor.cpp
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index e6be1da33a6e43159e636201a4770122186e6dd6..1db9d76fda34bd0006fa4d866ae1de83bfeb2eb5 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -7,13 +7,11 @@
#include "GrProcessor.h"
#include "GrContext.h"
-#include "GrCoordTransform.h"
#include "GrGeometryProcessor.h"
#include "GrInvariantOutput.h"
#include "GrMemoryPool.h"
#include "GrXferProcessor.h"
#include "SkSpinlock.h"
-#include "gl/GrGLFragmentProcessor.h"
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
@@ -130,126 +128,6 @@ bool GrProcessor::hasSameTextureAccesses(const GrProcessor& that) const {
///////////////////////////////////////////////////////////////////////////////////////////////////
-GrFragmentProcessor::~GrFragmentProcessor() {
- // If we got here then our ref count must have reached zero, so we will have converted refs
- // to pending executions for all children.
- for (int i = 0; i < fChildProcessors.count(); ++i) {
- fChildProcessors[i]->completedExecution();
- }
-}
-
-bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that,
- bool ignoreCoordTransforms) const {
- if (this->classID() != that.classID() ||
- !this->hasSameTextureAccesses(that)) {
- return false;
- }
- if (ignoreCoordTransforms) {
- if (this->numTransforms() != that.numTransforms()) {
- return false;
- }
- } else if (!this->hasSameTransforms(that)) {
- return false;
- }
- if (!this->onIsEqual(that)) {
- return false;
- }
- if (this->numChildProcessors() != that.numChildProcessors()) {
- return false;
- }
- for (int i = 0; i < this->numChildProcessors(); ++i) {
- if (!this->childProcessor(i).isEqual(that.childProcessor(i), ignoreCoordTransforms)) {
- return false;
- }
- }
- return true;
-}
-
-GrGLFragmentProcessor* GrFragmentProcessor::createGLInstance() const {
- GrGLFragmentProcessor* glFragProc = this->onCreateGLInstance();
- glFragProc->fChildProcessors.push_back_n(fChildProcessors.count());
- for (int i = 0; i < fChildProcessors.count(); ++i) {
- glFragProc->fChildProcessors[i] = fChildProcessors[i]->createGLInstance();
- }
- return glFragProc;
-}
-
-void GrFragmentProcessor::addTextureAccess(const GrTextureAccess* textureAccess) {
- // Can't add texture accesses after registering any children since their texture accesses have
- // already been bubbled up into our fTextureAccesses array
- SkASSERT(fChildProcessors.empty());
-
- INHERITED::addTextureAccess(textureAccess);
- fNumTexturesExclChildren++;
-}
-
-void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) {
- // Can't add transforms after registering any children since their transforms have already been
- // bubbled up into our fCoordTransforms array
- SkASSERT(fChildProcessors.empty());
-
- fCoordTransforms.push_back(transform);
- fUsesLocalCoords = fUsesLocalCoords || transform->sourceCoords() == kLocal_GrCoordSet;
- SkDEBUGCODE(transform->setInProcessor();)
- fNumTransformsExclChildren++;
-}
-
-int GrFragmentProcessor::registerChildProcessor(const GrFragmentProcessor* child) {
- // Append the child's transforms to our transforms array and the child's textures array to our
- // textures array
- if (!child->fCoordTransforms.empty()) {
- fCoordTransforms.push_back_n(child->fCoordTransforms.count(),
- child->fCoordTransforms.begin());
- }
- if (!child->fTextureAccesses.empty()) {
- fTextureAccesses.push_back_n(child->fTextureAccesses.count(),
- child->fTextureAccesses.begin());
- }
-
- int index = fChildProcessors.count();
- fChildProcessors.push_back(SkRef(child));
-
- if (child->willReadFragmentPosition()) {
- this->setWillReadFragmentPosition();
- }
-
- if (child->usesLocalCoords()) {
- fUsesLocalCoords = true;
- }
-
- return index;
-}
-
-void GrFragmentProcessor::notifyRefCntIsZero() const {
- // See comment above GrProgramElement for a detailed explanation of why we do this.
- for (int i = 0; i < fChildProcessors.count(); ++i) {
- fChildProcessors[i]->addPendingExecution();
- fChildProcessors[i]->unref();
- }
-}
-
-bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) const {
- if (this->numTransforms() != that.numTransforms()) {
- return false;
- }
- int count = this->numTransforms();
- for (int i = 0; i < count; ++i) {
- if (this->coordTransform(i) != that.coordTransform(i)) {
- return false;
- }
- }
- return true;
-}
-
-#include "effects/GrXfermodeFragmentProcessor.h"
-
-const GrFragmentProcessor* GrFragmentProcessor::MulOuputByInputAlpha(
- const GrFragmentProcessor* fp) {
- return GrXfermodeFragmentProcessor::CreateFromDstProcessor(fp, SkXfermode::kDstIn_Mode);
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
// Initial static variable from GrXPFactory
int32_t GrXPFactory::gCurrXPFClassID =
GrXPFactory::kIllegalXPFClassID;
« no previous file with comments | « src/gpu/GrFragmentProcessor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698