| bsalomon@google.com | 047696c | 2012-09-11 13:29:29 +0000 | [diff] [blame^] | 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 | |
| 11 | GrTextureAccess::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 | |