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

Side by Side Diff: src/core/SkBitmap_scroll.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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/core/SkBitmapScaler.cpp ('k') | src/core/SkBlitter.cpp » ('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 /* 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkRegion.h" 9 #include "SkRegion.h"
10 10
11 bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy, 11 bool SkBitmap::scrollRect(const SkIRect* subset, int dx, int dy,
12 SkRegion* inval) const 12 SkRegion* inval) const
13 { 13 {
14 if (this->isImmutable() || kUnknown_SkColorType == this->colorType()) { 14 if (this->isImmutable() || kUnknown_SkColorType == this->colorType()) {
15 return false; 15 return false;
16 } 16 }
17 17
18 if (NULL != subset) { 18 if (subset) {
19 SkBitmap tmp; 19 SkBitmap tmp;
20 20
21 return this->extractSubset(&tmp, *subset) && 21 return this->extractSubset(&tmp, *subset) &&
22 // now call again with no rectangle 22 // now call again with no rectangle
23 tmp.scrollRect(NULL, dx, dy, inval); 23 tmp.scrollRect(NULL, dx, dy, inval);
24 } 24 }
25 25
26 int shift = this->bytesPerPixel() >> 1; 26 int shift = this->bytesPerPixel() >> 1;
27 int width = this->width(); 27 int width = this->width();
28 int height = this->height(); 28 int height = this->height();
29 29
30 // check if there's nothing to do 30 // check if there's nothing to do
31 if ((dx | dy) == 0 || width <= 0 || height <= 0) { 31 if ((dx | dy) == 0 || width <= 0 || height <= 0) {
32 if (NULL != inval) { 32 if (inval) {
33 inval->setEmpty(); 33 inval->setEmpty();
34 } 34 }
35 return true; 35 return true;
36 } 36 }
37 37
38 // compute the inval region now, before we see if there are any pixels 38 // compute the inval region now, before we see if there are any pixels
39 if (NULL != inval) { 39 if (inval) {
40 SkIRect r; 40 SkIRect r;
41 41
42 r.set(0, 0, width, height); 42 r.set(0, 0, width, height);
43 // initial the region with the entire bounds 43 // initial the region with the entire bounds
44 inval->setRect(r); 44 inval->setRect(r);
45 // do the "scroll" 45 // do the "scroll"
46 r.offset(dx, dy); 46 r.offset(dx, dy);
47 47
48 // check if we scrolled completely away 48 // check if we scrolled completely away
49 if (!SkIRect::Intersects(r, inval->getBounds())) { 49 if (!SkIRect::Intersects(r, inval->getBounds())) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 width <<= shift; // now width is the number of bytes to move per line 96 width <<= shift; // now width is the number of bytes to move per line
97 while (--height >= 0) { 97 while (--height >= 0) {
98 memmove(dst, src, width); 98 memmove(dst, src, width);
99 dst += rowBytes; 99 dst += rowBytes;
100 src += rowBytes; 100 src += rowBytes;
101 } 101 }
102 102
103 this->notifyPixelsChanged(); 103 this->notifyPixelsChanged();
104 return true; 104 return true;
105 } 105 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapScaler.cpp ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698