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

Side by Side Diff: src/utils/SkTextureCompressor.cpp

Issue 1168303006: Revert[2] SkDraw and all Blitters to use pixmap instead of bitmapi (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add dox to new test Created 5 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 | « src/utils/SkTextureCompressor.h ('k') | src/utils/SkTextureCompressor_Blitter.h » ('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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "SkTextureCompressor.h" 8 #include "SkTextureCompressor.h"
9 #include "SkTextureCompressor_ASTC.h" 9 #include "SkTextureCompressor_ASTC.h"
10 #include "SkTextureCompressor_LATC.h" 10 #include "SkTextureCompressor_LATC.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 } 167 }
168 168
169 if (proc) { 169 if (proc) {
170 return proc(dst, src, width, height, rowBytes); 170 return proc(dst, src, width, height, rowBytes);
171 } 171 }
172 172
173 return false; 173 return false;
174 } 174 }
175 175
176 SkData* CompressBitmapToFormat(const SkBitmap &bitmap, Format format) { 176 SkData* CompressBitmapToFormat(const SkPixmap& pixmap, Format format) {
177 SkAutoLockPixels alp(bitmap); 177 int compressedDataSize = GetCompressedDataSize(format, pixmap.width(), pixma p.height());
178
179 int compressedDataSize = GetCompressedDataSize(format, bitmap.width(), bitma p.height());
180 if (compressedDataSize < 0) { 178 if (compressedDataSize < 0) {
181 return NULL; 179 return NULL;
182 } 180 }
183 181
184 const uint8_t* src = reinterpret_cast<const uint8_t*>(bitmap.getPixels()); 182 const uint8_t* src = reinterpret_cast<const uint8_t*>(pixmap.addr());
185 SkData* dst = SkData::NewUninitialized(compressedDataSize); 183 SkData* dst = SkData::NewUninitialized(compressedDataSize);
186 184
187 if (!CompressBufferToFormat((uint8_t*)dst->writable_data(), src, bitmap.colo rType(), 185 if (!CompressBufferToFormat((uint8_t*)dst->writable_data(), src, pixmap.colo rType(),
188 bitmap.width(), bitmap.height(), bitmap.rowBytes (), format)) { 186 pixmap.width(), pixmap.height(), pixmap.rowBytes (), format)) {
189 dst->unref(); 187 dst->unref();
190 dst = NULL; 188 dst = NULL;
191 } 189 }
192 return dst; 190 return dst;
193 } 191 }
194 192
195 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuffer, 193 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuffer,
196 SkTBlitterAllocator *allocator, Format format) { 194 SkTBlitterAllocator *allocator, Format format) {
197 switch(format) { 195 switch(format) {
198 case kLATC_Format: 196 case kLATC_Format:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 251
254 default: 252 default:
255 // Do nothing... 253 // Do nothing...
256 break; 254 break;
257 } 255 }
258 256
259 return false; 257 return false;
260 } 258 }
261 259
262 } // namespace SkTextureCompressor 260 } // namespace SkTextureCompressor
OLDNEW
« no previous file with comments | « src/utils/SkTextureCompressor.h ('k') | src/utils/SkTextureCompressor_Blitter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698