CustomStage Renaming Part 1
Search and replace:
GrCustomStage->GrEffect
GrCustomStageTestFactory->GrEffectTestFactory
renamed the cpp/h files from customStage->effect
reordered gypi, #includes, forward decls to maintain alphabetical sort.
manually fixed up some whitespace and linewraps
deleted a commented out #include
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6758046
git-svn-id: http://skia.googlecode.com/svn/trunk@6076 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrEffect.cpp b/src/gpu/GrEffect.cpp
new file mode 100644
index 0000000..7997fb0
--- /dev/null
+++ b/src/gpu/GrEffect.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrContext.h"
+#include "GrEffect.h"
+#include "GrMemoryPool.h"
+#include "SkTLS.h"
+
+SK_DEFINE_INST_COUNT(GrEffect)
+
+#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
+SkTArray<GrEffectTestFactory*, true>* GrEffectTestFactory::GetFactories() {
+ static SkTArray<GrEffectTestFactory*, true> gFactories;
+ return &gFactories;
+}
+#endif
+
+class GrCustomStage_Globals {
+public:
+ static GrMemoryPool* GetTLS() {
+ return (GrMemoryPool*)SkTLS::Get(CreateTLS, DeleteTLS);
+ }
+
+private:
+ static void* CreateTLS() {
+ return SkNEW_ARGS(GrMemoryPool, (4096, 4096));
+ }
+
+ static void DeleteTLS(void* pool) {
+ SkDELETE(reinterpret_cast<GrMemoryPool*>(pool));
+ }
+};
+
+int32_t GrProgramStageFactory::fCurrStageClassID =
+ GrProgramStageFactory::kIllegalStageClassID;
+
+GrEffect::GrEffect(int numTextures)
+ : fNumTextures(numTextures) {
+}
+
+GrEffect::~GrEffect() {
+
+}
+
+bool GrEffect::isOpaque(bool inputTextureIsOpaque) const {
+ return false;
+}
+
+bool GrEffect::isEqual(const GrEffect& s) const {
+ if (this->numTextures() != s.numTextures()) {
+ return false;
+ }
+ for (int i = 0; i < this->numTextures(); ++i) {
+ if (this->textureAccess(i) != s.textureAccess(i)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+const GrTextureAccess& GrEffect::textureAccess(int index) const {
+ GrCrash("We shouldn't be calling this function on the base class.");
+ static GrTextureAccess kDummy;
+ return kDummy;
+}
+
+void * GrEffect::operator new(size_t size) {
+ return GrCustomStage_Globals::GetTLS()->allocate(size);
+}
+
+void GrEffect::operator delete(void* target) {
+ GrCustomStage_Globals::GetTLS()->release(target);
+}