| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 srcRect.setXYWH(1, 1, 3, 3); | 74 srcRect.setXYWH(1, 1, 3, 3); |
| 75 dstRect.setXYWH(405.0f, 5.0f, 305.0f, 305.0f); | 75 dstRect.setXYWH(405.0f, 5.0f, 305.0f, 305.0f); |
| 76 canvas->drawBitmapRect(deviceBitmap, &srcRect, dstRect, &paint); | 76 canvas->drawBitmapRect(deviceBitmap, &srcRect, dstRect, &paint); |
| 77 | 77 |
| 78 // Test that bitmap blurring using a subrect | 78 // Test that bitmap blurring using a subrect |
| 79 // renders correctly | 79 // renders correctly |
| 80 srcRect.setXYWH(1, 1, 3, 3); | 80 srcRect.setXYWH(1, 1, 3, 3); |
| 81 dstRect.setXYWH(5.0f, 405.0f, 305.0f, 305.0f); | 81 dstRect.setXYWH(5.0f, 405.0f, 305.0f, 305.0f); |
| 82 SkMaskFilter* mf = SkBlurMaskFilter::Create( | 82 SkMaskFilter* mf = SkBlurMaskFilter::Create( |
| 83 5, | |
| 84 SkBlurMaskFilter::kNormal_BlurStyle, | 83 SkBlurMaskFilter::kNormal_BlurStyle, |
| 84 SkFloatToScalar(3.38675f), |
| 85 SkBlurMaskFilter::kHighQuality_BlurFlag | | 85 SkBlurMaskFilter::kHighQuality_BlurFlag | |
| 86 SkBlurMaskFilter::kIgnoreTransform_BlurFlag); | 86 SkBlurMaskFilter::kIgnoreTransform_BlurFlag); |
| 87 paint.setMaskFilter(mf)->unref(); | 87 paint.setMaskFilter(mf)->unref(); |
| 88 canvas->drawBitmapRect(deviceBitmap, &srcRect, dstRect, &paint); | 88 canvas->drawBitmapRect(deviceBitmap, &srcRect, dstRect, &paint); |
| 89 | 89 |
| 90 // Blur and a rotation + NULL src rect | 90 // Blur and a rotation + NULL src rect |
| 91 // This should not trigger the texture domain code | 91 // This should not trigger the texture domain code |
| 92 // but it will test a code path in SkGpuDevice::drawBitmap | 92 // but it will test a code path in SkGpuDevice::drawBitmap |
| 93 // that handles blurs with rects transformed to non- | 93 // that handles blurs with rects transformed to non- |
| 94 // orthogonal rects. It also tests the NULL src rect handling | 94 // orthogonal rects. It also tests the NULL src rect handling |
| 95 mf = SkBlurMaskFilter::Create( | 95 mf = SkBlurMaskFilter::Create( |
| 96 5, | |
| 97 SkBlurMaskFilter::kNormal_BlurStyle, | 96 SkBlurMaskFilter::kNormal_BlurStyle, |
| 97 SkFloatToScalar(3.38675f), |
| 98 SkBlurMaskFilter::kHighQuality_BlurFlag); | 98 SkBlurMaskFilter::kHighQuality_BlurFlag); |
| 99 paint.setMaskFilter(mf)->unref(); | 99 paint.setMaskFilter(mf)->unref(); |
| 100 | 100 |
| 101 dstRect.setXYWH(-150.0f, -150.0f, 300.0f, 300.0f); | 101 dstRect.setXYWH(-150.0f, -150.0f, 300.0f, 300.0f); |
| 102 canvas->translate(550, 550); | 102 canvas->translate(550, 550); |
| 103 canvas->rotate(45); | 103 canvas->rotate(45); |
| 104 canvas->drawBitmapRect(fBM, NULL, dstRect, &paint); | 104 canvas->drawBitmapRect(fBM, NULL, dstRect, &paint); |
| 105 } | 105 } |
| 106 private: | 106 private: |
| 107 typedef SkView INHERITED; | 107 typedef SkView INHERITED; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 ////////////////////////////////////////////////////////////////////////////// | 110 ////////////////////////////////////////////////////////////////////////////// |
| 111 | 111 |
| 112 static SkView* MyFactory() { return new TextureDomainView; } | 112 static SkView* MyFactory() { return new TextureDomainView; } |
| 113 static SkViewRegister reg(MyFactory); | 113 static SkViewRegister reg(MyFactory); |
| OLD | NEW |