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

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

Issue 1164373003: Revert of change SkDraw and all Blitters to use pixmap instead of bitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 SkPixmap& pixmap, Format format) { 176 SkData* CompressBitmapToFormat(const SkBitmap &bitmap, Format format) {
177 int compressedDataSize = GetCompressedDataSize(format, pixmap.width(), pixma p.height()); 177 SkAutoLockPixels alp(bitmap);
178
179 int compressedDataSize = GetCompressedDataSize(format, bitmap.width(), bitma p.height());
178 if (compressedDataSize < 0) { 180 if (compressedDataSize < 0) {
179 return NULL; 181 return NULL;
180 } 182 }
181 183
182 const uint8_t* src = reinterpret_cast<const uint8_t*>(pixmap.addr()); 184 const uint8_t* src = reinterpret_cast<const uint8_t*>(bitmap.getPixels());
183 SkData* dst = SkData::NewUninitialized(compressedDataSize); 185 SkData* dst = SkData::NewUninitialized(compressedDataSize);
184 186
185 if (!CompressBufferToFormat((uint8_t*)dst->writable_data(), src, pixmap.colo rType(), 187 if (!CompressBufferToFormat((uint8_t*)dst->writable_data(), src, bitmap.colo rType(),
186 pixmap.width(), pixmap.height(), pixmap.rowBytes (), format)) { 188 bitmap.width(), bitmap.height(), bitmap.rowBytes (), format)) {
187 dst->unref(); 189 dst->unref();
188 dst = NULL; 190 dst = NULL;
189 } 191 }
190 return dst; 192 return dst;
191 } 193 }
192 194
193 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuffer, 195 SkBlitter* CreateBlitterForFormat(int width, int height, void* compressedBuffer,
194 SkTBlitterAllocator *allocator, Format format) { 196 SkTBlitterAllocator *allocator, Format format) {
195 switch(format) { 197 switch(format) {
196 case kLATC_Format: 198 case kLATC_Format:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 253
252 default: 254 default:
253 // Do nothing... 255 // Do nothing...
254 break; 256 break;
255 } 257 }
256 258
257 return false; 259 return false;
258 } 260 }
259 261
260 } // namespace SkTextureCompressor 262 } // 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