GrTextureAccess.cpp revision 047696c1c67b2e0a73f2b951ce23ff5b155111bb
1/*
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#include "GrTextureAccess.h"
9#include "SkString.h"
10
11GrTextureAccess::GrTextureAccess(const GrTexture* texture, const SkString& swizzle)
12    : fTexture(texture) {
13    GrAssert(swizzle.size() <= 4);
14    for (unsigned int offset = 0; offset < swizzle.size(); ++offset) {
15        fSwizzle[offset] = swizzle[offset];
16    }
17    if (swizzle.size() < 4) {
18      fSwizzle[swizzle.size()] = 0;
19    }
20}
21
22