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

Side by Side Diff: src/gpu/SkGr.cpp

Issue 26709002: Revert "change SkColorTable to be immutable" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkSpriteBlitter_RGB16.cpp ('k') | src/images/SkImageDecoder_libgif.cpp » ('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 2010 Google Inc. 2 * Copyright 2010 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 "SkGr.h" 8 #include "SkGr.h"
9 9
10 /* Fill out buffer with the compressed format Ganesh expects from a colortable 10 /* Fill out buffer with the compressed format Ganesh expects from a colortable
(...skipping 13 matching lines...) Expand all
24 SkAutoLockPixels alp(bitmap); 24 SkAutoLockPixels alp(bitmap);
25 if (!bitmap.readyToDraw()) { 25 if (!bitmap.readyToDraw()) {
26 SkDEBUGFAIL("bitmap not ready to draw!"); 26 SkDEBUGFAIL("bitmap not ready to draw!");
27 return; 27 return;
28 } 28 }
29 29
30 SkColorTable* ctable = bitmap.getColorTable(); 30 SkColorTable* ctable = bitmap.getColorTable();
31 char* dst = (char*)buffer; 31 char* dst = (char*)buffer;
32 32
33 memcpy(dst, ctable->lockColors(), ctable->count() * sizeof(SkPMColor)); 33 memcpy(dst, ctable->lockColors(), ctable->count() * sizeof(SkPMColor));
34 ctable->unlockColors(); 34 ctable->unlockColors(false);
35 35
36 // always skip a full 256 number of entries, even if we memcpy'd fewer 36 // always skip a full 256 number of entries, even if we memcpy'd fewer
37 dst += kGrColorTableSize; 37 dst += kGrColorTableSize;
38 38
39 if ((unsigned)bitmap.width() == bitmap.rowBytes()) { 39 if ((unsigned)bitmap.width() == bitmap.rowBytes()) {
40 memcpy(dst, bitmap.getPixels(), bitmap.getSize()); 40 memcpy(dst, bitmap.getPixels(), bitmap.getSize());
41 } else { 41 } else {
42 // need to trim off the extra bytes per row 42 // need to trim off the extra bytes per row
43 size_t width = bitmap.width(); 43 size_t width = bitmap.width();
44 size_t rowBytes = bitmap.rowBytes(); 44 size_t rowBytes = bitmap.rowBytes();
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 return kRGB_565_GrPixelConfig; 207 return kRGB_565_GrPixelConfig;
208 case SkBitmap::kARGB_4444_Config: 208 case SkBitmap::kARGB_4444_Config:
209 return kRGBA_4444_GrPixelConfig; 209 return kRGBA_4444_GrPixelConfig;
210 case SkBitmap::kARGB_8888_Config: 210 case SkBitmap::kARGB_8888_Config:
211 return kSkia8888_GrPixelConfig; 211 return kSkia8888_GrPixelConfig;
212 default: 212 default:
213 // kNo_Config, kA1_Config missing 213 // kNo_Config, kA1_Config missing
214 return kUnknown_GrPixelConfig; 214 return kUnknown_GrPixelConfig;
215 } 215 }
216 } 216 }
OLDNEW
« no previous file with comments | « src/core/SkSpriteBlitter_RGB16.cpp ('k') | src/images/SkImageDecoder_libgif.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698