OLD | NEW |
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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 334 } |
335 | 335 |
336 void SkBitmap::updatePixelsFromRef() const { | 336 void SkBitmap::updatePixelsFromRef() const { |
337 if (NULL != fPixelRef) { | 337 if (NULL != fPixelRef) { |
338 if (fPixelLockCount > 0) { | 338 if (fPixelLockCount > 0) { |
339 SkASSERT(fPixelRef->isLocked()); | 339 SkASSERT(fPixelRef->isLocked()); |
340 | 340 |
341 void* p = fPixelRef->pixels(); | 341 void* p = fPixelRef->pixels(); |
342 if (NULL != p) { | 342 if (NULL != p) { |
343 p = (char*)p | 343 p = (char*)p |
344 + fPixelRef->rowBytes() * fPixelRefOrigin.fY | 344 + fPixelRefOrigin.fY * fRowBytes |
345 + fPixelRefOrigin.fX * fBytesPerPixel; | 345 + fPixelRefOrigin.fX * fBytesPerPixel; |
346 } | 346 } |
347 fPixels = p; | 347 fPixels = p; |
348 SkRefCnt_SafeAssign(fColorTable, fPixelRef->colorTable()); | 348 SkRefCnt_SafeAssign(fColorTable, fPixelRef->colorTable()); |
349 } else { | 349 } else { |
350 SkASSERT(0 == fPixelLockCount); | 350 SkASSERT(0 == fPixelLockCount); |
351 fPixels = NULL; | 351 fPixels = NULL; |
352 if (fColorTable) { | 352 if (fColorTable) { |
353 fColorTable->unref(); | 353 fColorTable->unref(); |
354 fColorTable = NULL; | 354 fColorTable = NULL; |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 if (NULL != uri) { | 1636 if (NULL != uri) { |
1637 str->appendf(" uri:\"%s\"", uri); | 1637 str->appendf(" uri:\"%s\"", uri); |
1638 } else { | 1638 } else { |
1639 str->appendf(" pixelref:%p", pr); | 1639 str->appendf(" pixelref:%p", pr); |
1640 } | 1640 } |
1641 } | 1641 } |
1642 | 1642 |
1643 str->append(")"); | 1643 str->append(")"); |
1644 } | 1644 } |
1645 #endif | 1645 #endif |
OLD | NEW |