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

Side by Side Diff: src/images/SkImageEncoder_argb.cpp

Issue 719213008: SkColorTable locking serves no purpose anymore. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: oops Created 6 years 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/images/SkImageDecoder_libwebp.cpp ('k') | src/opts/SkBitmapProcState_opts_arm.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 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 "SkImageEncoder.h" 8 #include "SkImageEncoder.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 if (NULL == scanline_import) { 91 if (NULL == scanline_import) {
92 return false; 92 return false;
93 } 93 }
94 94
95 SkAutoLockPixels alp(bitmap); 95 SkAutoLockPixels alp(bitmap);
96 const uint8_t* src = (uint8_t*)bitmap.getPixels(); 96 const uint8_t* src = (uint8_t*)bitmap.getPixels();
97 if (NULL == bitmap.getPixels()) { 97 if (NULL == bitmap.getPixels()) {
98 return false; 98 return false;
99 } 99 }
100 100
101 SkAutoLockColors ctLocker; 101 const SkPMColor* colors = bitmap.getColorTable() ? bitmap.getColorTable()->r eadColors() : NULL;
102 const SkPMColor* colors = ctLocker.lockColors(bitmap);
103 102
104 const int argbStride = bitmap.width() * 4; 103 const int argbStride = bitmap.width() * 4;
105 SkAutoTDeleteArray<uint8_t> ada(new uint8_t[argbStride]); 104 SkAutoTDeleteArray<uint8_t> ada(new uint8_t[argbStride]);
106 uint8_t* argb = ada.get(); 105 uint8_t* argb = ada.get();
107 for (int y = 0; y < bitmap.height(); ++y) { 106 for (int y = 0; y < bitmap.height(); ++y) {
108 scanline_import(src + y * bitmap.rowBytes(), argb, bitmap.width(), color s); 107 scanline_import(src + y * bitmap.rowBytes(), argb, bitmap.width(), color s);
109 stream->write(argb, argbStride); 108 stream->write(argb, argbStride);
110 } 109 }
111 110
112 return true; 111 return true;
113 } 112 }
114 113
115 114
116 /////////////////////////////////////////////////////////////////////////////// 115 ///////////////////////////////////////////////////////////////////////////////
117 DEFINE_ENCODER_CREATOR(ARGBImageEncoder); 116 DEFINE_ENCODER_CREATOR(ARGBImageEncoder);
118 /////////////////////////////////////////////////////////////////////////////// 117 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libwebp.cpp ('k') | src/opts/SkBitmapProcState_opts_arm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698