Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: samplecode/SampleTextureDomain.cpp

Issue 1235393003: guard to remove DrawBitmapRectFlags (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 virtual void onDrawContent(SkCanvas* canvas) { 46 virtual void onDrawContent(SkCanvas* canvas) {
47 SkRect srcRect; 47 SkRect srcRect;
48 SkRect dstRect; 48 SkRect dstRect;
49 SkPaint paint; 49 SkPaint paint;
50 paint.setFilterQuality(kLow_SkFilterQuality); 50 paint.setFilterQuality(kLow_SkFilterQuality);
51 51
52 // Test that bitmap draws from malloc-backed bitmaps respect 52 // Test that bitmap draws from malloc-backed bitmaps respect
53 // the constrained texture domain. 53 // the constrained texture domain.
54 srcRect.setXYWH(1, 1, 3, 3); 54 srcRect.setXYWH(1, 1, 3, 3);
55 dstRect.setXYWH(5, 5, 305, 305); 55 dstRect.setXYWH(5, 5, 305, 305);
56 canvas->drawBitmapRectToRect(fBM, &srcRect, dstRect, &paint); 56 canvas->drawBitmapRect(fBM, &srcRect, dstRect, &paint);
57 57
58 // Test that bitmap draws across separate devices also respect 58 // Test that bitmap draws across separate devices also respect
59 // the constrainted texture domain. 59 // the constrainted texture domain.
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()->drawBitmapRectToRect(fBM, &srcRect, dstRect, 67 surface->getCanvas()->drawBitmapRect(fBM, &srcRect, dstRect, &paint);
68 &paint);
69 68
70 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); 69 SkAutoTUnref<SkImage> image(surface->newImageSnapshot());
71 70
72 srcRect.setXYWH(1, 1, 3, 3); 71 srcRect.setXYWH(1, 1, 3, 3);
73 dstRect.setXYWH(405, 5, 305, 305); 72 dstRect.setXYWH(405, 5, 305, 305);
74 canvas->drawImageRect(image, &srcRect, dstRect, &paint); 73 canvas->drawImageRect(image, &srcRect, dstRect, &paint);
75 74
76 // Test that bitmap blurring using a subrect 75 // Test that bitmap blurring using a subrect
77 // renders correctly 76 // renders correctly
78 srcRect.setXYWH(1, 1, 3, 3); 77 srcRect.setXYWH(1, 1, 3, 3);
(...skipping 12 matching lines...) Expand all
91 // that handles blurs with rects transformed to non- 90 // that handles blurs with rects transformed to non-
92 // orthogonal rects. It also tests the NULL src rect handling 91 // orthogonal rects. It also tests the NULL src rect handling
93 mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, 92 mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
94 SkBlurMask::ConvertRadiusToSigma(5), 93 SkBlurMask::ConvertRadiusToSigma(5),
95 SkBlurMaskFilter::kHighQuality_BlurFlag); 94 SkBlurMaskFilter::kHighQuality_BlurFlag);
96 paint.setMaskFilter(mf)->unref(); 95 paint.setMaskFilter(mf)->unref();
97 96
98 dstRect.setXYWH(-150, -150, 300, 300); 97 dstRect.setXYWH(-150, -150, 300, 300);
99 canvas->translate(550, 550); 98 canvas->translate(550, 550);
100 canvas->rotate(45); 99 canvas->rotate(45);
101 canvas->drawBitmapRectToRect(fBM, NULL, dstRect, &paint); 100 canvas->drawBitmapRect(fBM, dstRect, &paint);
102 } 101 }
103 private: 102 private:
104 typedef SkView INHERITED; 103 typedef SkView INHERITED;
105 }; 104 };
106 105
107 ////////////////////////////////////////////////////////////////////////////// 106 //////////////////////////////////////////////////////////////////////////////
108 107
109 static SkView* MyFactory() { return new TextureDomainView; } 108 static SkView* MyFactory() { return new TextureDomainView; }
110 static SkViewRegister reg(MyFactory); 109 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698