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

Side by Side Diff: src/utils/SkGatherPixelRefsAndRects.h

Issue 833943002: It is dangerous to ignore SkRect::intersect's return value (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update 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 | « src/gpu/GrReducedClip.cpp ('k') | no next file » | 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 2014 Google Inc. 2 * Copyright 2014 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 #ifndef SkGatherPixelRefsAndRects_DEFINED 8 #ifndef SkGatherPixelRefsAndRects_DEFINED
9 #define SkGatherPixelRefsAndRects_DEFINED 9 #define SkGatherPixelRefsAndRects_DEFINED
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 this->drawRect(draw, bounds, paint); 73 this->drawRect(draw, bounds, paint);
74 } 74 }
75 virtual void drawRect(const SkDraw& draw, const SkRect& rect, 75 virtual void drawRect(const SkDraw& draw, const SkRect& rect,
76 const SkPaint& paint) SK_OVERRIDE { 76 const SkPaint& paint) SK_OVERRIDE {
77 SkBitmap bm; 77 SkBitmap bm;
78 if (GetBitmapFromPaint(paint, &bm)) { 78 if (GetBitmapFromPaint(paint, &bm)) {
79 SkRect mappedRect; 79 SkRect mappedRect;
80 draw.fMatrix->mapRect(&mappedRect, rect); 80 draw.fMatrix->mapRect(&mappedRect, rect);
81 SkRect clipRect = SkRect::Make(draw.fRC->getBounds()); 81 SkRect clipRect = SkRect::Make(draw.fRC->getBounds());
82 mappedRect.intersect(clipRect); 82 if (mappedRect.intersect(clipRect)) {
83 fPRCont->add(bm.pixelRef(), mappedRect); 83 fPRCont->add(bm.pixelRef(), mappedRect);
84 }
84 } 85 }
85 } 86 }
86 virtual void drawOval(const SkDraw& draw, const SkRect& rect, 87 virtual void drawOval(const SkDraw& draw, const SkRect& rect,
87 const SkPaint& paint) SK_OVERRIDE { 88 const SkPaint& paint) SK_OVERRIDE {
88 this->drawRect(draw, rect, paint); 89 this->drawRect(draw, rect, paint);
89 } 90 }
90 virtual void drawRRect(const SkDraw& draw, const SkRRect& rrect, 91 virtual void drawRRect(const SkDraw& draw, const SkRRect& rrect,
91 const SkPaint& paint) SK_OVERRIDE { 92 const SkPaint& paint) SK_OVERRIDE {
92 this->drawRect(draw, rrect.rect(), paint); 93 this->drawRect(draw, rrect.rect(), paint);
93 } 94 }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 static void NotSupported() { 310 static void NotSupported() {
310 SkDEBUGFAIL("this method should never be called"); 311 SkDEBUGFAIL("this method should never be called");
311 } 312 }
312 313
313 static void NothingToDo() {} 314 static void NothingToDo() {}
314 315
315 typedef SkBaseDevice INHERITED; 316 typedef SkBaseDevice INHERITED;
316 }; 317 };
317 318
318 #endif // SkGatherPixelRefsAndRects_DEFINED 319 #endif // SkGatherPixelRefsAndRects_DEFINED
OLDNEW
« no previous file with comments | « src/gpu/GrReducedClip.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698