OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Note: GPU-backed bitmaps follow a different rendering path | 60 // Note: GPU-backed bitmaps follow a different rendering path |
61 // when copying from one GPU device to another. | 61 // when copying from one GPU device to another. |
62 SkImageInfo info = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType); | 62 SkImageInfo info = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType); |
63 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); | 63 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); |
64 | 64 |
65 srcRect.setXYWH(1, 1, 3, 3); | 65 srcRect.setXYWH(1, 1, 3, 3); |
66 dstRect.setXYWH(1, 1, 3, 3); | 66 dstRect.setXYWH(1, 1, 3, 3); |
67 surface->getCanvas()->drawBitmapRect(fBM, srcRect, dstRect, &paint, | 67 surface->getCanvas()->drawBitmapRect(fBM, srcRect, dstRect, &paint, |
68 SkCanvas::kStrict_SrcRectConstraint
); | 68 SkCanvas::kStrict_SrcRectConstraint
); |
69 | 69 |
70 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); | 70 sk_sp<SkImage> image(surface->makeImageSnapshot()); |
71 | 71 |
72 srcRect.setXYWH(1, 1, 3, 3); | 72 srcRect.setXYWH(1, 1, 3, 3); |
73 dstRect.setXYWH(405, 5, 305, 305); | 73 dstRect.setXYWH(405, 5, 305, 305); |
74 canvas->drawImageRect(image, srcRect, dstRect, &paint); | 74 canvas->drawImageRect(image, srcRect, dstRect, &paint); |
75 | 75 |
76 // Test that bitmap blurring using a subrect | 76 // Test that bitmap blurring using a subrect |
77 // renders correctly | 77 // renders correctly |
78 srcRect.setXYWH(1, 1, 3, 3); | 78 srcRect.setXYWH(1, 1, 3, 3); |
79 dstRect.setXYWH(5, 405, 305, 305); | 79 dstRect.setXYWH(5, 405, 305, 305); |
80 SkMaskFilter* mf = SkBlurMaskFilter::Create( | 80 SkMaskFilter* mf = SkBlurMaskFilter::Create( |
(...skipping 20 matching lines...) Expand all Loading... |
101 canvas->drawBitmapRect(fBM, dstRect, &paint); | 101 canvas->drawBitmapRect(fBM, dstRect, &paint); |
102 } | 102 } |
103 private: | 103 private: |
104 typedef SkView INHERITED; | 104 typedef SkView INHERITED; |
105 }; | 105 }; |
106 | 106 |
107 ////////////////////////////////////////////////////////////////////////////// | 107 ////////////////////////////////////////////////////////////////////////////// |
108 | 108 |
109 static SkView* MyFactory() { return new TextureDomainView; } | 109 static SkView* MyFactory() { return new TextureDomainView; } |
110 static SkViewRegister reg(MyFactory); | 110 static SkViewRegister reg(MyFactory); |
OLD | NEW |