| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 // This test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 SkScalar y = kDrawPad + kTestPad; | 101 SkScalar y = kDrawPad + kTestPad; |
| 102 SkScalar x = kDrawPad + kTestPad; | 102 SkScalar x = kDrawPad + kTestPad; |
| 103 | 103 |
| 104 const int indices[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {
2, 0, 1}, {2, 1, 0}}; | 104 const int indices[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {
2, 0, 1}, {2, 1, 0}}; |
| 105 | 105 |
| 106 for (int i = 0; i < 6; ++i) { | 106 for (int i = 0; i < 6; ++i) { |
| 107 SkAutoTUnref<GrEffect> effect( | 107 SkAutoTUnref<GrEffect> effect( |
| 108 GrYUVtoRGBEffect::Create(texture[indices[i][0]], | 108 GrYUVtoRGBEffect::Create(texture[indices[i][0]], |
| 109 texture[indices[i][1]], | 109 texture[indices[i][1]], |
| 110 texture[indices[i][2]])); | 110 texture[indices[i][2]], |
| 111 GrYUVtoRGBEffect::kJPEG)); |
| 111 if (effect) { | 112 if (effect) { |
| 112 SkMatrix viewMatrix; | 113 SkMatrix viewMatrix; |
| 113 viewMatrix.setTranslate(x, y); | 114 viewMatrix.setTranslate(x, y); |
| 114 drawState->reset(viewMatrix); | 115 drawState->reset(viewMatrix); |
| 115 drawState->setRenderTarget(rt); | 116 drawState->setRenderTarget(rt); |
| 116 drawState->setColor(0xffffffff); | 117 drawState->setColor(0xffffffff); |
| 117 drawState->addColorEffect(effect, 1); | 118 drawState->addColorEffect(effect, 1); |
| 118 tt.target()->drawSimpleRect(renderRect); | 119 tt.target()->drawSimpleRect(renderRect); |
| 119 } | 120 } |
| 120 x += renderRect.width() + kTestPad; | 121 x += renderRect.width() + kTestPad; |
| 121 } | 122 } |
| 122 | 123 |
| 123 GrUnlockAndUnrefCachedBitmapTexture(texture[0]); | 124 GrUnlockAndUnrefCachedBitmapTexture(texture[0]); |
| 124 GrUnlockAndUnrefCachedBitmapTexture(texture[1]); | 125 GrUnlockAndUnrefCachedBitmapTexture(texture[1]); |
| 125 GrUnlockAndUnrefCachedBitmapTexture(texture[2]); | 126 GrUnlockAndUnrefCachedBitmapTexture(texture[2]); |
| 126 } | 127 } |
| 127 | 128 |
| 128 private: | 129 private: |
| 129 SkBitmap fBmp[3]; | 130 SkBitmap fBmp[3]; |
| 130 | 131 |
| 131 typedef GM INHERITED; | 132 typedef GM INHERITED; |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 DEF_GM( return SkNEW(YUVtoRGBEffect); ) | 135 DEF_GM( return SkNEW(YUVtoRGBEffect); ) |
| 135 } | 136 } |
| 136 | 137 |
| 137 #endif | 138 #endif |
| OLD | NEW |