OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkMallocPixelRef.h" | 8 #include "SkMallocPixelRef.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 return false; | 23 return false; |
24 } | 24 } |
25 | 25 |
26 // these seem like good checks, but currently we have (at least) tests | 26 // these seem like good checks, but currently we have (at least) tests |
27 // that expect the pixelref to succeed even when there is a mismatch | 27 // that expect the pixelref to succeed even when there is a mismatch |
28 // with colortables. fix? | 28 // with colortables. fix? |
29 #if 0 | 29 #if 0 |
30 if (kIndex8_SkColorType == info.fColorType && NULL == ctable) { | 30 if (kIndex8_SkColorType == info.fColorType && NULL == ctable) { |
31 return false; | 31 return false; |
32 } | 32 } |
33 if (kIndex8_SkColorType != info.fColorType && NULL != ctable) { | 33 if (kIndex8_SkColorType != info.fColorType && ctable) { |
34 return false; | 34 return false; |
35 } | 35 } |
36 #endif | 36 #endif |
37 return true; | 37 return true; |
38 } | 38 } |
39 | 39 |
40 SkMallocPixelRef* SkMallocPixelRef::NewDirect(const SkImageInfo& info, | 40 SkMallocPixelRef* SkMallocPixelRef::NewDirect(const SkImageInfo& info, |
41 void* addr, | 41 void* addr, |
42 size_t rowBytes, | 42 size_t rowBytes, |
43 SkColorTable* ctable) { | 43 SkColorTable* ctable) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 size_t SkMallocPixelRef::getAllocatedSizeInBytes() const { | 198 size_t SkMallocPixelRef::getAllocatedSizeInBytes() const { |
199 return this->info().getSafeSize(fRB); | 199 return this->info().getSafeSize(fRB); |
200 } | 200 } |
201 | 201 |
202 /////////////////////////////////////////////////////////////////////////////// | 202 /////////////////////////////////////////////////////////////////////////////// |
203 | 203 |
204 SkPixelRef* SkMallocPixelRef::PRFactory::create(const SkImageInfo& info, size_t
rowBytes, | 204 SkPixelRef* SkMallocPixelRef::PRFactory::create(const SkImageInfo& info, size_t
rowBytes, |
205 SkColorTable* ctable) { | 205 SkColorTable* ctable) { |
206 return SkMallocPixelRef::NewAllocate(info, rowBytes, ctable); | 206 return SkMallocPixelRef::NewAllocate(info, rowBytes, ctable); |
207 } | 207 } |
OLD | NEW |