aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-09-11 13:29:29 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-09-11 13:29:29 +0000
commit047696c1c67b2e0a73f2b951ce23ff5b155111bb (patch)
treedbed322bec2161e4f998e2b89a308eb7f08dc3ba
parent7fa18762e0ab64c3473df3aab0c2bfd6fabd8831 (diff)
Move GrTextureAccess decl/defn to separate files
Review URL: https://codereview.appspot.com/6500104/ git-svn-id: http://skia.googlecode.com/svn/trunk@5482 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gyp/gpu.gypi2
-rw-r--r--include/gpu/GrCustomStage.h21
-rw-r--r--include/gpu/GrTextureAccess.h36
-rw-r--r--src/gpu/GrCustomStage.cpp12
-rw-r--r--src/gpu/GrTextureAccess.cpp21
5 files changed, 60 insertions, 32 deletions
diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi
index cdaa7e725f..b9ea73928b 100644
--- a/gyp/gpu.gypi
+++ b/gyp/gpu.gypi
@@ -35,6 +35,7 @@
'<(skia_include_path)/gpu/GrSurface.h',
'<(skia_include_path)/gpu/GrTextContext.h',
'<(skia_include_path)/gpu/GrTexture.h',
+ '<(skia_include_path)/gpu/GrTextureAccess.h',
'<(skia_include_path)/gpu/GrTypes.h',
'<(skia_include_path)/gpu/GrUserConfig.h',
@@ -118,6 +119,7 @@
'<(skia_src_path)/gpu/GrTextStrike.h',
'<(skia_src_path)/gpu/GrTextStrike_impl.h',
'<(skia_src_path)/gpu/GrTexture.cpp',
+ '<(skia_src_path)/gpu/GrTextureAccess.cpp',
'<(skia_src_path)/gpu/GrTHashCache.h',
'<(skia_src_path)/gpu/GrTLList.h',
'<(skia_src_path)/gpu/GrVertexBuffer.h',
diff --git a/include/gpu/GrCustomStage.h b/include/gpu/GrCustomStage.h
index fd5d7e00dc..32d40b47d7 100644
--- a/include/gpu/GrCustomStage.h
+++ b/include/gpu/GrCustomStage.h
@@ -12,31 +12,12 @@
#include "GrNoncopyable.h"
#include "GrProgramStageFactory.h"
#include "GrCustomStageUnitTest.h"
+#include "GrTextureAccess.h"
class GrContext;
class GrTexture;
class SkString;
-/** A class representing the swizzle access pattern for a texture.
- */
-class GrTextureAccess {
-public:
- typedef char Swizzle[4];
-
- GrTextureAccess(const GrTexture* texture, const SkString& swizzle);
-
- const GrTexture* getTexture() const { return fTexture; }
- const Swizzle& getSwizzle() const { return fSwizzle; }
-
- bool referencesAlpha() const {
- return fSwizzle[0] == 'a' || fSwizzle[1] == 'a' || fSwizzle[2] == 'a' || fSwizzle[3] == 'a';
- }
-
-private:
- const GrTexture* fTexture;
- Swizzle fSwizzle;
-};
-
/** Provides custom vertex shader, fragment shader, uniform data for a
particular stage of the Ganesh shading pipeline.
Subclasses must have a function that produces a human-readable name:
diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h
new file mode 100644
index 0000000000..55c0a02b87
--- /dev/null
+++ b/include/gpu/GrTextureAccess.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrTextureAccess_DEFINED
+#define GrTextureAccess_DEFINED
+
+#include "GrTypes.h"
+
+class GrTexture;
+class SkString;
+
+/** A class representing the swizzle access pattern for a texture.
+ */
+class GrTextureAccess {
+public:
+ typedef char Swizzle[4];
+
+ GrTextureAccess(const GrTexture* texture, const SkString& swizzle);
+
+ const GrTexture* getTexture() const { return fTexture; }
+ const Swizzle& getSwizzle() const { return fSwizzle; }
+
+ bool referencesAlpha() const {
+ return fSwizzle[0] == 'a' || fSwizzle[1] == 'a' || fSwizzle[2] == 'a' || fSwizzle[3] == 'a';
+ }
+
+private:
+ const GrTexture* fTexture;
+ Swizzle fSwizzle;
+};
+
+#endif
diff --git a/src/gpu/GrCustomStage.cpp b/src/gpu/GrCustomStage.cpp
index 6d7bfad272..7b3bc617e0 100644
--- a/src/gpu/GrCustomStage.cpp
+++ b/src/gpu/GrCustomStage.cpp
@@ -8,7 +8,6 @@
#include "GrContext.h"
#include "GrCustomStage.h"
#include "GrMemoryPool.h"
-#include "SkString.h"
#include "SkTLS.h"
SK_DEFINE_INST_COUNT(GrCustomStage)
@@ -39,17 +38,6 @@ private:
int32_t GrProgramStageFactory::fCurrStageClassID =
GrProgramStageFactory::kIllegalStageClassID;
-GrTextureAccess::GrTextureAccess(const GrTexture* texture, const SkString& swizzle)
- : fTexture(texture) {
- GrAssert(swizzle.size() <= 4);
- for (unsigned int offset = 0; offset < swizzle.size(); ++offset) {
- fSwizzle[offset] = swizzle[offset];
- }
- if (swizzle.size() < 4) {
- fSwizzle[swizzle.size()] = 0;
- }
-}
-
GrCustomStage::GrCustomStage() {
}
diff --git a/src/gpu/GrTextureAccess.cpp b/src/gpu/GrTextureAccess.cpp
new file mode 100644
index 0000000000..155f682827
--- /dev/null
+++ b/src/gpu/GrTextureAccess.cpp
@@ -0,0 +1,21 @@
+/*
+ * 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 "GrTextureAccess.h"
+#include "SkString.h"
+
+GrTextureAccess::GrTextureAccess(const GrTexture* texture, const SkString& swizzle)
+ : fTexture(texture) {
+ GrAssert(swizzle.size() <= 4);
+ for (unsigned int offset = 0; offset < swizzle.size(); ++offset) {
+ fSwizzle[offset] = swizzle[offset];
+ }
+ if (swizzle.size() < 4) {
+ fSwizzle[swizzle.size()] = 0;
+ }
+}
+