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

Side by Side Diff: src/lazy/SkDiscardablePixelRef.cpp

Issue 428603002: SkDiscardablePixelRef returns correct indexed color on relock. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: AnotherPatchSet Created 6 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 | tests/ImageDecodingTest.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 "SkDiscardablePixelRef.h" 8 #include "SkDiscardablePixelRef.h"
9 #include "SkDiscardableMemory.h" 9 #include "SkDiscardableMemory.h"
10 #include "SkImageGenerator.h" 10 #include "SkImageGenerator.h"
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 SkDELETE(fDiscardableMemory); 34 SkDELETE(fDiscardableMemory);
35 SkSafeUnref(fDMFactory); 35 SkSafeUnref(fDMFactory);
36 SkDELETE(fGenerator); 36 SkDELETE(fGenerator);
37 } 37 }
38 38
39 bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) { 39 bool SkDiscardablePixelRef::onNewLockPixels(LockRec* rec) {
40 if (fDiscardableMemory != NULL) { 40 if (fDiscardableMemory != NULL) {
41 if (fDiscardableMemory->lock()) { 41 if (fDiscardableMemory->lock()) {
42 rec->fPixels = fDiscardableMemory->data(); 42 rec->fPixels = fDiscardableMemory->data();
43 rec->fColorTable = NULL; 43 rec->fColorTable = fCTable.get();
44 rec->fRowBytes = fRowBytes; 44 rec->fRowBytes = fRowBytes;
45 return true; 45 return true;
46 } 46 }
47 SkDELETE(fDiscardableMemory); 47 SkDELETE(fDiscardableMemory);
48 fDiscardableMemory = NULL; 48 fDiscardableMemory = NULL;
49 } 49 }
50 50
51 const size_t size = this->info().getSafeSize(fRowBytes); 51 const size_t size = this->info().getSafeSize(fRowBytes);
52 52
53 if (fDMFactory != NULL) { 53 if (fDMFactory != NULL) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 SkNEW_ARGS(SkDiscardablePixelRef, 113 SkNEW_ARGS(SkDiscardablePixelRef,
114 (info, autoGenerator.detach(), dst->rowBytes(), factory))); 114 (info, autoGenerator.detach(), dst->rowBytes(), factory)));
115 dst->setPixelRef(ref); 115 dst->setPixelRef(ref);
116 return true; 116 return true;
117 } 117 }
118 118
119 // This is the public API 119 // This is the public API
120 bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst) { 120 bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst) {
121 return SkInstallDiscardablePixelRef(generator, dst, NULL); 121 return SkInstallDiscardablePixelRef(generator, dst, NULL);
122 } 122 }
OLDNEW
« no previous file with comments | « no previous file | tests/ImageDecodingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698