OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkDiscardablePixelRef.h" | 8 #include "SkDiscardablePixelRef.h" |
9 #include "SkDiscardableMemory.h" | 9 #include "SkDiscardableMemory.h" |
10 #include "SkImageGenerator.h" | 10 #include "SkImageGenerator.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 rec->fColorTable = fCTable.get(); | 94 rec->fColorTable = fCTable.get(); |
95 rec->fRowBytes = fRowBytes; | 95 rec->fRowBytes = fRowBytes; |
96 return true; | 96 return true; |
97 } | 97 } |
98 | 98 |
99 void SkDiscardablePixelRef::onUnlockPixels() { | 99 void SkDiscardablePixelRef::onUnlockPixels() { |
100 fDiscardableMemory->unlock(); | 100 fDiscardableMemory->unlock(); |
101 fDiscardableMemoryIsLocked = false; | 101 fDiscardableMemoryIsLocked = false; |
102 } | 102 } |
103 | 103 |
104 bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, const SkIRect* su
bset, SkBitmap* dst, | 104 bool SkDEPRECATED_InstallDiscardablePixelRef(SkImageGenerator* generator, const
SkIRect* subset, |
105 SkDiscardableMemory::Factory* factory) { | 105 SkBitmap* dst, SkDiscardableMemory:
:Factory* factory) { |
106 SkAutoTDelete<SkImageGenerator> autoGenerator(generator); | 106 SkAutoTDelete<SkImageGenerator> autoGenerator(generator); |
107 if (nullptr == autoGenerator.get()) { | 107 if (nullptr == autoGenerator.get()) { |
108 return false; | 108 return false; |
109 } | 109 } |
110 | 110 |
111 SkImageInfo prInfo = autoGenerator->getInfo(); | 111 SkImageInfo prInfo = autoGenerator->getInfo(); |
112 if (prInfo.isEmpty()) { | 112 if (prInfo.isEmpty()) { |
113 return false; | 113 return false; |
114 } | 114 } |
115 | 115 |
(...skipping 21 matching lines...) Expand all Loading... |
137 return dst->tryAllocPixels(); | 137 return dst->tryAllocPixels(); |
138 } | 138 } |
139 SkAutoTUnref<SkDiscardablePixelRef> ref( | 139 SkAutoTUnref<SkDiscardablePixelRef> ref( |
140 new SkDiscardablePixelRef(prInfo, autoGenerator.detach(), dst->rowBy
tes(), factory)); | 140 new SkDiscardablePixelRef(prInfo, autoGenerator.detach(), dst->rowBy
tes(), factory)); |
141 dst->setPixelRef(ref, origin.x(), origin.y()); | 141 dst->setPixelRef(ref, origin.x(), origin.y()); |
142 return true; | 142 return true; |
143 } | 143 } |
144 | 144 |
145 // These are the public API | 145 // These are the public API |
146 | 146 |
147 bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst) { | 147 bool SkDEPRECATED_InstallDiscardablePixelRef(SkImageGenerator* generator, SkBitm
ap* dst) { |
148 return SkInstallDiscardablePixelRef(generator, nullptr, dst, nullptr); | 148 return SkDEPRECATED_InstallDiscardablePixelRef(generator, nullptr, dst, null
ptr); |
149 } | 149 } |
150 | 150 |
151 bool SkInstallDiscardablePixelRef(SkData* encoded, SkBitmap* dst) { | 151 bool SkDEPRECATED_InstallDiscardablePixelRef(SkData* encoded, SkBitmap* dst) { |
152 SkImageGenerator* generator = SkImageGenerator::NewFromEncoded(encoded); | 152 SkImageGenerator* generator = SkImageGenerator::NewFromEncoded(encoded); |
153 return generator ? SkInstallDiscardablePixelRef(generator, nullptr, dst, nul
lptr) : false; | 153 return generator ? |
| 154 SkDEPRECATED_InstallDiscardablePixelRef(generator, nullptr, dst, nul
lptr) : false; |
154 } | 155 } |
OLD | NEW |