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 "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 SkRect dstR = { 0, 200, 128, 380 }; | 64 SkRect dstR = { 0, 200, 128, 380 }; |
65 | 65 |
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->drawBitmapRectToRect(bitmap, &srcR, dstR, &paint); | 73 canvas->drawBitmapRect(bitmap, &srcR, dstR, &paint, |
| 74 SkCanvas::kStrict_SrcRectConstraint); |
74 } else { | 75 } else { |
75 canvas->drawBitmapRect(bitmap, &src[i], dstR, &paint); | 76 canvas->drawBitmapRect(bitmap, &src[i], dstR, &paint); |
76 } | 77 } |
77 | 78 |
78 canvas->drawRect(dstR, paint); | 79 canvas->drawRect(dstR, paint); |
79 canvas->drawRect(srcR, paint); | 80 canvas->drawRect(srcR, paint); |
80 | 81 |
81 canvas->translate(160, 0); | 82 canvas->translate(160, 0); |
82 } | 83 } |
83 } | 84 } |
(...skipping 19 matching lines...) Expand all Loading... |
103 SkPaint paint; | 104 SkPaint paint; |
104 | 105 |
105 for (int y = 0; y < ySize; y++) { | 106 for (int y = 0; y < ySize; y++) { |
106 for (int x = 0; x < xSize; x++) { | 107 for (int x = 0; x < xSize; x++) { |
107 paint.setColor(textureData[x][y]); | 108 paint.setColor(textureData[x][y]); |
108 canvas.drawIRect(SkIRect::MakeXYWH(x, y, 1, 1), paint); | 109 canvas.drawIRect(SkIRect::MakeXYWH(x, y, 1, 1), paint); |
109 } | 110 } |
110 } | 111 } |
111 } | 112 } |
112 | 113 |
113 // This GM attempts to make visible any issues drawBitmapRectToRect may have | 114 // This GM attempts to make visible any issues drawBitmapRect may have |
114 // with partial source rects. In this case the eight pixels on the border | 115 // with partial source rects. In this case the eight pixels on the border |
115 // should be half the width/height of the central pixel, i.e.: | 116 // should be half the width/height of the central pixel, i.e.: |
116 // __|____|__ | 117 // __|____|__ |
117 // | | | 118 // | | |
118 // __|____|__ | 119 // __|____|__ |
119 // | | | 120 // | | |
120 class DrawBitmapRect3 : public skiagm::GM { | 121 class DrawBitmapRect3 : public skiagm::GM { |
121 public: | 122 public: |
122 DrawBitmapRect3() { | 123 DrawBitmapRect3() { |
123 this->setBGColor(SK_ColorBLACK); | 124 this->setBGColor(SK_ColorBLACK); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 static skiagm::GMRegistry reg0(MyFactory0); | 289 static skiagm::GMRegistry reg0(MyFactory0); |
289 static skiagm::GMRegistry reg1(MyFactory1); | 290 static skiagm::GMRegistry reg1(MyFactory1); |
290 | 291 |
291 static skiagm::GMRegistry reg2(MyFactory2); | 292 static skiagm::GMRegistry reg2(MyFactory2); |
292 | 293 |
293 #ifndef SK_BUILD_FOR_ANDROID | 294 #ifndef SK_BUILD_FOR_ANDROID |
294 static skiagm::GMRegistry reg3(MyFactory3); | 295 static skiagm::GMRegistry reg3(MyFactory3); |
295 static skiagm::GMRegistry reg4(MyFactory4); | 296 static skiagm::GMRegistry reg4(MyFactory4); |
296 #endif | 297 #endif |
297 | 298 |
OLD | NEW |