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

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

Issue 1263463003: use SkNextID::ImageID for android's stable id (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | no next file » | 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 2011 Google Inc. 2 * Copyright 2011 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 "SkBitmapCache.h" 8 #include "SkBitmapCache.h"
9 #include "SkMutex.h" 9 #include "SkMutex.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return info.makeAlphaType(newAlphaType); 89 return info.makeAlphaType(newAlphaType);
90 } 90 }
91 91
92 #ifdef SK_TRACE_PIXELREF_LIFETIME 92 #ifdef SK_TRACE_PIXELREF_LIFETIME
93 static int32_t gInstCounter; 93 static int32_t gInstCounter;
94 #endif 94 #endif
95 95
96 SkPixelRef::SkPixelRef(const SkImageInfo& info) 96 SkPixelRef::SkPixelRef(const SkImageInfo& info)
97 : fInfo(validate_info(info)) 97 : fInfo(validate_info(info))
98 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 98 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
99 , fStableID(next_gen_id()) 99 , fStableID(SkNextID::ImageID())
100 #endif 100 #endif
101 101
102 { 102 {
103 #ifdef SK_TRACE_PIXELREF_LIFETIME 103 #ifdef SK_TRACE_PIXELREF_LIFETIME
104 SkDebugf(" pixelref %d\n", sk_atomic_inc(&gInstCounter)); 104 SkDebugf(" pixelref %d\n", sk_atomic_inc(&gInstCounter));
105 #endif 105 #endif
106 this->setMutex(NULL); 106 this->setMutex(NULL);
107 fRec.zero(); 107 fRec.zero();
108 fLockCount = 0; 108 fLockCount = 0;
109 this->needsNewGenID(); 109 this->needsNewGenID();
110 fMutability = kMutable; 110 fMutability = kMutable;
111 fPreLocked = false; 111 fPreLocked = false;
112 fAddedToCache.store(false); 112 fAddedToCache.store(false);
113 } 113 }
114 114
115 115
116 SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex) 116 SkPixelRef::SkPixelRef(const SkImageInfo& info, SkBaseMutex* mutex)
117 : fInfo(validate_info(info)) 117 : fInfo(validate_info(info))
118 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 118 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
119 , fStableID(next_gen_id()) 119 , fStableID(SkNextID::ImageID())
120 #endif 120 #endif
121 { 121 {
122 #ifdef SK_TRACE_PIXELREF_LIFETIME 122 #ifdef SK_TRACE_PIXELREF_LIFETIME
123 SkDebugf(" pixelref %d\n", sk_atomic_inc(&gInstCounter)); 123 SkDebugf(" pixelref %d\n", sk_atomic_inc(&gInstCounter));
124 #endif 124 #endif
125 this->setMutex(mutex); 125 this->setMutex(mutex);
126 fRec.zero(); 126 fRec.zero();
127 fLockCount = 0; 127 fLockCount = 0;
128 this->needsNewGenID(); 128 this->needsNewGenID();
129 fMutability = kMutable; 129 fMutability = kMutable;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 } 403 }
404 404
405 result->fUnlockProc = unlock_legacy_result; 405 result->fUnlockProc = unlock_legacy_result;
406 result->fUnlockContext = SkRef(this); // this is balanced in our fUnlockPr oc 406 result->fUnlockContext = SkRef(this); // this is balanced in our fUnlockPr oc
407 result->fCTable = fRec.fColorTable; 407 result->fCTable = fRec.fColorTable;
408 result->fPixels = fRec.fPixels; 408 result->fPixels = fRec.fPixels;
409 result->fRowBytes = fRec.fRowBytes; 409 result->fRowBytes = fRec.fRowBytes;
410 result->fSize.set(fInfo.width(), fInfo.height()); 410 result->fSize.set(fInfo.width(), fInfo.height());
411 return true; 411 return true;
412 } 412 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698