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

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

Issue 338933002: Cleaned a repeated if(condition) with the same condition (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 | « no previous file | 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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
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 8
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 if (pr) { 288 if (pr) {
289 const SkImageInfo& info = pr->info(); 289 const SkImageInfo& info = pr->info();
290 fPixelRefOrigin.set(SkPin32(dx, 0, info.fWidth), 290 fPixelRefOrigin.set(SkPin32(dx, 0, info.fWidth),
291 SkPin32(dy, 0, info.fHeight)); 291 SkPin32(dy, 0, info.fHeight));
292 } else { 292 } else {
293 // ignore dx,dy if there is no pixelref 293 // ignore dx,dy if there is no pixelref
294 fPixelRefOrigin.setZero(); 294 fPixelRefOrigin.setZero();
295 } 295 }
296 296
297 if (fPixelRef != pr) { 297 if (fPixelRef != pr) {
298 if (fPixelRef != pr) { 298 this->freePixels();
299 this->freePixels(); 299 SkASSERT(NULL == fPixelRef);
300 SkASSERT(NULL == fPixelRef);
301 300
302 SkSafeRef(pr); 301 SkSafeRef(pr);
303 fPixelRef = pr; 302 fPixelRef = pr;
304 }
305 this->updatePixelsFromRef(); 303 this->updatePixelsFromRef();
306 } 304 }
307 305
308 SkDEBUGCODE(this->validate();) 306 SkDEBUGCODE(this->validate();)
309 return pr; 307 return pr;
310 } 308 }
311 309
312 void SkBitmap::lockPixels() const { 310 void SkBitmap::lockPixels() const {
313 if (NULL != fPixelRef && 0 == sk_atomic_inc(&fPixelLockCount)) { 311 if (NULL != fPixelRef && 0 == sk_atomic_inc(&fPixelLockCount)) {
314 fPixelRef->lockPixels(); 312 fPixelRef->lockPixels();
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 /////////////////////////////////////////////////////////////////////////////// 1424 ///////////////////////////////////////////////////////////////////////////////
1427 1425
1428 #ifdef SK_DEBUG 1426 #ifdef SK_DEBUG
1429 void SkImageInfo::validate() const { 1427 void SkImageInfo::validate() const {
1430 SkASSERT(fWidth >= 0); 1428 SkASSERT(fWidth >= 0);
1431 SkASSERT(fHeight >= 0); 1429 SkASSERT(fHeight >= 0);
1432 SkASSERT(SkColorTypeIsValid(fColorType)); 1430 SkASSERT(SkColorTypeIsValid(fColorType));
1433 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1431 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1434 } 1432 }
1435 #endif 1433 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698