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

Side by Side Diff: gm/offsetimagefilter.cpp

Issue 825983005: Revert of It is dangerous to ignore SkRect::intersect's return value (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « gm/gmmain.cpp ('k') | include/core/SkRect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkOffsetImageFilter.h" 9 #include "SkOffsetImageFilter.h"
10 #include "SkBitmapSource.h" 10 #include "SkBitmapSource.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 SkPaint strokePaint; 75 SkPaint strokePaint;
76 strokePaint.setStyle(SkPaint::kStroke_Style); 76 strokePaint.setStyle(SkPaint::kStroke_Style);
77 strokePaint.setColor(SK_ColorRED); 77 strokePaint.setColor(SK_ColorRED);
78 78
79 // Draw a boundary rect around the intersection of the clip rect 79 // Draw a boundary rect around the intersection of the clip rect
80 // and crop rect. 80 // and crop rect.
81 SkMatrix scaleMatrix; 81 SkMatrix scaleMatrix;
82 scaleMatrix.setScale(scale, scale); 82 scaleMatrix.setScale(scale, scale);
83 SkRect cropRectFloat; 83 SkRect cropRectFloat;
84 scaleMatrix.mapRect(&cropRectFloat, SkRect::Make(cropRect)); 84 scaleMatrix.mapRect(&cropRectFloat, SkRect::Make(cropRect));
85 if (clipRect.intersect(cropRectFloat)) { 85 clipRect.intersect(cropRectFloat);
86 canvas->drawRect(clipRect, strokePaint); 86 canvas->drawRect(clipRect, strokePaint);
87 }
88 } 87 }
89 88
90 virtual void onDraw(SkCanvas* canvas) { 89 virtual void onDraw(SkCanvas* canvas) {
91 if (!fInitialized) { 90 if (!fInitialized) {
92 make_bitmap(); 91 make_bitmap();
93 make_checkerboard(); 92 make_checkerboard();
94 fInitialized = true; 93 fInitialized = true;
95 } 94 }
96 canvas->clear(0x00000000); 95 canvas->clear(0x00000000);
97 SkPaint paint; 96 SkPaint paint;
(...skipping 27 matching lines...) Expand all
125 SkBitmap fBitmap, fCheckerboard; 124 SkBitmap fBitmap, fCheckerboard;
126 bool fInitialized; 125 bool fInitialized;
127 }; 126 };
128 127
129 ////////////////////////////////////////////////////////////////////////////// 128 //////////////////////////////////////////////////////////////////////////////
130 129
131 static GM* MyFactory(void*) { return new OffsetImageFilterGM; } 130 static GM* MyFactory(void*) { return new OffsetImageFilterGM; }
132 static GMRegistry reg(MyFactory); 131 static GMRegistry reg(MyFactory);
133 132
134 } 133 }
OLDNEW
« no previous file with comments | « gm/gmmain.cpp ('k') | include/core/SkRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698