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 "gm.h" | 8 #include "gm.h" |
9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4); | 74 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4); |
75 } | 75 } |
76 // Let backends know we won't change this, so they don't have to deep copy i
t defensively. | 76 // Let backends know we won't change this, so they don't have to deep copy i
t defensively. |
77 bm->setImmutable(); | 77 bm->setImmutable(); |
78 | 78 |
79 return image_from_bitmap(*bm); | 79 return image_from_bitmap(*bm); |
80 } | 80 } |
81 | 81 |
82 static void canvasproc(SkCanvas* canvas, SkImage*, const SkBitmap& bm, const SkI
Rect& srcR, | 82 static void canvasproc(SkCanvas* canvas, SkImage*, const SkBitmap& bm, const SkI
Rect& srcR, |
83 const SkRect& dstR) { | 83 const SkRect& dstR) { |
84 canvas->drawBitmapRect(bm, srcR, dstR, NULL); | 84 canvas->drawBitmapRect(bm, srcR, dstR, nullptr); |
85 } | 85 } |
86 | 86 |
87 static void imageproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const S
kIRect& srcR, | 87 static void imageproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, const S
kIRect& srcR, |
88 const SkRect& dstR) { | 88 const SkRect& dstR) { |
89 canvas->drawImageRect(image, srcR, dstR, NULL); | 89 canvas->drawImageRect(image, srcR, dstR, nullptr); |
90 } | 90 } |
91 | 91 |
92 static void imagescaleproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, co
nst SkIRect& srcIR, | 92 static void imagescaleproc(SkCanvas* canvas, SkImage* image, const SkBitmap&, co
nst SkIRect& srcIR, |
93 const SkRect& dstR) { | 93 const SkRect& dstR) { |
94 const int newW = SkScalarRoundToInt(dstR.width()); | 94 const int newW = SkScalarRoundToInt(dstR.width()); |
95 const int newH = SkScalarRoundToInt(dstR.height()); | 95 const int newH = SkScalarRoundToInt(dstR.height()); |
96 SkAutoTUnref<SkImage> newImage(image->newImage(newW, newH, &srcIR)); | 96 SkAutoTUnref<SkImage> newImage(image->newImage(newW, newH, &srcIR)); |
97 | 97 |
98 #ifdef SK_DEBUG | 98 #ifdef SK_DEBUG |
99 const SkIRect baseR = SkIRect::MakeWH(image->width(), image->height()); | 99 const SkIRect baseR = SkIRect::MakeWH(image->width(), image->height()); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 SkBlurMaskFilter::kIgnoreTransform_BlurFlag); | 219 SkBlurMaskFilter::kIgnoreTransform_BlurFlag); |
220 paint.setMaskFilter(mf)->unref(); | 220 paint.setMaskFilter(mf)->unref(); |
221 canvas->drawBitmapRect(bm, srcRect, dstRect, &paint); | 221 canvas->drawBitmapRect(bm, srcRect, dstRect, &paint); |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 private: | 225 private: |
226 typedef skiagm::GM INHERITED; | 226 typedef skiagm::GM INHERITED; |
227 }; | 227 }; |
228 | 228 |
229 DEF_GM( return new DrawBitmapRectGM(canvasproc, NULL); ) | 229 DEF_GM( return new DrawBitmapRectGM(canvasproc, nullptr); ) |
230 DEF_GM( return new DrawBitmapRectGM(imageproc, "-imagerect"); ) | 230 DEF_GM( return new DrawBitmapRectGM(imageproc, "-imagerect"); ) |
231 DEF_GM( return new DrawBitmapRectGM(imagescaleproc, "-imagescale"); ) | 231 DEF_GM( return new DrawBitmapRectGM(imagescaleproc, "-imagescale"); ) |
OLD | NEW |