blob: 55c0a02b874b004c9867fdea3cd68941f2110647 [file] [log] [blame]
bsalomon@google.com047696c2012-09-11 13:29:29 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrTextureAccess_DEFINED
9#define GrTextureAccess_DEFINED
10
11#include "GrTypes.h"
12
13class GrTexture;
14class SkString;
15
16/** A class representing the swizzle access pattern for a texture.
17 */
18class GrTextureAccess {
19public:
20 typedef char Swizzle[4];
21
22 GrTextureAccess(const GrTexture* texture, const SkString& swizzle);
23
24 const GrTexture* getTexture() const { return fTexture; }
25 const Swizzle& getSwizzle() const { return fSwizzle; }
26
27 bool referencesAlpha() const {
28 return fSwizzle[0] == 'a' || fSwizzle[1] == 'a' || fSwizzle[2] == 'a' || fSwizzle[3] == 'a';
29 }
30
31private:
32 const GrTexture* fTexture;
33 Swizzle fSwizzle;
34};
35
36#endif