| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 GrTestTarget tt; | 86 GrTestTarget tt; |
| 87 context->getTestTarget(&tt); | 87 context->getTestTarget(&tt); |
| 88 if (NULL == tt.target()) { | 88 if (NULL == tt.target()) { |
| 89 SkDEBUGFAIL("Couldn't get Gr test target."); | 89 SkDEBUGFAIL("Couldn't get Gr test target."); |
| 90 return; | 90 return; |
| 91 } | 91 } |
| 92 | 92 |
| 93 GrDrawState* drawState = tt.target()->drawState(); | 93 GrDrawState* drawState = tt.target()->drawState(); |
| 94 | 94 |
| 95 GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fBmp, NULL
); | 95 SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fBmp,
NULL)); |
| 96 if (NULL == texture) { | 96 if (!texture) { |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 SkTArray<SkMatrix> textureMatrices; | 100 SkTArray<SkMatrix> textureMatrices; |
| 101 textureMatrices.push_back().setIDiv(texture->width(), texture->height())
; | 101 textureMatrices.push_back().setIDiv(texture->width(), texture->height())
; |
| 102 textureMatrices.push_back() = textureMatrices[0]; | 102 textureMatrices.push_back() = textureMatrices[0]; |
| 103 textureMatrices.back().postScale(1.5f, 0.85f); | 103 textureMatrices.back().postScale(1.5f, 0.85f); |
| 104 textureMatrices.push_back() = textureMatrices[0]; | 104 textureMatrices.push_back() = textureMatrices[0]; |
| 105 textureMatrices.back().preRotate(45.f, texture->width() / 2.f, texture->
height() / 2.f); | 105 textureMatrices.back().preRotate(45.f, texture->width() / 2.f, texture->
height() / 2.f); |
| 106 | 106 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 137 drawState->setRenderTarget(rt); | 137 drawState->setRenderTarget(rt); |
| 138 drawState->setColor(0xffffffff); | 138 drawState->setColor(0xffffffff); |
| 139 drawState->addColorProcessor(fp); | 139 drawState->addColorProcessor(fp); |
| 140 | 140 |
| 141 tt.target()->drawSimpleRect(renderRect); | 141 tt.target()->drawSimpleRect(renderRect); |
| 142 x += renderRect.width() + kTestPad; | 142 x += renderRect.width() + kTestPad; |
| 143 } | 143 } |
| 144 y += renderRect.height() + kTestPad; | 144 y += renderRect.height() + kTestPad; |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 GrUnlockAndUnrefCachedBitmapTexture(texture); | |
| 148 } | 147 } |
| 149 | 148 |
| 150 private: | 149 private: |
| 151 static const SkScalar kDrawPad; | 150 static const SkScalar kDrawPad; |
| 152 static const SkScalar kTestPad; | 151 static const SkScalar kTestPad; |
| 153 static const int kTargetWidth = 100; | 152 static const int kTargetWidth = 100; |
| 154 static const int kTargetHeight = 100; | 153 static const int kTargetHeight = 100; |
| 155 SkBitmap fBmp; | 154 SkBitmap fBmp; |
| 156 | 155 |
| 157 typedef GM INHERITED; | 156 typedef GM INHERITED; |
| 158 }; | 157 }; |
| 159 | 158 |
| 160 // Windows builds did not like SkScalar initialization in class :( | 159 // Windows builds did not like SkScalar initialization in class :( |
| 161 const SkScalar TextureDomainEffect::kDrawPad = 10.f; | 160 const SkScalar TextureDomainEffect::kDrawPad = 10.f; |
| 162 const SkScalar TextureDomainEffect::kTestPad = 10.f; | 161 const SkScalar TextureDomainEffect::kTestPad = 10.f; |
| 163 | 162 |
| 164 DEF_GM( return SkNEW(TextureDomainEffect); ) | 163 DEF_GM( return SkNEW(TextureDomainEffect); ) |
| 165 } | 164 } |
| 166 | 165 |
| 167 #endif | 166 #endif |
| OLD | NEW |