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

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

Issue 980903002: Option for SkCodec to treat dst as all zeroes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update SkBmpCodec to use new ZeroInitialized API. Created 5 years, 9 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 | « src/images/SkDecodingImageGenerator.cpp ('k') | src/ports/SkImageGenerator_skia.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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (NULL == fDiscardableMemory) { 64 if (NULL == fDiscardableMemory) {
65 fDiscardableMemoryIsLocked = false; 65 fDiscardableMemoryIsLocked = false;
66 return false; // Memory allocation failed. 66 return false; // Memory allocation failed.
67 } 67 }
68 68
69 void* pixels = fDiscardableMemory->data(); 69 void* pixels = fDiscardableMemory->data();
70 const SkImageInfo& info = this->info(); 70 const SkImageInfo& info = this->info();
71 SkPMColor colors[256]; 71 SkPMColor colors[256];
72 int colorCount = 0; 72 int colorCount = 0;
73 73
74 const SkImageGenerator::Result result = fGenerator->getPixels(info, pixels, fRowBytes, 74 const SkImageGenerator::Result result = fGenerator->getPixels(info, pixels, fRowBytes, NULL,
75 colors, &color Count); 75 colors, &color Count);
76 switch (result) { 76 switch (result) {
77 case SkImageGenerator::kSuccess: 77 case SkImageGenerator::kSuccess:
78 case SkImageGenerator::kIncompleteInput: 78 case SkImageGenerator::kIncompleteInput:
79 break; 79 break;
80 default: 80 default:
81 fDiscardableMemory->unlock(); 81 fDiscardableMemory->unlock();
82 fDiscardableMemoryIsLocked = false; 82 fDiscardableMemoryIsLocked = false;
83 SkDELETE(fDiscardableMemory); 83 SkDELETE(fDiscardableMemory);
84 fDiscardableMemory = NULL; 84 fDiscardableMemory = NULL;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // These are the public API 134 // These are the public API
135 135
136 bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst) { 136 bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, SkBitmap* dst) {
137 return SkInstallDiscardablePixelRef(generator, dst, NULL); 137 return SkInstallDiscardablePixelRef(generator, dst, NULL);
138 } 138 }
139 139
140 bool SkInstallDiscardablePixelRef(SkData* encoded, SkBitmap* dst) { 140 bool SkInstallDiscardablePixelRef(SkData* encoded, SkBitmap* dst) {
141 SkImageGenerator* generator = SkImageGenerator::NewFromData(encoded); 141 SkImageGenerator* generator = SkImageGenerator::NewFromData(encoded);
142 return generator ? SkInstallDiscardablePixelRef(generator, dst, NULL) : fals e; 142 return generator ? SkInstallDiscardablePixelRef(generator, dst, NULL) : fals e;
143 } 143 }
OLDNEW
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | src/ports/SkImageGenerator_skia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698