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

Side by Side Diff: gm/bitmaprect.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 /* 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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 canvas->translate(16, 40); 66 canvas->translate(16, 40);
67 for (size_t i = 0; i < SK_ARRAY_COUNT(src); i++) { 67 for (size_t i = 0; i < SK_ARRAY_COUNT(src); i++) {
68 SkRect srcR; 68 SkRect srcR;
69 srcR.set(src[i]); 69 srcR.set(src[i]);
70 70
71 canvas->drawBitmap(bitmap, 0, 0, &paint); 71 canvas->drawBitmap(bitmap, 0, 0, &paint);
72 if (!fUseIRect) { 72 if (!fUseIRect) {
73 canvas->drawBitmapRect(bitmap, &srcR, dstR, &paint, 73 canvas->drawBitmapRect(bitmap, &srcR, dstR, &paint,
74 SkCanvas::kStrict_SrcRectConstraint); 74 SkCanvas::kStrict_SrcRectConstraint);
75 } else { 75 } else {
76 canvas->drawBitmapRect(bitmap, &src[i], dstR, &paint); 76 canvas->drawBitmapRect(bitmap, src[i], dstR, &paint);
77 } 77 }
78 78
79 canvas->drawRect(dstR, paint); 79 canvas->drawRect(dstR, paint);
80 canvas->drawRect(srcR, paint); 80 canvas->drawRect(srcR, paint);
81 81
82 canvas->translate(160, 0); 82 canvas->translate(160, 0);
83 } 83 }
84 } 84 }
85 85
86 private: 86 private:
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 void onDraw(SkCanvas* canvas) override { 138 void onDraw(SkCanvas* canvas) override {
139 139
140 SkBitmap bitmap; 140 SkBitmap bitmap;
141 make_3x3_bitmap(&bitmap); 141 make_3x3_bitmap(&bitmap);
142 142
143 SkRect srcR = { 0.5f, 0.5f, 2.5f, 2.5f }; 143 SkRect srcR = { 0.5f, 0.5f, 2.5f, 2.5f };
144 SkRect dstR = { 100, 100, 300, 200 }; 144 SkRect dstR = { 100, 100, 300, 200 };
145 145
146 canvas->drawBitmapRectToRect(bitmap, &srcR, dstR, NULL); 146 canvas->drawBitmapRect(bitmap, &srcR, dstR, NULL);
147 } 147 }
148 148
149 private: 149 private:
150 typedef skiagm::GM INHERITED; 150 typedef skiagm::GM INHERITED;
151 }; 151 };
152 152
153 ////////////////////////////////////////////////////////////////////////////// 153 //////////////////////////////////////////////////////////////////////////////
154 static void make_big_bitmap(SkBitmap* bitmap) { 154 static void make_big_bitmap(SkBitmap* bitmap) {
155 155
156 static const int gXSize = 4096; 156 static const int gXSize = 4096;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 paint.setAlpha(128); 206 paint.setAlpha(128);
207 paint.setXfermode(mode)->unref(); 207 paint.setXfermode(mode)->unref();
208 208
209 SkRect srcR1 = { 0.0f, 0.0f, 4096.0f, 2040.0f }; 209 SkRect srcR1 = { 0.0f, 0.0f, 4096.0f, 2040.0f };
210 SkRect dstR1 = { 10.1f, 10.1f, 629.9f, 400.9f }; 210 SkRect dstR1 = { 10.1f, 10.1f, 629.9f, 400.9f };
211 211
212 SkRect srcR2 = { 4085.0f, 10.0f, 4087.0f, 12.0f }; 212 SkRect srcR2 = { 4085.0f, 10.0f, 4087.0f, 12.0f };
213 SkRect dstR2 = { 10, 410, 30, 430 }; 213 SkRect dstR2 = { 10, 410, 30, 430 };
214 214
215 if (!fUseIRect) { 215 if (!fUseIRect) {
216 canvas->drawBitmapRectToRect(fBigBitmap, &srcR1, dstR1, &paint); 216 canvas->drawBitmapRect(fBigBitmap, &srcR1, dstR1, &paint);
217 canvas->drawBitmapRectToRect(fBigBitmap, &srcR2, dstR2, &paint); 217 canvas->drawBitmapRect(fBigBitmap, &srcR2, dstR2, &paint);
218 } else { 218 } else {
219 SkIRect iSrcR1, iSrcR2; 219 SkIRect iSrcR1, iSrcR2;
220 220
221 srcR1.roundOut(&iSrcR1); 221 srcR1.roundOut(&iSrcR1);
222 srcR2.roundOut(&iSrcR2); 222 srcR2.roundOut(&iSrcR2);
223 223
224 canvas->drawBitmapRect(fBigBitmap, &iSrcR1, dstR1, &paint); 224 canvas->drawBitmapRect(fBigBitmap, iSrcR1, dstR1, &paint);
225 canvas->drawBitmapRect(fBigBitmap, &iSrcR2, dstR2, &paint); 225 canvas->drawBitmapRect(fBigBitmap, iSrcR2, dstR2, &paint);
226 } 226 }
227 } 227 }
228 228
229 private: 229 private:
230 typedef skiagm::GM INHERITED; 230 typedef skiagm::GM INHERITED;
231 }; 231 };
232 232
233 class BitmapRectRounding : public skiagm::GM { 233 class BitmapRectRounding : public skiagm::GM {
234 SkBitmap fBM; 234 SkBitmap fBM;
235 235
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 static skiagm::GMRegistry reg0(MyFactory0); 289 static skiagm::GMRegistry reg0(MyFactory0);
290 static skiagm::GMRegistry reg1(MyFactory1); 290 static skiagm::GMRegistry reg1(MyFactory1);
291 291
292 static skiagm::GMRegistry reg2(MyFactory2); 292 static skiagm::GMRegistry reg2(MyFactory2);
293 293
294 #ifndef SK_BUILD_FOR_ANDROID 294 #ifndef SK_BUILD_FOR_ANDROID
295 static skiagm::GMRegistry reg3(MyFactory3); 295 static skiagm::GMRegistry reg3(MyFactory3);
296 static skiagm::GMRegistry reg4(MyFactory4); 296 static skiagm::GMRegistry reg4(MyFactory4);
297 #endif 297 #endif
298 298
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698