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

Side by Side Diff: src/core/SkBitmap.cpp

Issue 769323002: Make SkColorTable explicitly thread-safe. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 const SkImageInfo dstInfo = src->info().makeColorType(dstColorType); 931 const SkImageInfo dstInfo = src->info().makeColorType(dstColorType);
932 932
933 SkBitmap tmpDst; 933 SkBitmap tmpDst;
934 if (!tmpDst.setInfo(dstInfo)) { 934 if (!tmpDst.setInfo(dstInfo)) {
935 return false; 935 return false;
936 } 936 }
937 937
938 // allocate colortable if srcConfig == kIndex8_Config 938 // allocate colortable if srcConfig == kIndex8_Config
939 SkAutoTUnref<SkColorTable> ctable; 939 SkAutoTUnref<SkColorTable> ctable;
940 if (dstColorType == kIndex_8_SkColorType) { 940 if (dstColorType == kIndex_8_SkColorType) {
941 // TODO: can we just ref() the src colortable? Is it reentrant-safe? 941 ctable.reset(SkRef(src->getColorTable()));
942 ctable.reset(SkNEW_ARGS(SkColorTable, (*src->getColorTable())));
943 } 942 }
944 if (!tmpDst.tryAllocPixels(alloc, ctable)) { 943 if (!tmpDst.tryAllocPixels(alloc, ctable)) {
945 return false; 944 return false;
946 } 945 }
947 946
948 if (!tmpDst.readyToDraw()) { 947 if (!tmpDst.readyToDraw()) {
949 // allocator/lock failed 948 // allocator/lock failed
950 return false; 949 return false;
951 } 950 }
952 951
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 /////////////////////////////////////////////////////////////////////////////// 1377 ///////////////////////////////////////////////////////////////////////////////
1379 1378
1380 #ifdef SK_DEBUG 1379 #ifdef SK_DEBUG
1381 void SkImageInfo::validate() const { 1380 void SkImageInfo::validate() const {
1382 SkASSERT(fWidth >= 0); 1381 SkASSERT(fWidth >= 0);
1383 SkASSERT(fHeight >= 0); 1382 SkASSERT(fHeight >= 0);
1384 SkASSERT(SkColorTypeIsValid(fColorType)); 1383 SkASSERT(SkColorTypeIsValid(fColorType));
1385 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1384 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1386 } 1385 }
1387 #endif 1386 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698